1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2024-12-14 01:14:28 +01:00

"Promrel teams order."

This commit is contained in:
gyboth 2005-06-23 09:22:37 +00:00
parent a0074cc159
commit b5eaf1328c
6 changed files with 21 additions and 15 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-06-22 19:41+0200\n"
"POT-Creation-Date: 2005-06-23 11:20+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -396,6 +396,9 @@ league_get_team_movements(League *league, GArray *team_movements)
g_ptr_array_free(prom_games_teams, TRUE);
}
g_array_sort_with_data(league->teams, team_compare_func,
GINT_TO_POINTER(TEAM_COMPARE_LEAGUE_RANK + 100));
for(i=move_len;i<team_movements->len;i++)
league_remove_team_with_id(league_from_clid(g_array_index(team_movements, TeamMove, i).tm.clid),
g_array_index(team_movements, TeamMove, i).tm.id);

View File

@ -70,7 +70,7 @@ start_new_season(void)
usr(i).team_id, usr(i).tm->clid,
team_get_league_rank(usr(i).tm), "");
start_new_season_team_movements();
start_new_season_league_changes();
for(i=0;i<users->len;i++)
{
@ -108,10 +108,6 @@ start_new_season(void)
}
stat5 = -1;
if(season > 1)
for(i=0;i<ligs->len;i++)
league_season_start(&lig(i));
for(i=0;i<name_lists->len;i++)
name_shorten_list(&nli(i));
}
@ -480,7 +476,7 @@ query_start_end_season_end(void)
/** Manage promotions and relegations at the beginning of a new season. */
void
start_new_season_team_movements(void)
start_new_season_league_changes(void)
{
gint i, j, k;
GArray *team_movements = g_array_new(FALSE, FALSE, sizeof(TeamMove));
@ -488,17 +484,20 @@ start_new_season_team_movements(void)
for(i=0;i<ligs->len;i++)
league_get_team_movements(&lig(i), team_movements);
for(i=0;i<team_movements->len;i++)
if(g_array_index(team_movements, TeamMove, i).prom_rel_type != PROM_REL_RELEGATION)
g_array_append_val(lig(g_array_index(team_movements, TeamMove, i).league_idx).teams,
g_array_index(team_movements, TeamMove, i).tm);
else
for(i = team_movements->len - 1; i >= 0; i--)
if(g_array_index(team_movements, TeamMove, i).prom_rel_type == PROM_REL_RELEGATION)
g_array_prepend_val(lig(g_array_index(team_movements, TeamMove, i).league_idx).teams,
g_array_index(team_movements, TeamMove, i).tm);
for(i=1;i<team_movements->len;i++)
if(g_array_index(team_movements, TeamMove, i).prom_rel_type != PROM_REL_RELEGATION)
g_array_append_val(lig(g_array_index(team_movements, TeamMove, i).league_idx).teams,
g_array_index(team_movements, TeamMove, i).tm);
g_array_free(team_movements, TRUE);
for(i=0;i<ligs->len;i++)
{
for(j=0;j<lig(i).teams->len;j++)
{
g_array_index(lig(i).teams, Team, j).clid = lig(i).id;
@ -506,6 +505,9 @@ start_new_season_team_movements(void)
g_array_index(g_array_index(lig(i).teams, Team, j).players, Player, k).team =
&g_array_index(lig(i).teams, Team, j);
}
league_season_start(&lig(i));
}
}
/** End a season (store stats etc.) */

View File

@ -52,7 +52,7 @@ gboolean
query_start_end_season_end(void);
void
start_new_season_team_movements(void);
start_new_season_league_changes(void);
void
end_week(void);

View File

@ -346,7 +346,7 @@ team_is_user(const Team *tm)
gint i;
for(i=0;i<users->len;i++)
if(usr(i).tm == tm)
if(usr(i).team_id == tm->id)
return i;
return -1;
@ -389,7 +389,7 @@ team_get_league_rank(const Team *tm)
GArray *elements = league_from_clid(tm->clid)->table.elements;
for(i=0;i<elements->len;i++)
if(g_array_index(elements, TableElement, i).team == tm)
if(g_array_index(elements, TableElement, i).team_id == tm->id)
return i + 1;
g_warning("team_get_league_rank: no rank found for team %s in league %s. \n",

View File

@ -191,6 +191,7 @@ xml_country_read(const gchar *country_name)
g_free(file_name);
free_country(TRUE);
country.supernational = FALSE;
if(g_markup_parse_context_parse(context, file_contents, length, &error))
{