1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2025-01-31 07:54:50 +01:00

Fixes; success counter.

This commit is contained in:
gyboth 2005-04-24 14:19:57 +00:00
parent 26e68c6c34
commit bd3f30c8b2
9 changed files with 73 additions and 15 deletions

View File

@ -77,6 +77,14 @@ callback_player_clicked(gint idx, GdkEventButton *event)
if(event->type != GDK_BUTTON_PRESS) if(event->type != GDK_BUTTON_PRESS)
return; return;
/*d*/
gint i;
for(i=0;i<ligs->len;i++)
printf("%d %s %d \n ", i, lig(i).name->str, lig(i).id);
printf("\n");
for(i=0;i<cps->len;i++)
printf("%d %s %d \n ", i, cp(i).name->str, cp(i).id);
if(event->button == 1) if(event->button == 1)
{ {
if(selected_row[0] == -1) if(selected_row[0] == -1)

View File

@ -196,7 +196,7 @@ cup_get_choose_team_league_cup(const CupChooseTeam *ct,
*league = &lig(idx - 1); *league = &lig(idx - 1);
*cup = NULL; *cup = NULL;
} }
else if(g_str_has_prefix(ct->sid->str, "cup")) else if(g_str_has_prefix(ct->sid->str, "cup") && strlen(ct->sid->str) < 6)
{ {
*cup = &cp(idx - 1); *cup = &cp(idx - 1);
*league = NULL; *league = NULL;

View File

@ -499,3 +499,16 @@ query_league_prom_games_begin(const League *league)
return TRUE; return TRUE;
} }
/** Find out whether there are/were league matches. */
gboolean
query_league_matches_in_week(const League *league, gint week_number)
{
gint i;
for(i=0;i<league->fixtures->len;i++)
if(g_array_index(league->fixtures, Fixture, i).week_number == week_number)
return TRUE;
return FALSE;
}

View File

@ -63,4 +63,7 @@ query_league_rank_in_prom_games(const League *league, gint rank);
gboolean gboolean
query_league_prom_games_begin(const League *league); query_league_prom_games_begin(const League *league);
gboolean
query_league_matches_in_week(const League *league, gint week_number);
#endif #endif

View File

@ -146,8 +146,6 @@ start_load_cup_teams(void)
for(i=0;i<cps->len;i++) for(i=0;i<cps->len;i++)
if(cp(i).type == CUP_TYPE_INTERNATIONAL) if(cp(i).type == CUP_TYPE_INTERNATIONAL)
{ {
printf("nam %s \n ", cp(i).name->str);
cup_load_choose_teams(&cp(i)); cup_load_choose_teams(&cp(i));
cup_load_choose_team_user(&cp(i)); cup_load_choose_team_user(&cp(i));
} }
@ -360,9 +358,6 @@ start_week(void)
(*start_func)(); (*start_func)();
start_func++; start_func++;
} }
/*d*/
printf("succ %d \n ", usr(0).counters[COUNT_USER_SUCCESS]);
} }
/** Age increase etc. of players. /** Age increase etc. of players.

View File

@ -259,16 +259,19 @@ user_weekly_update_counters(User *user)
MAX(cnts[COUNT_USER_STADIUM_SAFETY] - (gint)rint(increase_safety * 100), 0); MAX(cnts[COUNT_USER_STADIUM_SAFETY] - (gint)rint(increase_safety * 100), 0);
} }
if(rank < rank_bounds[0]) if(query_league_matches_in_week(league_from_clid(user->tm->clid), week))
user->counters[COUNT_USER_SUCCESS] += (rank_bounds[0] - rank);
else if(rank > rank_bounds[1])
user->counters[COUNT_USER_SUCCESS] -= (rank - rank_bounds[1]);
else
{ {
if(user->counters[COUNT_USER_SUCCESS] > 0) if(rank < rank_bounds[0])
user->counters[COUNT_USER_SUCCESS] -= const_int("int_user_success_mediocre_rank_change"); user->counters[COUNT_USER_SUCCESS] += (rank_bounds[0] - rank);
else if(rank > rank_bounds[1])
user->counters[COUNT_USER_SUCCESS] -= (rank - rank_bounds[1]);
else else
user->counters[COUNT_USER_SUCCESS] += const_int("int_user_success_mediocre_rank_change"); {
if(user->counters[COUNT_USER_SUCCESS] > 0)
user->counters[COUNT_USER_SUCCESS] -= const_int("int_user_success_mediocre_rank_change");
else
user->counters[COUNT_USER_SUCCESS] += const_int("int_user_success_mediocre_rank_change");
}
} }
} }

View File

@ -15,6 +15,7 @@ enum
TAG_CUP_TYPE, TAG_CUP_TYPE,
TAG_CUP_LAST_WEEK, TAG_CUP_LAST_WEEK,
TAG_CUP_SKILL_DIFF, TAG_CUP_SKILL_DIFF,
TAG_CUP_OVERALL_TEAMS,
TAG_CUP_CHOOSE_TEAM_USER, TAG_CUP_CHOOSE_TEAM_USER,
TAG_CUP_CHOOSE_TEAM, TAG_CUP_CHOOSE_TEAM,
TAG_CUP_CHOOSE_TEAM_SID, TAG_CUP_CHOOSE_TEAM_SID,
@ -100,6 +101,7 @@ xml_loadsave_cup_end_element (GMarkupParseContext *context,
tag == TAG_CUP_LAST_WEEK || tag == TAG_CUP_LAST_WEEK ||
tag == TAG_CUP_TYPE || tag == TAG_CUP_TYPE ||
tag == TAG_CUP_SKILL_DIFF || tag == TAG_CUP_SKILL_DIFF ||
tag == TAG_CUP_OVERALL_TEAMS ||
tag == TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK || tag == TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK ||
tag == TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK_ROUND || tag == TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK_ROUND ||
tag == TAG_CUP_USER_TEAM || tag == TAG_CUP_USER_TEAM ||
@ -183,6 +185,8 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
new_cup->last_week = int_value; new_cup->last_week = int_value;
else if(state == TAG_CUP_SKILL_DIFF) else if(state == TAG_CUP_SKILL_DIFF)
new_cup->skill_diff = int_value; new_cup->skill_diff = int_value;
else if(state == TAG_CUP_OVERALL_TEAMS)
new_cup->overall_teams = int_value;
else if(state == TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK) else if(state == TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK)
new_cup->next_fixture_update_week = int_value; new_cup->next_fixture_update_week = int_value;
else if(state == TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK_ROUND) else if(state == TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK_ROUND)
@ -283,6 +287,7 @@ xml_loadsave_cup_write(const gchar *prefix, const Cup *cup)
xml_write_int(fil, cup->week_gap, TAG_WEEK_GAP, I0); xml_write_int(fil, cup->week_gap, TAG_WEEK_GAP, I0);
xml_write_int(fil, cup->yellow_red, TAG_YELLOW_RED, I0); xml_write_int(fil, cup->yellow_red, TAG_YELLOW_RED, I0);
xml_write_int(fil, cup->skill_diff, TAG_CUP_SKILL_DIFF, I0); xml_write_int(fil, cup->skill_diff, TAG_CUP_SKILL_DIFF, I0);
xml_write_int(fil, cup->overall_teams, TAG_CUP_OVERALL_TEAMS, I0);
xml_write_int(fil, cup->next_fixture_update_week, xml_write_int(fil, cup->next_fixture_update_week,
TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK, I0); TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK, I0);

View File

@ -14,7 +14,7 @@
<cup>europe_uefa</cup> <cup>europe_uefa</cup>
</cups> </cups>
<supercups> <supercups>
<!-- <cup>supercup_league_vs_cup</cup> --> <cup>supercup_romania</cup>
<cup>supercup_europe_uefa</cup> <cup>supercup_europe_uefa</cup>
</supercups> </supercups>
</country> </country>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<cup>
<name>Supercupa României</name>
<short_name>SuperC_RO</short_name>
<sid>supercup_romania</sid>
<type>supercup</type>
<cup_rounds>
<cup_round>
<home_away>0</home_away>
<neutral>1</neutral>
</cup_round>
</cup_rounds>
<choose_teams>
<choose_team>
<choose_team_sid>cupa_romaniei</choose_team_sid>
<start_idx>1</start_idx>
<end_idx>1</end_idx>
</choose_team>
<choose_team>
<choose_team_sid>romania1</choose_team_sid>
<start_idx>1</start_idx>
<end_idx>2</end_idx>
</choose_team>
</choose_teams>
</cup>