"Minor season result fixes."

This commit is contained in:
gyboth 2005-10-04 14:47:15 +00:00
parent ff5d849ae2
commit c5ad254f4a
8 changed files with 39 additions and 19 deletions

View File

@ -2,13 +2,14 @@
- fixed some minor bugs
- updated translations
- added Spanish and Chinese translations
- switched from 'arj' to Gnu 'zip' in the Windows port
- switched from 'arj' to GNU 'zip' in the Windows port
- added player streaks (hot/cold)
- added definition for the Netherlands (thanks to Zwakstroom)
- added definition for the World Cup 2006 Germany
- minor definition system improvements
- window geometry can be saved
- boost and style change 'on the fly' during live games
- added season results view (Figures -> Season results)
09/10/2005: v1.9.1

File diff suppressed because one or more lines are too long

View File

@ -798,32 +798,40 @@ fixture_get_week_list(gint week_number, gint week_round_number)
return fixtures;
}
/** Print the result of the fixture into a buffer. */
/** Print the result of the fixture into a buffer.
@param swap Whether to swap the two teams' goals. */
void
fixture_result_to_buf(const Fixture *fix, gchar *buf)
fixture_result_to_buf(const Fixture *fix, gchar *buf, gboolean swap)
{
gchar local_buf[SMALL];
gint idx0 = 0, idx1 = 1;
if(swap)
{
idx0 = 1;
idx1 = 0;
}
if(fix->attendance < 0)
strcpy(buf, "-- : --");
else
{
sprintf(local_buf, "%d - %d", math_sum_int_array(fix->result[0], 3),
math_sum_int_array(fix->result[1], 3));
if(fix->result[0][2] + fix->result[1][2] != 0)
sprintf(local_buf, "%d - %d", math_sum_int_array(fix->result[idx0], 3),
math_sum_int_array(fix->result[idx1], 3));
if(fix->result[idx0][2] + fix->result[idx1][2] != 0)
/* Game was decided in penalty shoot-out. */
strcat(local_buf, _(" p."));
else if(fix->result[0][1] + fix->result[1][1] != 0)
else if(fix->result[idx0][1] + fix->result[idx1][1] != 0)
/* Game was decided in extra time. */
strcat(local_buf, _(" e.t."));
if(fix->second_leg)
sprintf(buf, "%s (%d - %d)", local_buf,
fixture_get_first_leg(fix)->result[1][0],
fixture_get_first_leg(fix)->result[0][0]);
fixture_get_first_leg(fix)->result[idx1][0],
fixture_get_first_leg(fix)->result[idx0][0]);
else
strcpy(buf, local_buf);
}
}
}
/** Return the number of fixtures in a given week round.

View File

@ -84,7 +84,7 @@ GPtrArray*
fixture_get_week_list_clid(gint clid, gint week_number, gint week_round_number);
void
fixture_result_to_buf(const Fixture *fix, gchar *buf);
fixture_result_to_buf(const Fixture *fix, gchar *buf, gboolean swap);
gint
fixture_get_number_of_matches(gint week_number, gint week_round_number);

View File

@ -270,7 +270,10 @@ load_save_load_game(const gchar* filename, gboolean create_main_window)
on_button_back_to_main_clicked(NULL, NULL);
}
else if(window.main != NULL)
{
gtk_widget_show(window.main);
window_main_load_geometry();
}
g_free(basename);
g_free(dirname);

View File

@ -245,7 +245,7 @@ end_week_round_results(void)
live_game_calculate_fixture(&g_array_index(lig(i).fixtures, Fixture, j));
done++;
fixture_result_to_buf(&g_array_index(lig(i).fixtures, Fixture, j), buf);
fixture_result_to_buf(&g_array_index(lig(i).fixtures, Fixture, j), buf, FALSE);
sprintf(buf2, "%s %s %s",
g_array_index(lig(i).fixtures, Fixture, j).teams[0]->name->str,
buf,
@ -265,7 +265,7 @@ end_week_round_results(void)
live_game_calculate_fixture(&g_array_index(acp(i)->fixtures, Fixture, j));
done++;
fixture_result_to_buf(&g_array_index(acp(i)->fixtures, Fixture, j), buf);
fixture_result_to_buf(&g_array_index(acp(i)->fixtures, Fixture, j), buf, FALSE);
sprintf(buf2, "%s %s %s",
g_array_index(acp(i)->fixtures, Fixture, j).teams[0]->name->str,
buf,

View File

@ -713,7 +713,7 @@ treeview_create_game_stats(LiveGame *live_game)
G_TYPE_STRING,
G_TYPE_STRING);
fixture_result_to_buf(live_game->fix, buf[0]);
fixture_result_to_buf(live_game->fix, buf[0], FALSE);
gtk_list_store_append(ls, &iter);
gtk_list_store_set(ls, &iter, 0, live_game->fix->teams[0]->name->str,
1, buf[0],
@ -921,7 +921,7 @@ treeview_create_fixture(const Fixture *fix, GtkListStore *ls)
colour_bg = const_app("string_treeview_helper_color_default_background");
}
fixture_result_to_buf(fix, buf_result);
fixture_result_to_buf(fix, buf_result, FALSE);
for(i=0;i<2;i++)
if(query_fixture_has_tables(fix))

View File

@ -1524,14 +1524,22 @@ treeview_helper_season_results(GtkTreeViewColumn *col,
g_object_set(renderer, "background",
const_app("string_treeview_helper_color_default_background"), NULL);
}
else if(fix->result[user_idx][0] > fix->result[!user_idx][0])
else if((fix->result[0][2] + fix->result[1][2] > 0 &&
fix->result[user_idx][2] > fix->result[!user_idx][2]) ||
(fix->result[0][2] + fix->result[1][2] == 0 &&
math_sum_int_array(fix->result[user_idx], 2) >
math_sum_int_array(fix->result[!user_idx], 2)))
{
/* Won. */
strcpy(buf, _("W"));
g_object_set(renderer, "background",
const_app("string_treeview_helper_season_results_win_bg"), NULL);
}
else if(fix->result[user_idx][0] < fix->result[!user_idx][0])
else if((fix->result[0][2] + fix->result[1][2] > 0 &&
fix->result[user_idx][2] < fix->result[!user_idx][2]) ||
(fix->result[0][2] + fix->result[1][2] == 0 &&
math_sum_int_array(fix->result[user_idx], 2) <
math_sum_int_array(fix->result[!user_idx], 2)))
{
/* Lost. */
strcpy(buf, _("L"));
@ -1547,7 +1555,7 @@ treeview_helper_season_results(GtkTreeViewColumn *col,
}
}
else if(column == 5)
fixture_result_to_buf(fix, buf);
fixture_result_to_buf(fix, buf, (user_idx == 1));
g_object_set(renderer, "text", buf, NULL);
}