1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2024-12-16 10:21:15 +01:00

Season start bugfix, new tokens for news.

This commit is contained in:
gyboth 2008-12-17 12:34:02 +00:00
parent c2538a54c4
commit 5b042932f7
4 changed files with 38 additions and 20 deletions

View File

@ -578,6 +578,20 @@ news_set_league_cup_tokens(const Fixture *fix)
misc_token_add(token_rep_news,
option_int("string_token_cup_match_winner", &tokens),
g_strdup(((Team*)fixture_winner_of(fix, FALSE))->name));
misc_token_add(token_rep_news,
option_int("string_token_cup_national", &tokens),
misc_int_to_char(query_league_cup_has_property(cup->id, "national")));
misc_token_add(token_rep_news,
option_int("string_token_cup_international", &tokens),
misc_int_to_char(query_league_cup_has_property(cup->id, "international")));
misc_token_add(token_rep_news,
option_int("string_token_cup_promrel", &tokens),
misc_int_to_char(query_league_cup_has_property(cup->id, "promotion")));
misc_token_add(token_rep_news,
option_int("string_token_cup_aux", &tokens),
misc_int_to_char(query_league_cup_has_property(cup->id, "hide") ||
query_league_cup_has_property(cup->id, "omit_from_history")));
}
}
@ -759,13 +773,12 @@ news_check_match_relevant(const LiveGame *live_game)
opt_int("int_opt_news_create_user"))
return TRUE;
user_leagues = g_array_new(FALSE, FALSE, sizeof(gint));
if(live_game->fix->clid >= ID_CUP_START &&
live_game->fix->round >= cup_from_clid(live_game->fix->clid)->rounds->len - 4 &&
opt_int("int_opt_news_create_cup"))
return TRUE;
user_leagues = g_array_new(FALSE, FALSE, sizeof(gint));
for(i = 0; i < users->len; i++)
if(!query_misc_integer_is_in_g_array(usr(i).tm->clid, user_leagues))
g_array_append_val(user_leagues, usr(i).tm->clid);

View File

@ -108,6 +108,20 @@ start_new_season(void)
free_names(TRUE);
stat5 = STATUS_GENERATE_TEAMS;
if(season == 1)
{
for(i=0;i<ligs->len;i++)
{
league_add_table(&lig(i));
league_check_new_tables(&lig(i));
}
for(i=0;i<cps->len;i++)
if(cp(i).add_week <= 0)
g_ptr_array_add(acps, &cp(i));
}
/* Remove cups that don't start at the beginning of season. */
for(i = acps->len - 1; i >= 0; i--)
{
g_ptr_array_free(acp(i)->team_names, TRUE);
@ -117,6 +131,7 @@ start_new_season(void)
g_ptr_array_remove_index(acps, i);
}
/* Deal with cups that have to take place before promotion/relegation. */
for(i=cps->len - 1; i >= 0; i--)
if(cp(i).add_week == -1)
{
@ -138,6 +153,7 @@ start_new_season(void)
const_int("int_training_camps_per_season");
}
/* Promotion/relegation, mainly. */
start_new_season_league_changes();
for(i=0;i<users->len;i++)
@ -157,18 +173,6 @@ start_new_season(void)
start_new_season_reset_ids();
}
else
{
for(i=0;i<ligs->len;i++)
{
league_add_table(&lig(i));
league_check_new_tables(&lig(i));
}
for(i=0;i<cps->len;i++)
if(cp(i).add_week <= 0)
g_ptr_array_add(acps, &cp(i));
}
for(i=0;i<ligs->len;i++)
if(query_league_active(&lig(i)))
@ -793,8 +797,7 @@ start_new_season_league_changes(void)
league_team_movements_destinations(team_movements, league_size);
for(i = team_movements->len - 1; i >= 0; i--)
if(g_array_index(team_movements, TeamMove, i).prom_rel_type ==
PROM_REL_RELEGATION)
if(g_array_index(team_movements, TeamMove, i).prom_rel_type == PROM_REL_RELEGATION)
g_array_prepend_val(
lig(g_array_index(
g_array_index(team_movements, TeamMove, i).dest_idcs,
@ -802,8 +805,7 @@ start_new_season_league_changes(void)
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)
if(g_array_index(team_movements, TeamMove, i).prom_rel_type != PROM_REL_RELEGATION)
g_array_append_val(
lig(g_array_index(
g_array_index(team_movements, TeamMove, i).dest_idcs,

View File

@ -86,6 +86,10 @@ string_token_form _FORMATION_
string_token_bool_cup _CUP_
string_token_bool_cup_knockout _CUPKO_
string_token_cup_stage _CUPSTAGE_
string_token_cup_national _CUPNATIONAL_
string_token_cup_international _CUPINTERNATIONAL_
string_token_cup_promrel _CUPPROMREL_
string_token_cup_aux _CUPAUX_
string_token_cup_match_winner _CUPMATCHWINNER_
string_token_bool_multiple_scorers0 _MULTIPLESCORERS0_
string_token_bool_multiple_scorers1 _MULTIPLESCORERS1_

View File

@ -24,5 +24,4 @@
<subtitle condition="_LEAGUEWON_TWN__ > 1">_TW_ wins _WON_TWN__th in a row in _LEAGUECUPNAME_.</subtitle>
<subtitle condition="_LEAGUELOST_TLN__ > 1">_TL_ loses _LOST_TLN__th in a row in _LEAGUECUPNAME_.</subtitle>
</news_article>
</news>