"Hide property for cups."

This commit is contained in:
gyboth 2005-05-25 17:58:04 +00:00
parent d6c770acd8
commit c99435c214
4 changed files with 22 additions and 5 deletions

View File

@ -168,11 +168,11 @@ cup_get_choose_team_league_cup(const CupChooseTeam *ct,
break;
}
for(i=0;i<acps->len;i++)
for(i=0;i<cps->len;i++)
{
if(strcmp(acp(i)->sid->str, ct->sid->str) == 0)
if(strcmp(cp(i).sid->str, ct->sid->str) == 0)
{
*cup = acp(i);
*cup = &cp(i);
*league = NULL;
break;
}
@ -250,7 +250,7 @@ cup_load_choose_team(Cup *cup, GPtrArray *teams, const CupChooseTeam *ct)
order[j] = j + start;
if(ct->randomly)
math_generate_permutation(order, start, start + end);
math_generate_permutation(order, start, start + end - 1);
for(j = 0; j < end; j++)
{

View File

@ -15,6 +15,7 @@
#define query_cup_is_national(clid) query_cup_has_property(clid, "national")
#define query_cup_is_supercup(clid) query_cup_has_property(clid, "supercup")
#define query_cup_is_promotion(clid) query_cup_has_property(clid, "promotion")
#define query_cup_hide(clid) query_cup_has_property(clid, "hide")
Cup
cup_new(gboolean new_id);

View File

@ -43,7 +43,7 @@ WeekFunc start_week_funcs[] =
start_week_update_user_teams, start_week_update_user_finances,
transfer_update, NULL};
WeekFunc end_week_funcs[] = {stat_update_leagues, NULL};
WeekFunc end_week_funcs[] = {stat_update_leagues, end_week_hide_cups, NULL};
/** Generate the teams etc. */
void
@ -367,6 +367,19 @@ end_week(void)
stat_show_av_league_goals();
}
/** Hide some not-so-important cups that
are already finished. */
void
end_week_hide_cups(void)
{
gint i;
for(i=acps->len - 1; i >= 0; i--)
if(query_cup_hide(acp(i)->id) &&
g_array_index(acp(i)->fixtures, Fixture, acp(i)->fixtures->len - 1).attendance > 0)
g_ptr_array_remove_index(acps, i);
}
/** Add the cups that begin later in the season to the acps array. */
void
start_week_add_cups(void)

View File

@ -63,4 +63,7 @@ end_season(void);
void
start_week_add_cups(void);
void
end_week_hide_cups(void);
#endif