mirror of
https://github.com/tstellar/bygfoot.git
synced 2025-01-29 06:59:37 +01:00
Cup structure changes.
This commit is contained in:
parent
eab7732e79
commit
745977466d
@ -11,7 +11,7 @@ bin_PROGRAMS = bygfoot
|
||||
bygfoot_SOURCES = \
|
||||
callback_func.c callback_func.h callbacks.h cup.h finance.h fixture.h game_gui.h league.h live_game.h maths.h misc.h option.h player.h start_end.h team.h transfer.h treeview.h user.h window.h \
|
||||
callbacks.c callbacks.h callback_func.h free.h game.h game_gui.h gui.h load_save.h main.h option.h player.h team.h transfer.h treeview.h treeview_helper.h user.h window.h \
|
||||
cup.c cup.h fixture.h free.h league.h main.h maths.h misc.h team.h variables.h xml_league.h \
|
||||
cup.c cup.h fixture.h free.h league.h main.h maths.h misc.h option.h team.h variables.h xml_league.h \
|
||||
file.c file.h free.h main.h misc.h option.h support.h variables.h \
|
||||
finance.c callbacks.h finance.h game_gui.h maths.h option.h player.h team.h user.h \
|
||||
fixture.c cup.h fixture.h free.h league.h main.h maths.h misc.h option.h user.h table.h team.h variables.h \
|
||||
@ -37,7 +37,7 @@ bygfoot_SOURCES = \
|
||||
options_callbacks.c file.h options_callbacks.h options_interface.h option_gui.h support.h user.h variables.h window.h \
|
||||
options_interface.c options_interface.h options_callbacks.h support.h \
|
||||
player.c cup.h fixture.h free.h game_gui.h league.h maths.h misc.h option.h player.h team.h user.h \
|
||||
start_end.c cup.h file.h finance.h fixture.h free.h game_gui.h gui.h league.h load_save.h live_game.h main.h maths.h option.h start_end.h stat.h table.h team.h transfer.h user.h variables.h xml_name.h \
|
||||
start_end.c cup.h file.h finance.h fixture.h free.h game_gui.h gui.h league.h load_save.h live_game.h main.h maths.h misc.h option.h start_end.h stat.h table.h team.h transfer.h user.h variables.h xml_name.h \
|
||||
stat.c cup.h free.h option.h player.h stat.h table_struct.h team.h variables.h \
|
||||
support.c support.h \
|
||||
table.c cup.h league.h table.h variables.h \
|
||||
@ -59,7 +59,7 @@ bygfoot_SOURCES = \
|
||||
xml_loadsave_teams.c file.h misc.h player.h team.h xml.h xml_loadsave_teams.h \
|
||||
xml_loadsave_transfers.c file.h misc.h team.h transfer.h xml.h xml_loadsave_transfers.h \
|
||||
xml_loadsave_users.c file.h misc.h team.h user.h variables.h xml.h xml_loadsave_users.h \
|
||||
xml_cup.c cup.h file.h main.h misc.h variables.h xml_cup.h \
|
||||
xml_cup.c cup.h file.h main.h misc.h option.h variables.h xml_cup.h \
|
||||
xml_country.c file.h free.h misc.h variables.h xml_cup.h xml_country.h xml_league.h \
|
||||
xml_league.c cup_struct.h file.h free.h league.h misc.h team.h table.h variables.h xml_league.h xml_cup.h \
|
||||
xml_name.c file.h free.h maths.h misc.h variables.h xml_name.h
|
||||
|
@ -36,8 +36,6 @@
|
||||
#define player_id_new (counters[COUNT_PLAYER_ID]++)
|
||||
#define team_id_new (counters[COUNT_TEAM_ID]++)
|
||||
#define cup_id_new (counters[COUNT_CUP_ID]++)
|
||||
#define prom_cup_id_new (counters[COUNT_PROM_CUP_ID]++)
|
||||
#define supercup_id_new (counters[COUNT_SUPERCUP_ID]++)
|
||||
#define league_id_new (counters[COUNT_LEAGUE_ID]++)
|
||||
|
||||
/** Convenience abbreviation. */
|
||||
@ -50,11 +48,6 @@
|
||||
/** Convenience abbreviation. */
|
||||
#define cp(i) g_array_index(country.cups, Cup, i)
|
||||
|
||||
/** Convenience abbreviation. */
|
||||
#define scps country.supercups
|
||||
/** Convenience abbreviation. */
|
||||
#define scp(i) g_array_index(country.supercups, Cup, i)
|
||||
|
||||
/** Convenience abbreviation. */
|
||||
#define acps country.allcups
|
||||
/** Convenience abbreviation. */
|
||||
@ -101,7 +94,7 @@ typedef struct
|
||||
*sid; /**< Id of the country, eg 'england'. */
|
||||
|
||||
/** Leagues and cups arrays. */
|
||||
GArray *leagues, *cups, *supercups;
|
||||
GArray *leagues, *cups;
|
||||
|
||||
/** Pointer array holding all cups. */
|
||||
GPtrArray *allcups;
|
||||
|
599
src/cup.c
599
src/cup.c
@ -5,6 +5,7 @@
|
||||
#include "main.h"
|
||||
#include "maths.h"
|
||||
#include "misc.h"
|
||||
#include "option.h"
|
||||
#include "table.h"
|
||||
#include "team.h"
|
||||
#include "variables.h"
|
||||
@ -26,7 +27,8 @@ cup_new(gboolean new_id)
|
||||
new.sid = g_string_new("");
|
||||
|
||||
new.id = (new_id) ? cup_id_new : -1;
|
||||
new.type = CUP_TYPE_NATIONAL;
|
||||
new.group = -1;
|
||||
new.add_week = 0;
|
||||
new.last_week = -1;
|
||||
new.week_gap = 1;
|
||||
new.yellow_red = 1000;
|
||||
@ -34,13 +36,14 @@ cup_new(gboolean new_id)
|
||||
new.overall_teams = -1;
|
||||
|
||||
new.choose_teams = g_array_new(FALSE, FALSE, sizeof(CupChooseTeam));
|
||||
new.choose_team_user = cup_choose_team_new();
|
||||
new.rounds = g_array_new(FALSE, FALSE, sizeof(CupRound));
|
||||
new.teams = g_array_new(FALSE, FALSE, sizeof(Team));
|
||||
new.user_teams = g_ptr_array_new();
|
||||
new.team_names = g_ptr_array_new();
|
||||
new.fixtures = g_array_new(FALSE, FALSE, sizeof(Fixture));
|
||||
new.bye = NULL;
|
||||
|
||||
new.properties = g_ptr_array_new();
|
||||
|
||||
new.next_fixture_update_week = -1;
|
||||
new.next_fixture_update_week_round = -1;
|
||||
|
||||
@ -57,6 +60,7 @@ cup_choose_team_new(void)
|
||||
new.number_of_teams = -1;
|
||||
new.start_idx = new.end_idx = -1;
|
||||
new.randomly = FALSE;
|
||||
new.generate = FALSE;
|
||||
|
||||
return new;
|
||||
}
|
||||
@ -78,6 +82,33 @@ cup_round_new(void)
|
||||
return new;
|
||||
}
|
||||
|
||||
/** Reset some arrays at the beginning of a new season. */
|
||||
void
|
||||
cup_reset(Cup *cup)
|
||||
{
|
||||
gint i, j;
|
||||
|
||||
if(cup->teams->len > 0)
|
||||
free_teams_array(&cup->teams, TRUE);
|
||||
|
||||
g_ptr_array_free(cup->team_names, TRUE);
|
||||
cup->team_names = g_ptr_array_new();
|
||||
|
||||
g_array_free(cup->fixtures, TRUE);
|
||||
cup->fixtures = g_array_new(FALSE, FALSE, sizeof(Fixture));
|
||||
|
||||
free_g_ptr_array(&cup->bye);
|
||||
|
||||
for(i=0;i<cup->rounds->len;i++)
|
||||
{
|
||||
for(j=0;j<g_array_index(cup->rounds, CupRound, i).tables->len;j++)
|
||||
free_table(&g_array_index(g_array_index(cup->rounds, CupRound, i).tables, Table, j));
|
||||
|
||||
g_array_free(g_array_index(cup->rounds, CupRound, i).tables, TRUE);
|
||||
g_array_index(cup->rounds, CupRound, i).tables = g_array_new(FALSE, FALSE, sizeof(Table));
|
||||
}
|
||||
}
|
||||
|
||||
/** Find out whether a choose_team definition refers to a
|
||||
league in the country. If so, no teams get loaded for that
|
||||
choose_team. */
|
||||
@ -93,94 +124,6 @@ query_cup_choose_team_is_league(const gchar *sid)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/** Fill the teams array of a cup with teams according to the choose_teams of
|
||||
the cup. Only called for international cups.
|
||||
@param cup The pointer to the cup. */
|
||||
void
|
||||
cup_load_choose_teams(Cup *cup)
|
||||
{
|
||||
gint i, j, k, number_of_teams, end_idx = -1;
|
||||
CupChooseTeam *choose_team = NULL;
|
||||
GArray *teams = NULL;
|
||||
GArray *leagues = NULL;
|
||||
GPtrArray *sids = NULL;
|
||||
|
||||
for(i=0;i<cup->choose_teams->len;i++)
|
||||
{
|
||||
choose_team = &g_array_index(cup->choose_teams, CupChooseTeam, i);
|
||||
leagues = g_array_new(FALSE, FALSE, sizeof(League));
|
||||
teams = g_array_new(FALSE, FALSE, sizeof(Team));
|
||||
sids = misc_separate_strings(choose_team->sid->str);
|
||||
|
||||
for(j=0;j<sids->len;j++)
|
||||
{
|
||||
if(!query_cup_choose_team_is_league(((GString*)g_ptr_array_index(sids, j))->str))
|
||||
{
|
||||
xml_league_read(((GString*)g_ptr_array_index(sids, j))->str, leagues);
|
||||
|
||||
for(k=0; k < g_array_index(leagues, League, leagues->len - 1).teams->len; k++)
|
||||
g_array_append_val(teams, g_array_index(
|
||||
g_array_index(leagues, League, leagues->len - 1).teams, Team, k));
|
||||
|
||||
g_array_free(g_array_index(leagues, League, leagues->len - 1).teams, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
g_array_free(leagues, TRUE);
|
||||
|
||||
gint permutation[teams->len];
|
||||
for(j=0;j<teams->len;j++)
|
||||
permutation[j] = j;
|
||||
|
||||
if(choose_team->randomly && teams->len > 0)
|
||||
{
|
||||
if(choose_team->start_idx == -1)
|
||||
math_generate_permutation(permutation, 0, teams->len - 1);
|
||||
else
|
||||
math_generate_permutation(permutation,
|
||||
choose_team->start_idx - 1,
|
||||
choose_team->end_idx - 1);
|
||||
}
|
||||
|
||||
number_of_teams = 0;
|
||||
if(choose_team->start_idx == -1)
|
||||
end_idx = teams->len;
|
||||
else
|
||||
end_idx = choose_team->end_idx -
|
||||
choose_team->start_idx + 1;
|
||||
|
||||
if(teams->len < end_idx)
|
||||
cup_choose_team_abort(cup, choose_team, FALSE);
|
||||
|
||||
for(j = 0; j < end_idx; j++)
|
||||
{
|
||||
if(!query_is_in_international_cups(&g_array_index(teams, Team, permutation[j])))
|
||||
{
|
||||
g_array_append_val(cup->teams, g_array_index(teams, Team, permutation[j]));
|
||||
g_array_index(cup->teams, Team, cup->teams->len - 1).clid = cup->id;
|
||||
|
||||
number_of_teams++;
|
||||
}
|
||||
|
||||
if(number_of_teams == choose_team->number_of_teams)
|
||||
break;
|
||||
}
|
||||
|
||||
if(number_of_teams != choose_team->number_of_teams && teams->len > 0)
|
||||
cup_choose_team_abort(cup, choose_team, FALSE);
|
||||
|
||||
for(j=teams->len - 1; j>=0;j--)
|
||||
if(query_is_in_international_cups(&g_array_index(teams, Team, j)))
|
||||
g_array_remove_index(teams, j);
|
||||
|
||||
free_g_string_array(&sids);
|
||||
free_teams_array(&teams, FALSE);
|
||||
}
|
||||
|
||||
for(i=0;i<cup->teams->len;i++)
|
||||
team_generate_players_stadium(&g_array_index(cup->teams, Team, i));
|
||||
}
|
||||
|
||||
/** Write the cup or league of the chooseteam into the appropriate pointer. */
|
||||
void
|
||||
cup_get_choose_team_league_cup(const CupChooseTeam *ct,
|
||||
@ -189,6 +132,9 @@ cup_get_choose_team_league_cup(const CupChooseTeam *ct,
|
||||
gint i, idx;
|
||||
gchar trash[SMALL];
|
||||
|
||||
*league = NULL;
|
||||
*cup = NULL;
|
||||
|
||||
sscanf(ct->sid->str, "%[^0-9]%d", trash, &idx);
|
||||
|
||||
if(g_str_has_prefix(ct->sid->str, "league"))
|
||||
@ -212,86 +158,150 @@ cup_get_choose_team_league_cup(const CupChooseTeam *ct,
|
||||
}
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
{
|
||||
if(strcmp(acp(i)->sid->str, ct->sid->str) == 0)
|
||||
{
|
||||
*cup = &cp(i);
|
||||
*league = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the team pointers for the supercup. */
|
||||
/** Return the pointers to the teams participating in the
|
||||
cup. If necessary, teams are generated and stored in the teams
|
||||
array of the cup. */
|
||||
GPtrArray*
|
||||
cup_get_choose_teams_pointers(Cup *cup)
|
||||
cup_get_team_pointers(Cup *cup)
|
||||
{
|
||||
gint i;
|
||||
GPtrArray *teams = g_ptr_array_new();
|
||||
|
||||
if(debug > 60)
|
||||
printf("cup_get_team_pointers %s \n", cup->name->str);
|
||||
|
||||
for(i=0;i<cup->choose_teams->len;i++)
|
||||
if(g_array_index(cup->choose_teams, CupChooseTeam, i).generate)
|
||||
cup_load_choose_team_generate(cup,
|
||||
&g_array_index(cup->choose_teams, CupChooseTeam, i));
|
||||
else
|
||||
cup_load_choose_team(cup, teams,
|
||||
&g_array_index(cup->choose_teams, CupChooseTeam, i));
|
||||
|
||||
for(i=0;i<cup->teams->len;i++)
|
||||
{
|
||||
team_generate_players_stadium(&g_array_index(cup->teams, Team, i));
|
||||
if(teams->len < cup->overall_teams)
|
||||
g_ptr_array_add(teams, &g_array_index(cup->teams, Team, i));
|
||||
}
|
||||
|
||||
return teams;
|
||||
}
|
||||
|
||||
/** Get the pointers to the teams (already generated, in one of the leagues or cups)
|
||||
specified in the chooseteam. Add them to the 'teams' pointer array. */
|
||||
void
|
||||
cup_load_choose_team(Cup *cup, GPtrArray *teams, const CupChooseTeam *ct)
|
||||
{
|
||||
gint i, j, start, end;
|
||||
gint number_of_teams = 0;
|
||||
CupChooseTeam *ct = NULL;
|
||||
GArray *team_ids = g_array_new(FALSE, FALSE, sizeof(gint));
|
||||
GPtrArray *cup_teams_sorted = NULL;
|
||||
GPtrArray *teams = g_ptr_array_new();
|
||||
League *league = NULL;
|
||||
Cup *cup_temp = NULL;
|
||||
|
||||
free_g_ptr_array(&cup->user_teams);
|
||||
cup->user_teams = g_ptr_array_new();
|
||||
if(debug > 60)
|
||||
printf("cup_load_choose_team: %s, %s \n", cup->name->str,
|
||||
ct->sid->str);
|
||||
|
||||
for(i=0;i<cup->choose_teams->len;i++)
|
||||
{
|
||||
number_of_teams = 0;
|
||||
cup_get_choose_team_league_cup(ct, &league, &cup_temp);
|
||||
|
||||
ct = &g_array_index(cup->choose_teams, CupChooseTeam, i);
|
||||
cup_get_choose_team_league_cup(ct, &league, &cup_temp);
|
||||
|
||||
if(cup_temp == NULL)
|
||||
{
|
||||
if(ct->number_of_teams == -1 && cup->type != CUP_TYPE_SUPERCUP)
|
||||
{
|
||||
start = 0;
|
||||
end = league->teams->len;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = ct->start_idx - 1;
|
||||
end = ct->end_idx - start;
|
||||
}
|
||||
if(cup_temp == NULL)
|
||||
{
|
||||
if(ct->number_of_teams == -1)
|
||||
for(j=0;j<league->teams->len;j++)
|
||||
g_ptr_array_add(teams, &g_array_index(league->teams, Team, j));
|
||||
else
|
||||
{
|
||||
start = ct->start_idx - 1;
|
||||
end = ct->end_idx - start;
|
||||
|
||||
gint order[end];
|
||||
for(j=0;j<end;j++)
|
||||
order[j] = j + start;
|
||||
|
||||
|
||||
if(ct->randomly)
|
||||
math_generate_permutation(order, start, start + end);
|
||||
|
||||
for(j = 0;j < end; j++)
|
||||
for(j = 0; j < end; j++)
|
||||
{
|
||||
if(!query_misc_integer_is_in_g_array(
|
||||
g_array_index(league->table.elements, TableElement, order[j]).team_id,
|
||||
team_ids))
|
||||
if(!query_team_is_in_international_cups(
|
||||
team_of_id(g_array_index(league->table.elements, TableElement, order[j]).team_id), cup->group))
|
||||
{
|
||||
g_ptr_array_add(teams, g_array_index(league->table.elements,
|
||||
TableElement, order[j]).team);
|
||||
g_array_append_val(team_ids, g_array_index(
|
||||
league->table.elements, TableElement, order[j]).team_id);
|
||||
g_ptr_array_add(teams,
|
||||
team_of_id(g_array_index(league->table.elements, TableElement, order[j]).team_id));
|
||||
g_ptr_array_add(cup->team_names,
|
||||
team_of_id(g_array_index(league->table.elements, TableElement, order[j]).team_id)->name);
|
||||
number_of_teams++;
|
||||
|
||||
if(number_of_teams == ct->number_of_teams ||
|
||||
(cup->type == CUP_TYPE_SUPERCUP && teams->len == 2))
|
||||
if(number_of_teams == ct->number_of_teams)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ct->number_of_teams != -1 &&
|
||||
number_of_teams != ct->number_of_teams)
|
||||
g_warning("cup_load_choose_teams_pointers: didn't find enough teams in cup %s for chooseteam %s\n",
|
||||
cup->name->str, ct->sid->str);
|
||||
if(ct->number_of_teams != -1 &&
|
||||
number_of_teams != ct->number_of_teams)
|
||||
{
|
||||
g_warning("cup_load_choose_team (+): not enough teams (that don't participate in international cups yet) found in chooseteam %s for cup %s (%d specified, %d found) cup group %d.\n ",
|
||||
ct->sid->str, cup->name->str, ct->number_of_teams, number_of_teams, cup->group);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(season == 1 && cup->add_week == 0)
|
||||
{
|
||||
if(lig(0).teams->len < ct->number_of_teams)
|
||||
{
|
||||
g_warning("cup_load_choose_team: not enough teams in league 0 for chooseteam %s (%d; required: %d) in cup %s\n",
|
||||
ct->sid->str, lig(0).teams->len, ct->number_of_teams, cup->name->str);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
|
||||
gint permutation[lig(0).teams->len];
|
||||
math_generate_permutation(permutation, 0, lig(0).teams->len - 1);
|
||||
|
||||
for(i = ct->start_idx - 1; i <= ct->end_idx - 1; i++)
|
||||
{
|
||||
if(!query_team_is_in_international_cups(
|
||||
&g_array_index(lig(0).teams,
|
||||
Team, permutation[i - ct->start_idx + 1]), cup->group))
|
||||
{
|
||||
g_ptr_array_add(teams, &g_array_index(lig(0).teams,
|
||||
Team, permutation[i - ct->start_idx + 1]));
|
||||
g_ptr_array_add(cup->team_names,
|
||||
g_array_index(lig(0).teams,
|
||||
Team, permutation[i - ct->start_idx + 1]).name);
|
||||
number_of_teams++;
|
||||
}
|
||||
|
||||
if(number_of_teams == ct->number_of_teams)
|
||||
break;
|
||||
}
|
||||
|
||||
if(number_of_teams != ct->number_of_teams)
|
||||
{
|
||||
g_warning("cup_load_choose_team: not enough teams found in league 0 for chooseteam %s (%d; required: %d) in cup %s (group %d)\n",
|
||||
ct->sid->str, number_of_teams, ct->number_of_teams, cup->name->str, cup->group);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cup_teams_sorted = cup_get_teams_sorted(cup_temp);
|
||||
|
||||
if(ct->number_of_teams == -1 && cup->type != CUP_TYPE_SUPERCUP)
|
||||
if(ct->number_of_teams == -1)
|
||||
{
|
||||
start = 0;
|
||||
end = cup_teams_sorted->len;
|
||||
@ -304,135 +314,123 @@ cup_get_choose_teams_pointers(Cup *cup)
|
||||
|
||||
for(j = start; j < end; j++)
|
||||
{
|
||||
if(!query_misc_integer_is_in_g_array(
|
||||
((Team*)g_ptr_array_index(cup_teams_sorted, j))->id, team_ids))
|
||||
if(!query_team_is_in_international_cups(
|
||||
(Team*)g_ptr_array_index(cup_teams_sorted, j), cup->group))
|
||||
{
|
||||
g_ptr_array_add(teams, g_ptr_array_index(cup_teams_sorted, j));
|
||||
g_array_append_val(team_ids, ((Team*)g_ptr_array_index(cup_teams_sorted, j))->id);
|
||||
g_ptr_array_add(cup->team_names, ((Team*)g_ptr_array_index(cup_teams_sorted, j))->name);
|
||||
number_of_teams++;
|
||||
|
||||
if(number_of_teams == ct->number_of_teams ||
|
||||
(cup->type == CUP_TYPE_SUPERCUP && teams->len == 2))
|
||||
if(number_of_teams == ct->number_of_teams)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
g_ptr_array_free(cup_teams_sorted, TRUE);
|
||||
|
||||
if(ct->number_of_teams != -1 &&
|
||||
number_of_teams != ct->number_of_teams)
|
||||
g_warning("cup_load_choose_teams_pointers: didn't find enough teams in cup %s for chooseteam %s\n",
|
||||
cup->name->str, ct->sid->str);
|
||||
{
|
||||
g_warning("cup_load_choose_team(*): not enough teams (that don't participate in international cups yet) found in chooseteam %s for cup %s (%d specified, %d found) cup group %d.\n ",
|
||||
ct->sid->str, cup->name->str, ct->number_of_teams, number_of_teams, cup->group);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_array_free(team_ids, TRUE);
|
||||
|
||||
return teams;
|
||||
}
|
||||
|
||||
/** Add the teams specified by the choose_team_user rule to the teams
|
||||
array of the cup.
|
||||
@param cup The pointer to the cup. */
|
||||
/** Load the teams specified in the chooseteam from a non-country league. */
|
||||
void
|
||||
cup_load_choose_team_user(Cup *cup)
|
||||
cup_load_choose_team_generate(Cup *cup, const CupChooseTeam *ct)
|
||||
{
|
||||
gint i;
|
||||
gchar type[SMALL];
|
||||
gint number, number_of_teams = 0;
|
||||
CupChooseTeam *ct = &cup->choose_team_user;
|
||||
GPtrArray *user_teams_sorted = NULL;
|
||||
Team *table_team = NULL;
|
||||
gint j, k;
|
||||
gint number_of_teams, end_idx = -1;
|
||||
GArray *teams_local = NULL;
|
||||
GArray *leagues = NULL;
|
||||
GPtrArray *sids = NULL;
|
||||
|
||||
g_ptr_array_free(cup->user_teams, TRUE);
|
||||
cup->user_teams = g_ptr_array_new();
|
||||
if(debug > 60)
|
||||
printf("cup_load_choose_team_generate: %s, %s \n", cup->name->str,
|
||||
ct->sid->str);
|
||||
|
||||
sscanf(ct->sid->str, "%[^0-9]%d", type, &number);
|
||||
leagues = g_array_new(FALSE, FALSE, sizeof(League));
|
||||
teams_local = g_array_new(FALSE, FALSE, sizeof(Team));
|
||||
sids = misc_separate_strings(ct->sid->str);
|
||||
|
||||
if(strcmp(type, "league") != 0 &&
|
||||
strcmp(type, "cup") != 0)
|
||||
cup_choose_team_abort(cup, ct, TRUE);
|
||||
for(j=0;j<sids->len;j++)
|
||||
{
|
||||
if(!query_cup_choose_team_is_league(((GString*)g_ptr_array_index(sids, j))->str))
|
||||
{
|
||||
xml_league_read(((GString*)g_ptr_array_index(sids, j))->str, leagues);
|
||||
|
||||
for(k=0; k < g_array_index(leagues, League, leagues->len - 1).teams->len; k++)
|
||||
g_array_append_val(teams_local, g_array_index(
|
||||
g_array_index(leagues, League, leagues->len - 1).teams, Team, k));
|
||||
|
||||
free_g_array(&g_array_index(leagues, League, leagues->len - 1).teams);
|
||||
free_league(&g_array_index(leagues, League, leagues->len - 1));
|
||||
}
|
||||
}
|
||||
|
||||
g_array_free(leagues, TRUE);
|
||||
|
||||
gint permutation[teams_local->len];
|
||||
for(j=0;j<teams_local->len;j++)
|
||||
permutation[j] = j;
|
||||
|
||||
if(ct->randomly && teams_local->len > 0)
|
||||
{
|
||||
if(ct->start_idx == -1)
|
||||
math_generate_permutation(permutation, 0, teams_local->len - 1);
|
||||
else
|
||||
math_generate_permutation(permutation, ct->start_idx - 1, ct->end_idx - 1);
|
||||
}
|
||||
|
||||
number_of_teams = 0;
|
||||
if(ct->start_idx == -1)
|
||||
end_idx = teams_local->len;
|
||||
else
|
||||
end_idx = ct->end_idx -
|
||||
ct->start_idx + 1;
|
||||
|
||||
if(teams_local->len < end_idx)
|
||||
{
|
||||
g_warning("cup_load_choose_team_generate: not enough teams (%d) in chooseteam %s in cup %s (%d are specified) \n",
|
||||
teams_local->len, ct->sid->str, cup->name->str, end_idx);
|
||||
|
||||
/** Teams from a league. */
|
||||
if(strcmp(type, "league") == 0)
|
||||
{
|
||||
if(ligs->len < number ||
|
||||
lig(number - 1).teams->len < ct->end_idx)
|
||||
cup_choose_team_abort(cup, ct, TRUE);
|
||||
|
||||
for(i = ct->start_idx - 1; i <= ct->end_idx - 1; i++)
|
||||
{
|
||||
table_team = team_of_id(
|
||||
g_array_index(lig(number - 1).table.elements, TableElement, i).team_id);
|
||||
|
||||
if(!query_is_in_international_cups(table_team))
|
||||
{
|
||||
g_ptr_array_add(cup->user_teams, table_team);
|
||||
number_of_teams++;
|
||||
}
|
||||
|
||||
if(number_of_teams == ct->number_of_teams)
|
||||
break;
|
||||
}
|
||||
|
||||
if(number_of_teams != ct->number_of_teams)
|
||||
cup_choose_team_abort(cup, ct, TRUE);
|
||||
|
||||
return;
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
|
||||
/** Teams from a cup; special case: in the first season,
|
||||
we load random teams from the first league. */
|
||||
if(season == 1)
|
||||
for(j = 0; j < end_idx; j++)
|
||||
{
|
||||
if(lig(0).teams->len < ct->number_of_teams)
|
||||
cup_choose_team_abort(cup, ct, TRUE);
|
||||
|
||||
gint permutation[lig(0).teams->len];
|
||||
math_generate_permutation(permutation, 0, lig(0).teams->len - 1);
|
||||
|
||||
for(i = ct->start_idx - 1; i <= ct->end_idx - 1; i++)
|
||||
if(!query_team_is_in_international_cups(&g_array_index(teams_local, Team, permutation[j]), cup->group))
|
||||
{
|
||||
if(!query_is_in_international_cups(
|
||||
&g_array_index(lig(number - 1).teams,
|
||||
Team, permutation[i - ct->start_idx + 1])))
|
||||
{
|
||||
g_ptr_array_add(cup->user_teams,
|
||||
(gpointer)&g_array_index(lig(number - 1).teams,
|
||||
Team, permutation[i - ct->start_idx + 1]));
|
||||
number_of_teams++;
|
||||
}
|
||||
|
||||
if(number_of_teams == ct->number_of_teams)
|
||||
break;
|
||||
}
|
||||
|
||||
if(number_of_teams != ct->number_of_teams)
|
||||
cup_choose_team_abort(cup, ct, TRUE);
|
||||
g_array_append_val(cup->teams, g_array_index(teams_local, Team, permutation[j]));
|
||||
g_array_index(cup->teams, Team, cup->teams->len - 1).clid = cup->id;
|
||||
g_ptr_array_add(cup->team_names,
|
||||
g_array_index(cup->teams, Team, cup->teams->len - 1).name);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** Teams from a cup: normal case. We sort the teams that
|
||||
participated in the cup. */
|
||||
user_teams_sorted = cup_get_teams_sorted(&cp(number - 1));
|
||||
|
||||
for(i = ct->start_idx - 1; i <= ct->end_idx - 1; i++)
|
||||
{
|
||||
if(!query_is_in_international_cups((Team*)g_ptr_array_index(user_teams_sorted, i)))
|
||||
{
|
||||
g_ptr_array_add(cup->user_teams, g_ptr_array_index(user_teams_sorted, i));
|
||||
number_of_teams++;
|
||||
}
|
||||
|
||||
|
||||
if(number_of_teams == ct->number_of_teams)
|
||||
break;
|
||||
}
|
||||
|
||||
if(number_of_teams != ct->number_of_teams)
|
||||
cup_choose_team_abort(cup, ct, TRUE);
|
||||
|
||||
if(((ct->number_of_teams != -1 && number_of_teams != ct->number_of_teams) ||
|
||||
(ct->number_of_teams == -1 && number_of_teams != teams_local->len)) &&
|
||||
teams_local->len > 0)
|
||||
{
|
||||
g_warning("cup_load_choose_team_generate: not enough teams (that don't participate in international cups yet) found in chooseteam %s for cup %s (%d specified, %d found).\n ", ct->sid->str, cup->name->str, ct->number_of_teams, number_of_teams);
|
||||
main_exit_program(EXIT_CHOOSE_TEAM_ERROR, NULL);
|
||||
}
|
||||
|
||||
g_ptr_array_free(user_teams_sorted, TRUE);
|
||||
for(j=teams_local->len - 1; j>=0;j--)
|
||||
if(query_team_is_in_international_cups(&g_array_index(teams_local, Team, j), cup->group))
|
||||
g_array_remove_index(teams_local, j);
|
||||
|
||||
free_g_string_array(&sids);
|
||||
free_teams_array(&teams_local, FALSE);
|
||||
}
|
||||
|
||||
/** Return a pointer array of teams ordered corresponding to
|
||||
@ -655,24 +653,6 @@ cup_round_get_number_of_teams(const Cup *cup, gint cup_round)
|
||||
return number_of_teams;
|
||||
}
|
||||
|
||||
/** Return the teams participating in the cup as a pointer array.
|
||||
@param cup The cup pointer.
|
||||
@return An array of team pointers. */
|
||||
GPtrArray*
|
||||
cup_get_team_pointers(const Cup *cup)
|
||||
{
|
||||
gint i;
|
||||
GPtrArray *teams = team_get_pointers_from_array(cup->teams);
|
||||
|
||||
while(teams->len + cup->user_teams->len > cup->overall_teams)
|
||||
g_ptr_array_remove_index(teams, math_rndi(0, teams->len - 1));
|
||||
|
||||
for(i=0;i<cup->user_teams->len;i++)
|
||||
g_ptr_array_add(teams, g_ptr_array_index(cup->user_teams, i));
|
||||
|
||||
return teams;
|
||||
}
|
||||
|
||||
/** Return the cup pointer belonging to the id.
|
||||
@param clid The id we look for.
|
||||
@return The cup pointer or NULL if failed. */
|
||||
@ -681,28 +661,30 @@ cup_from_clid(gint clid)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
if(acp(i)->id == clid)
|
||||
return acp(i);
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(cp(i).id == clid)
|
||||
return &cp(i);
|
||||
|
||||
for(i=0;i<scps->len;i++)
|
||||
if(scp(i).id == clid)
|
||||
return &scp(i);
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
if(league_has_prom_games((&lig(i))) &&
|
||||
lig(i).prom_rel.prom_games_cup.id == clid)
|
||||
return &lig(i).prom_rel.prom_games_cup;
|
||||
|
||||
g_warning("cup_from_clid: didn't find cup with id %d\n", clid);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Find the cup with the given sid. */
|
||||
Cup*
|
||||
cup_from_sid(const gchar *sid)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(strcmp(cp(i).sid->str, sid) == 0)
|
||||
return &cp(i);
|
||||
|
||||
g_warning("cup_from_sid: didn't find cup with sid %s \n", sid);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Return the name of a cup round, e.g. 'round robin'
|
||||
or 'final' or so.
|
||||
@param fix A fixture belonging to the round.
|
||||
@ -758,55 +740,6 @@ cup_get_round_name(const Cup *cup, gint round, gchar *buf)
|
||||
}
|
||||
|
||||
|
||||
/** Find out whether it's time to write the
|
||||
fixtures for the supercup. */
|
||||
gboolean
|
||||
query_cup_supercup_begins(const Cup *supercup)
|
||||
{
|
||||
gint i;
|
||||
League *league = NULL;
|
||||
Cup *cup = NULL;
|
||||
gboolean proceed = FALSE;
|
||||
|
||||
for(i=0;i<supercup->choose_teams->len;i++)
|
||||
{
|
||||
cup_get_choose_team_league_cup(
|
||||
&g_array_index(supercup->choose_teams,
|
||||
CupChooseTeam, i), &league, &cup);
|
||||
|
||||
if((cup == NULL &&
|
||||
g_array_index(league->fixtures, Fixture,
|
||||
league->fixtures->len - 1).week_number == week &&
|
||||
g_array_index(league->fixtures, Fixture,
|
||||
league->fixtures->len - 1).week_round_number == week_round) ||
|
||||
(league == NULL &&
|
||||
g_array_index(cup->fixtures, Fixture,
|
||||
cup->fixtures->len - 1).week_number == week &&
|
||||
g_array_index(cup->fixtures, Fixture,
|
||||
cup->fixtures->len - 1).week_round_number == week_round))
|
||||
proceed = TRUE;
|
||||
}
|
||||
|
||||
if(!proceed)
|
||||
return FALSE;
|
||||
|
||||
for(i=0;i<supercup->choose_teams->len;i++)
|
||||
{
|
||||
cup_get_choose_team_league_cup(
|
||||
&g_array_index(supercup->choose_teams,
|
||||
CupChooseTeam, i), &league, &cup);
|
||||
if((cup == NULL &&
|
||||
g_array_index(league->fixtures, Fixture,
|
||||
league->fixtures->len - 1).attendance == -1) ||
|
||||
(league == NULL &&
|
||||
g_array_index(cup->fixtures, Fixture,
|
||||
cup->fixtures->len - 1).attendance == -1))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Find out whether the cup contains tables
|
||||
that can be displayed. Returns -1 if false
|
||||
and the number of the cup round with tables
|
||||
@ -835,3 +768,51 @@ cup_get_winner(const Cup *cup)
|
||||
|
||||
return tm;
|
||||
}
|
||||
|
||||
/** Find out whether a cup with add_week 1000 should begin now. */
|
||||
gboolean
|
||||
query_cup_begins(const Cup *cup)
|
||||
{
|
||||
gint i;
|
||||
League *league = NULL;
|
||||
Cup *cup_temp = NULL;
|
||||
gboolean proceed = FALSE;
|
||||
|
||||
for(i=0;i<cup->choose_teams->len;i++)
|
||||
{
|
||||
cup_get_choose_team_league_cup(
|
||||
&g_array_index(cup->choose_teams,
|
||||
CupChooseTeam, i), &league, &cup_temp);
|
||||
|
||||
if((cup_temp == NULL &&
|
||||
g_array_index(league->fixtures, Fixture,
|
||||
league->fixtures->len - 1).week_number == week &&
|
||||
g_array_index(league->fixtures, Fixture,
|
||||
league->fixtures->len - 1).week_round_number == week_round) ||
|
||||
(league == NULL &&
|
||||
g_array_index(cup_temp->fixtures, Fixture,
|
||||
cup_temp->fixtures->len - 1).week_number == week &&
|
||||
g_array_index(cup_temp->fixtures, Fixture,
|
||||
cup_temp->fixtures->len - 1).week_round_number == week_round))
|
||||
proceed = TRUE;
|
||||
}
|
||||
|
||||
if(!proceed)
|
||||
return FALSE;
|
||||
|
||||
for(i=0;i<cup->choose_teams->len;i++)
|
||||
{
|
||||
cup_get_choose_team_league_cup(
|
||||
&g_array_index(cup->choose_teams,
|
||||
CupChooseTeam, i), &league, &cup_temp);
|
||||
if((cup_temp == NULL &&
|
||||
g_array_index(league->fixtures, Fixture,
|
||||
league->fixtures->len - 1).attendance == -1) ||
|
||||
(league == NULL &&
|
||||
g_array_index(cup_temp->fixtures, Fixture,
|
||||
cup_temp->fixtures->len - 1).attendance == -1))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
29
src/cup.h
29
src/cup.h
@ -6,10 +6,16 @@
|
||||
#include "fixture_struct.h"
|
||||
#include "league_struct.h"
|
||||
|
||||
#define query_cup_is_prom(clid) (clid >= ID_PROM_CUP_START && clid < ID_SUPERCUP_START)
|
||||
#define cup_get_last_tables_round(clid) &g_array_index(cup_from_clid(clid)->rounds, CupRound, cup_has_tables(clid))
|
||||
#define cup_get_last_tables(clid) g_array_index(cup_from_clid(clid)->rounds, CupRound, cup_has_tables(clid)).tables
|
||||
|
||||
#define query_cup_has_property(clid, string) query_misc_string_in_array(string, cup_from_clid(clid)->properties)
|
||||
|
||||
#define query_cup_is_international(clid) query_cup_has_property(clid, "international")
|
||||
#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")
|
||||
|
||||
Cup
|
||||
cup_new(gboolean new_id);
|
||||
|
||||
@ -20,16 +26,16 @@ CupRound
|
||||
cup_round_new(void);
|
||||
|
||||
void
|
||||
cup_load_choose_teams(Cup *cup);
|
||||
|
||||
void
|
||||
cup_load_choose_team_user(Cup *cup);
|
||||
|
||||
void
|
||||
cup_choose_team_abort(const Cup *cup, const CupChooseTeam *choose_team, gboolean user);
|
||||
cup_reset(Cup *cup);
|
||||
|
||||
GPtrArray*
|
||||
cup_get_team_pointers(const Cup *cup);
|
||||
cup_get_team_pointers(Cup *cup);
|
||||
|
||||
void
|
||||
cup_load_choose_team_generate(Cup *cup, const CupChooseTeam *ct);
|
||||
|
||||
void
|
||||
cup_load_choose_team(Cup *cup, GPtrArray *teams, const CupChooseTeam *ct);
|
||||
|
||||
gint
|
||||
cup_get_first_week_of_cup_round(const Cup *cup, gint cup_round);
|
||||
@ -43,6 +49,9 @@ cup_round_get_number_of_teams(const Cup *cup, gint cup_round);
|
||||
Cup*
|
||||
cup_from_clid(gint clid);
|
||||
|
||||
Cup*
|
||||
cup_from_sid(const gchar* sid);
|
||||
|
||||
void
|
||||
cup_round_name(const Fixture *fix, gchar *buf);
|
||||
|
||||
@ -65,7 +74,7 @@ GPtrArray*
|
||||
cup_get_choose_teams_pointers(Cup *cup);
|
||||
|
||||
gboolean
|
||||
query_cup_supercup_begins(const Cup *supercup);
|
||||
query_cup_begins(const Cup *cup);
|
||||
|
||||
void
|
||||
cup_get_choose_team_league_cup(const CupChooseTeam *ct,
|
||||
|
@ -4,15 +4,6 @@
|
||||
#include "bygfoot.h"
|
||||
#include "table_struct.h"
|
||||
|
||||
/** Types for cups. */
|
||||
enum CupType
|
||||
{
|
||||
CUP_TYPE_NATIONAL = 0,
|
||||
CUP_TYPE_INTERNATIONAL,
|
||||
CUP_TYPE_SUPERCUP,
|
||||
CUP_TYPE_END
|
||||
};
|
||||
|
||||
/** Rules for a round of a cup.
|
||||
Cups consist of rounds, e.g. the final counts as
|
||||
a round or the round robin games. */
|
||||
@ -39,8 +30,7 @@ typedef struct
|
||||
Default: 0. */
|
||||
gint round_robin_number_of_best_advance;
|
||||
/** The round robin tables (in case there is a round robin). */
|
||||
GArray *tables;
|
||||
|
||||
GArray *tables;
|
||||
} CupRound;
|
||||
|
||||
/**
|
||||
@ -66,6 +56,10 @@ typedef struct
|
||||
ie. 3 random teams from the range 1-20.
|
||||
Default: FALSE. */
|
||||
gboolean randomly;
|
||||
/** Whether the team is generated and loaded from
|
||||
a league file or taken from one of the country's leagues
|
||||
or cups. Default: FALSE. */
|
||||
gboolean generate;
|
||||
} CupChooseTeam;
|
||||
|
||||
/** Structure representing a cup. */
|
||||
@ -77,13 +71,19 @@ typedef struct
|
||||
GString *name, *short_name, *symbol, *sid;
|
||||
/** Numerical id. */
|
||||
gint id;
|
||||
/** The cup type. Default: CUP_TYPE_NATIONAL.
|
||||
@see #CupType */
|
||||
gint type;
|
||||
/** An integer specifying which cups are mutually exclusive for
|
||||
league teams, e.g. the same team can't participate in the UEFA Cup and
|
||||
the Champions' League. */
|
||||
gint group;
|
||||
/** Last week (typically the week the final
|
||||
takes place) and weeks between matchdays.
|
||||
Default: -1 and 1. */
|
||||
gint last_week, week_gap;
|
||||
/** This determines when the cup gets added to the acps
|
||||
pointer array (and becomes visible for the user). Also determines
|
||||
when the cup fixtures for the first round get written.
|
||||
Default: 0 (ie. the cup is visible from the first week). */
|
||||
gint add_week;
|
||||
/** Number of yellow cards that lead to a missed match.
|
||||
Default: 1000 (off). */
|
||||
gint yellow_red;
|
||||
@ -99,14 +99,11 @@ typedef struct
|
||||
gint next_fixture_update_week;
|
||||
gint next_fixture_update_week_round;
|
||||
|
||||
/** A GString pointer array of properties (like "national"). */
|
||||
GPtrArray *properties;
|
||||
/** Array with rules how teams are chosen.
|
||||
@see #CupChooseTeam */
|
||||
GArray *choose_teams;
|
||||
/** The ChooseTeam rule according to which
|
||||
the participant from the user's league is chosen.
|
||||
This is irrelevant for national cups.
|
||||
@see #CupChooseTeam */
|
||||
CupChooseTeam choose_team_user;
|
||||
/** The rounds of the cup.
|
||||
@see #CupRound*/
|
||||
GArray *rounds;
|
||||
@ -115,8 +112,9 @@ typedef struct
|
||||
/** The teams belonging to the cup.
|
||||
Relevant only if it's an international one. */
|
||||
GArray *teams;
|
||||
/** Pointers to the teams from the leagues that participate. */
|
||||
GPtrArray *user_teams;
|
||||
/** Pointer array with the names of all the teams in the cup.
|
||||
Also the teams from the country's leagues. */
|
||||
GPtrArray *team_names;
|
||||
/** The fixtures of a season for the cup. */
|
||||
GArray *fixtures;
|
||||
} Cup;
|
||||
|
@ -9,8 +9,6 @@ enum Counters
|
||||
COUNT_TEAM_ID,
|
||||
COUNT_PLAYER_ID,
|
||||
COUNT_CUP_ID,
|
||||
COUNT_PROM_CUP_ID,
|
||||
COUNT_SUPERCUP_ID,
|
||||
COUNT_LEAGUE_ID,
|
||||
COUNT_END
|
||||
};
|
||||
|
@ -449,6 +449,7 @@ file_load_conf_files(void)
|
||||
g_free(conf_file);
|
||||
|
||||
file_load_opt_file(opt_str("string_opt_constants_file"), &constants);
|
||||
file_load_opt_file(opt_str("string_opt_appearance_file"), &constants_app);
|
||||
}
|
||||
|
||||
/** Load a user-specific conf file.
|
||||
|
@ -41,14 +41,17 @@ fixture_new(void)
|
||||
void
|
||||
fixture_write_league_fixtures(League *league)
|
||||
{
|
||||
gint i;
|
||||
GPtrArray *teams = NULL;
|
||||
|
||||
teams = team_get_pointers_from_array(league->teams);
|
||||
|
||||
g_array_free(league->fixtures, TRUE);
|
||||
league->fixtures = g_array_new(FALSE, FALSE, sizeof(Fixture));
|
||||
|
||||
fixture_write_round_robin((gpointer)league, -1, teams);
|
||||
for(i=0;i<league->round_robins;i++)
|
||||
{
|
||||
teams = team_get_pointers_from_array(league->teams);
|
||||
fixture_write_round_robin((gpointer)league, -1, teams);
|
||||
}
|
||||
}
|
||||
|
||||
/** Write the fixtures for the given cup
|
||||
@ -57,25 +60,9 @@ fixture_write_league_fixtures(League *league)
|
||||
void
|
||||
fixture_write_cup_fixtures(Cup *cup)
|
||||
{
|
||||
gint i, j;
|
||||
GPtrArray *teams = NULL;
|
||||
|
||||
g_array_free(cup->fixtures, TRUE);
|
||||
cup->fixtures = g_array_new(FALSE, FALSE, sizeof(Fixture));
|
||||
|
||||
for(i=0;i<cup->rounds->len;i++)
|
||||
{
|
||||
for(j=0;j<g_array_index(cup->rounds, CupRound, i).tables->len;j++)
|
||||
free_table(&g_array_index(g_array_index(cup->rounds, CupRound, i).tables, Table, j));
|
||||
|
||||
g_array_free(g_array_index(cup->rounds, CupRound, i).tables, TRUE);
|
||||
g_array_index(cup->rounds, CupRound, i).tables = g_array_new(FALSE, FALSE, sizeof(Table));
|
||||
}
|
||||
|
||||
if(cup->type == CUP_TYPE_INTERNATIONAL)
|
||||
teams = cup_get_team_pointers(cup);
|
||||
else
|
||||
teams = cup_get_choose_teams_pointers(cup);
|
||||
teams = cup_get_team_pointers(cup);
|
||||
|
||||
if(g_array_index(cup->rounds, CupRound, 0).round_robin_number_of_groups > 0)
|
||||
fixture_write_cup_round_robin(cup, 0, teams);
|
||||
@ -365,10 +352,11 @@ fixture_write_round_robin(gpointer league_cup, gint cup_round, GPtrArray *teams)
|
||||
if(cup_round == -1)
|
||||
{
|
||||
league = (League*)league_cup;
|
||||
first_week = league->first_week;
|
||||
week_gap = league->week_gap;
|
||||
fixtures = league->fixtures;
|
||||
clid = league->id;
|
||||
first_week = (fixtures->len == 0) ?
|
||||
league->first_week : g_array_index(fixtures, Fixture, fixtures->len - 1).week_number + 1;
|
||||
week_gap = league->week_gap;
|
||||
home_advantage = TRUE;
|
||||
}
|
||||
else
|
||||
@ -391,7 +379,7 @@ fixture_write_round_robin(gpointer league_cup, gint cup_round, GPtrArray *teams)
|
||||
|
||||
if(len % 2 != 0)
|
||||
{
|
||||
g_warning("fixture_write_round_robin: round robin for an odd number of teams (%d) is not supported (cup %s).\n",
|
||||
g_warning("fixture_write_round_robin: round robin for an odd number of teams (%d) is not supported (league/cup %s).\n",
|
||||
len, league_cup_get_name_string(clid));
|
||||
main_exit_program(EXIT_FIXTURE_WRITE_ERROR, "");
|
||||
}
|
||||
@ -562,16 +550,18 @@ fixture_get_free_round(gint week_number, gint clid)
|
||||
gint i, j;
|
||||
gint max_round = 1;
|
||||
|
||||
if(clid < ID_CUP_START || query_cup_is_prom(clid))
|
||||
if(clid < ID_CUP_START || query_cup_is_promotion(clid))
|
||||
return 1;
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
{
|
||||
if(acp(i)->id != clid)
|
||||
for(j=0;j<acp(i)->fixtures->len;j++)
|
||||
if(g_array_index(acp(i)->fixtures, Fixture, j).week_number == week_number &&
|
||||
g_array_index(acp(i)->fixtures, Fixture, j).week_round_number == max_round + 1)
|
||||
max_round = MAX(max_round,
|
||||
g_array_index(cp(i).fixtures, Fixture, j).week_round_number);
|
||||
g_array_index(acp(i)->fixtures, Fixture, j).week_round_number);
|
||||
}
|
||||
|
||||
return max_round + 1;
|
||||
}
|
||||
@ -775,7 +765,7 @@ fixture_get_number_of_matches(gint week_number, gint week_round_number)
|
||||
gint sum = 0;
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
if(week_round_number > 1 || query_cup_is_prom(acp(i)->id))
|
||||
if(week_round_number > 1 || query_cup_is_promotion(acp(i)->id))
|
||||
{
|
||||
for(j=0;j<acp(i)->fixtures->len;j++)
|
||||
if(g_array_index(acp(i)->fixtures, Fixture, j).week_number == week_number &&
|
||||
|
25
src/free.c
25
src/free.c
@ -194,9 +194,10 @@ free_country(gboolean reset)
|
||||
}
|
||||
|
||||
free_leagues_array(&ligs, reset);
|
||||
|
||||
free_cups_array(&cps, reset);
|
||||
free_cups_array(&scps, reset);
|
||||
free_g_ptr_array(&acps);
|
||||
if(reset)
|
||||
acps = g_ptr_array_new();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -232,20 +233,18 @@ void
|
||||
free_league(League *league)
|
||||
{
|
||||
gint i;
|
||||
GString **strings[5] =
|
||||
GString **strings[6] =
|
||||
{&league->name,
|
||||
&league->short_name,
|
||||
&league->symbol,
|
||||
&league->sid,
|
||||
&league->prom_rel.prom_games_dest_sid};
|
||||
&league->prom_rel.prom_games_dest_sid,
|
||||
&league->prom_rel.prom_games_cup_sid};
|
||||
GArray **arrays[2] =
|
||||
{&league->teams,
|
||||
&league->prom_rel.elements};
|
||||
|
||||
if(strlen(league->prom_rel.prom_games_dest_sid->str) > 0)
|
||||
free_cup(&league->prom_rel.prom_games_cup);
|
||||
|
||||
for(i=0;i<5;i++)
|
||||
for(i=0;i<6;i++)
|
||||
free_g_string(strings[i]);
|
||||
|
||||
if(league->teams != NULL)
|
||||
@ -345,8 +344,6 @@ free_player(Player *pl)
|
||||
free_g_string(&pl->name);
|
||||
|
||||
free_g_array(&pl->cards);
|
||||
|
||||
/* todo: free history */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -366,8 +363,7 @@ free_cups_array(GArray **cups, gboolean reset)
|
||||
}
|
||||
|
||||
for(i=0;i<(*cups)->len;i++)
|
||||
if(g_array_index(*cups, Cup, i).id < ID_PROM_CUP_START)
|
||||
free_cup(&g_array_index(*cups, Cup, i));
|
||||
free_cup(&g_array_index(*cups, Cup, i));
|
||||
|
||||
free_g_array(cups);
|
||||
|
||||
@ -403,7 +399,6 @@ free_cup(Cup *cup)
|
||||
if(cup->choose_teams != NULL)
|
||||
for(i=0;i<cup->choose_teams->len;i++)
|
||||
free_cup_choose_team(&g_array_index(cup->choose_teams, CupChooseTeam, i));
|
||||
free_cup_choose_team(&cup->choose_team_user);
|
||||
|
||||
free_teams_array(&cup->teams, FALSE);
|
||||
|
||||
@ -413,7 +408,8 @@ free_cup(Cup *cup)
|
||||
free_g_array(&cup->fixtures);
|
||||
|
||||
free_g_ptr_array(&cup->bye);
|
||||
free_g_ptr_array(&cup->user_teams);
|
||||
free_g_ptr_array(&cup->team_names);
|
||||
free_g_string_array(&cup->properties);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -436,6 +432,7 @@ free_variables(void)
|
||||
|
||||
free_option_list(&options, FALSE);
|
||||
free_option_list(&constants, FALSE);
|
||||
free_option_list(&constants_app, FALSE);
|
||||
|
||||
free_g_string(&save_file);
|
||||
|
||||
|
@ -244,7 +244,7 @@ game_initialize(Fixture *fix)
|
||||
gfloat journey_factor =
|
||||
(fix->clid < ID_CUP_START ||
|
||||
(fix->clid >= ID_CUP_START &&
|
||||
cup_from_clid(fix->clid)->type == CUP_TYPE_NATIONAL)) ?
|
||||
query_cup_is_national(fix->clid))) ?
|
||||
const_float("float_game_finance_journey_factor_national") :
|
||||
const_float("float_game_finance_journey_factor_international");
|
||||
gint user_idx[2] = {team_is_user(fix->teams[0]), team_is_user(fix->teams[1])};
|
||||
@ -326,7 +326,7 @@ game_assign_attendance(Fixture *fix)
|
||||
if(cup_from_clid(fix->clid)->rounds->len - fix->round <=
|
||||
const_int("int_game_stadium_attendance_cup_rounds_full_house"))
|
||||
factor = 1;
|
||||
else if(cup_from_clid(fix->clid)->type == CUP_TYPE_NATIONAL)
|
||||
else if(query_cup_is_national(fix->clid))
|
||||
factor *= const_float("float_game_stadium_attendance_cup_national_factor");
|
||||
else
|
||||
factor *= const_float("float_game_stadium_attendance_cup_international_factor");
|
||||
@ -915,8 +915,7 @@ game_post_match(Fixture *fix)
|
||||
team_update_post_match(fix->teams[i], fix->clid);
|
||||
}
|
||||
|
||||
if(fix->clid < ID_CUP_START ||
|
||||
(fix->clid >= ID_PROM_CUP_START && fix->clid < ID_SUPERCUP_START))
|
||||
if(fix->clid < ID_CUP_START)
|
||||
return;
|
||||
|
||||
cup = cup_from_clid(fix->clid);
|
||||
|
@ -42,7 +42,7 @@ game_gui_live_game_show_unit(const LiveGameUnit *unit)
|
||||
|
||||
treeview_live_game_show_result(unit);
|
||||
|
||||
gdk_color_parse (const_str("string_live_game_possession_color"), &color);
|
||||
gdk_color_parse (const_app("string_live_game_possession_color"), &color);
|
||||
gtk_widget_modify_bg(eventbox_poss[unit->possession], GTK_STATE_NORMAL, &color);
|
||||
gtk_widget_modify_bg(eventbox_poss[!unit->possession], GTK_STATE_NORMAL, NULL);
|
||||
|
||||
@ -93,14 +93,14 @@ game_gui_live_game_set_hscale(const LiveGameUnit *unit, GtkHScale *hscale)
|
||||
|
||||
if(unit->area == LIVE_GAME_UNIT_AREA_MIDFIELD)
|
||||
{
|
||||
gdk_color_parse(const_str("string_game_gui_live_game_scale_color_midfield"), &color);
|
||||
gdk_color_parse(const_app("string_game_gui_live_game_scale_color_midfield"), &color);
|
||||
gtk_range_set_value(GTK_RANGE(hscale),
|
||||
const_float("float_game_gui_live_game_scale_range") / 2);
|
||||
}
|
||||
else if(unit->event.type == LIVE_GAME_EVENT_GOAL ||
|
||||
unit->event.type == LIVE_GAME_EVENT_OWN_GOAL)
|
||||
{
|
||||
gdk_color_parse(const_str("string_game_gui_live_game_scale_color_goal"), &color);
|
||||
gdk_color_parse(const_app("string_game_gui_live_game_scale_color_goal"), &color);
|
||||
|
||||
gtk_range_set_value(GTK_RANGE(hscale),
|
||||
const_float("float_game_gui_live_game_scale_range") *
|
||||
@ -110,7 +110,7 @@ game_gui_live_game_set_hscale(const LiveGameUnit *unit, GtkHScale *hscale)
|
||||
unit->event.type == LIVE_GAME_EVENT_PENALTY ||
|
||||
unit->event.type == LIVE_GAME_EVENT_FREE_KICK)
|
||||
{
|
||||
gdk_color_parse(const_str("string_game_gui_live_game_scale_color_chance"), &color);
|
||||
gdk_color_parse(const_app("string_game_gui_live_game_scale_color_chance"), &color);
|
||||
|
||||
gtk_range_set_value(GTK_RANGE(hscale),
|
||||
const_float("float_game_gui_live_game_scale_range") / 2 +
|
||||
@ -122,10 +122,10 @@ game_gui_live_game_set_hscale(const LiveGameUnit *unit, GtkHScale *hscale)
|
||||
unit->event.type == LIVE_GAME_EVENT_MISSED ||
|
||||
unit->event.type == LIVE_GAME_EVENT_SAVE ||
|
||||
unit->event.type == LIVE_GAME_EVENT_CROSS_BAR)
|
||||
gdk_color_parse(const_str("string_game_gui_live_game_scale_color_miss"), &color);
|
||||
gdk_color_parse(const_app("string_game_gui_live_game_scale_color_miss"), &color);
|
||||
else if(unit->area == LIVE_GAME_UNIT_AREA_ATTACK)
|
||||
{
|
||||
gdk_color_parse(const_str("string_game_gui_live_game_scale_color_attack"), &color);
|
||||
gdk_color_parse(const_app("string_game_gui_live_game_scale_color_attack"), &color);
|
||||
gtk_range_set_value(GTK_RANGE(hscale),
|
||||
const_float("float_game_gui_live_game_scale_range") / 2 +
|
||||
(const_float("float_game_gui_live_game_scale_range") *
|
||||
@ -134,7 +134,7 @@ game_gui_live_game_set_hscale(const LiveGameUnit *unit, GtkHScale *hscale)
|
||||
}
|
||||
else if(unit->area == LIVE_GAME_UNIT_AREA_DEFEND)
|
||||
{
|
||||
gdk_color_parse(const_str("string_game_gui_live_game_scale_color_defend"), &color);
|
||||
gdk_color_parse(const_app("string_game_gui_live_game_scale_color_defend"), &color);
|
||||
gtk_range_set_value(GTK_RANGE(hscale),
|
||||
const_float("float_game_gui_live_game_scale_range") / 2 +
|
||||
(const_float("float_game_gui_live_game_scale_range") *
|
||||
@ -248,15 +248,15 @@ game_gui_write_meters(void)
|
||||
GtkImage *image_style = GTK_IMAGE(lookup_widget(window.main, "image_style")),
|
||||
*image_boost = GTK_IMAGE(lookup_widget(window.main, "image_boost"));
|
||||
gchar *image_style_files[5] =
|
||||
{file_find_support_file(const_str("string_game_gui_style_all_out_defend_icon"), TRUE),
|
||||
file_find_support_file(const_str("string_game_gui_style_defend_icon"), TRUE),
|
||||
file_find_support_file(const_str("string_game_gui_style_balanced_icon"), TRUE),
|
||||
file_find_support_file(const_str("string_game_gui_style_attack_icon"), TRUE),
|
||||
file_find_support_file(const_str("string_game_gui_style_all_out_attack_icon"), TRUE)};
|
||||
{file_find_support_file(const_app("string_game_gui_style_all_out_defend_icon"), TRUE),
|
||||
file_find_support_file(const_app("string_game_gui_style_defend_icon"), TRUE),
|
||||
file_find_support_file(const_app("string_game_gui_style_balanced_icon"), TRUE),
|
||||
file_find_support_file(const_app("string_game_gui_style_attack_icon"), TRUE),
|
||||
file_find_support_file(const_app("string_game_gui_style_all_out_attack_icon"), TRUE)};
|
||||
gchar *image_boost_files[3] =
|
||||
{file_find_support_file(const_str("string_game_gui_boost_anti_icon"), TRUE),
|
||||
file_find_support_file(const_str("string_game_gui_boost_off_icon"), TRUE),
|
||||
file_find_support_file(const_str("string_game_gui_boost_on_icon"), TRUE)};
|
||||
{file_find_support_file(const_app("string_game_gui_boost_anti_icon"), TRUE),
|
||||
file_find_support_file(const_app("string_game_gui_boost_off_icon"), TRUE),
|
||||
file_find_support_file(const_app("string_game_gui_boost_on_icon"), TRUE)};
|
||||
|
||||
gtk_image_set_from_file(image_style, image_style_files[current_user.tm->style + 2]);
|
||||
gtk_image_set_from_file(image_boost, image_boost_files[current_user.tm->boost + 1]);
|
||||
|
117
src/league.c
117
src/league.c
@ -31,6 +31,7 @@ league_new(gboolean new_id)
|
||||
|
||||
new.prom_rel.prom_games_dest_sid = g_string_new("");
|
||||
new.prom_rel.prom_games_loser_sid = g_string_new("");
|
||||
new.prom_rel.prom_games_cup_sid = g_string_new("");
|
||||
new.prom_rel.prom_games_number_of_advance = 1;
|
||||
|
||||
new.prom_rel.elements = g_array_new(FALSE, FALSE, sizeof(PromRelElement));
|
||||
@ -43,6 +44,7 @@ league_new(gboolean new_id)
|
||||
new.table.clid = new.id;
|
||||
|
||||
new.first_week = new.week_gap = 1;
|
||||
new.round_robins = 1;
|
||||
new.yellow_red = 1000;
|
||||
|
||||
new.stats = stat_league_new(new.id);
|
||||
@ -86,8 +88,8 @@ league_cup_get_index_from_clid(gint clid)
|
||||
}
|
||||
}
|
||||
else
|
||||
for(i=0;i<acps->len;i++)
|
||||
if(acp(i)->id == clid)
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(cp(i).id == clid)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
@ -224,21 +226,6 @@ league_cup_get_previous_fixture(gint clid, gint week_number, gint week_round_num
|
||||
}
|
||||
|
||||
|
||||
/** Return the number of league in the leagues array. */
|
||||
gint
|
||||
league_get_index(gint clid)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
if(lig(i).id == clid)
|
||||
return i;
|
||||
|
||||
g_warning("league_get_index: reached end of leagues array; clid is %d\n", clid);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Return the average stadium capacity of cpu teams
|
||||
in the specified league or cup. */
|
||||
gint
|
||||
@ -293,12 +280,13 @@ league_remove_team_with_id(League *league, gint id)
|
||||
void
|
||||
league_get_team_movements(League *league, GArray *team_movements)
|
||||
{
|
||||
gint i, j, k, cp_idx = -1;
|
||||
gint i, j, k;
|
||||
gint dest_idx;
|
||||
gint move_len = team_movements->len;
|
||||
TeamMove new_move;
|
||||
const GArray *elements = league->prom_rel.elements;
|
||||
GPtrArray *prom_games_teams = NULL;
|
||||
const Cup *prom_cup = NULL;
|
||||
|
||||
for(i=0;i<elements->len;i++)
|
||||
{
|
||||
@ -336,31 +324,16 @@ league_get_team_movements(League *league, GArray *team_movements)
|
||||
|
||||
if(league_has_prom_games(league))
|
||||
{
|
||||
for(i=0;i<acps->len;i++)
|
||||
if(query_cup_is_prom(acp(i)->id))
|
||||
{
|
||||
for(j=0;j<acp(i)->fixtures->len;j++)
|
||||
{
|
||||
if(g_array_index(acp(i)->fixtures, Fixture, j).teams[0]->clid == league->id ||
|
||||
g_array_index(acp(i)->fixtures, Fixture, j).teams[1]->clid == league->id)
|
||||
{
|
||||
cp_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(cp_idx != -1)
|
||||
break;
|
||||
}
|
||||
|
||||
if(cp_idx == -1)
|
||||
prom_cup = cup_from_sid(league->prom_rel.prom_games_cup_sid->str);
|
||||
|
||||
if(prom_cup == NULL)
|
||||
{
|
||||
g_warning("league_get_team_movements: promotion games cup not found for league %s (dest_sid %s).\n",
|
||||
league->name->str, league->prom_rel.prom_games_dest_sid->str);
|
||||
g_warning("league_get_team_movements: promotion games cup not found for league %s (cup sid %s).\n",
|
||||
league->name->str, league->prom_rel.prom_games_cup_sid->str);
|
||||
return;
|
||||
}
|
||||
|
||||
prom_games_teams = cup_get_teams_sorted(acp(cp_idx));
|
||||
prom_games_teams = cup_get_teams_sorted(prom_cup);
|
||||
dest_idx = league_index_from_sid(league->prom_rel.prom_games_dest_sid->str);
|
||||
|
||||
for(i=0;i<league->prom_rel.prom_games_number_of_advance;i++)
|
||||
@ -386,15 +359,15 @@ league_get_team_movements(League *league, GArray *team_movements)
|
||||
g_array_append_val(team_movements, new_move);
|
||||
|
||||
if(team_is_user((Team*)g_ptr_array_index(prom_games_teams, i)) != -1)
|
||||
user_history_add(&usr(team_is_user(
|
||||
(Team*)g_ptr_array_index(prom_games_teams, i))),
|
||||
USER_HISTORY_RELEGATED, new_move.tm.id, lig(dest_idx).id, -1, "");
|
||||
user_history_add(&usr(team_is_user(
|
||||
(Team*)g_ptr_array_index(prom_games_teams, i))),
|
||||
USER_HISTORY_RELEGATED, new_move.tm.id, lig(dest_idx).id, -1, "");
|
||||
}
|
||||
}
|
||||
|
||||
g_ptr_array_free(prom_games_teams, TRUE);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
@ -418,6 +391,7 @@ league_season_start(League *league)
|
||||
&g_array_index(league->teams, Team, i);
|
||||
g_array_index(league->table.elements, TableElement, i).team_id =
|
||||
g_array_index(league->teams, Team, i).id;
|
||||
g_array_index(league->table.elements, TableElement, i).old_rank = i;
|
||||
|
||||
for(j=0;j<TABLE_END;j++)
|
||||
g_array_index(league->table.elements, TableElement, i).values[j] = 0;
|
||||
@ -448,27 +422,29 @@ gboolean
|
||||
query_league_rank_in_prom_games(const League *league, gint rank)
|
||||
{
|
||||
gint i, j;
|
||||
const Cup *cup = NULL;
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
if(league_has_prom_games((&lig(i))))
|
||||
{
|
||||
for(j=0;j<lig(i).prom_rel.prom_games_cup.choose_teams->len;j++)
|
||||
cup = cup_from_sid(lig(i).prom_rel.prom_games_cup_sid->str);
|
||||
for(j=0;j<cup->choose_teams->len;j++)
|
||||
{
|
||||
if(strcmp(g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams, CupChooseTeam, j).sid->str,
|
||||
if(strcmp(g_array_index(cup->choose_teams, CupChooseTeam, j).sid->str,
|
||||
league->sid->str) == 0 &&
|
||||
((rank >= g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams,
|
||||
((rank >= g_array_index(cup->choose_teams,
|
||||
CupChooseTeam, j).start_idx &&
|
||||
rank <= g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams,
|
||||
rank <= g_array_index(cup->choose_teams,
|
||||
CupChooseTeam, j).end_idx &&
|
||||
g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams,
|
||||
g_array_index(cup->choose_teams,
|
||||
CupChooseTeam, j).randomly) ||
|
||||
(rank >= g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams,
|
||||
(rank >= g_array_index(cup->choose_teams,
|
||||
CupChooseTeam, j).start_idx &&
|
||||
rank < g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams,
|
||||
rank < g_array_index(cup->choose_teams,
|
||||
CupChooseTeam, j).start_idx +
|
||||
g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams,
|
||||
g_array_index(cup->choose_teams,
|
||||
CupChooseTeam, j).number_of_teams &&
|
||||
!g_array_index(lig(i).prom_rel.prom_games_cup.choose_teams,
|
||||
!g_array_index(cup->choose_teams,
|
||||
CupChooseTeam, j).randomly)))
|
||||
return TRUE;
|
||||
}
|
||||
@ -477,43 +453,6 @@ query_league_rank_in_prom_games(const League *league, gint rank)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/** Find out whether the promotion games fixtures can be written. */
|
||||
gboolean
|
||||
query_league_prom_games_begin(const League *league)
|
||||
{
|
||||
gint i, j;
|
||||
gboolean proceed = FALSE;
|
||||
|
||||
for(i=0;i<league->prom_rel.prom_games_cup.choose_teams->len;i++)
|
||||
{
|
||||
for(j=0;j<ligs->len;j++)
|
||||
if(strcmp(lig(j).sid->str,
|
||||
g_array_index(league->prom_rel.prom_games_cup.choose_teams,
|
||||
CupChooseTeam, i).sid->str) == 0 &&
|
||||
g_array_index(lig(j).fixtures, Fixture,
|
||||
lig(j).fixtures->len - 1).week_number == week &&
|
||||
g_array_index(lig(j).fixtures, Fixture,
|
||||
lig(j).fixtures->len - 1).week_round_number == week_round)
|
||||
proceed = TRUE;
|
||||
}
|
||||
|
||||
if(!proceed)
|
||||
return FALSE;
|
||||
|
||||
for(i=0;i<league->prom_rel.prom_games_cup.choose_teams->len;i++)
|
||||
{
|
||||
for(j=0;j<ligs->len;j++)
|
||||
if(strcmp(lig(j).sid->str,
|
||||
g_array_index(league->prom_rel.prom_games_cup.choose_teams,
|
||||
CupChooseTeam, i).sid->str) == 0 &&
|
||||
g_array_index(lig(j).fixtures, Fixture,
|
||||
lig(j).fixtures->len - 1).attendance == -1)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Find out whether there are/were league matches. */
|
||||
gboolean
|
||||
query_league_matches_in_week(const League *league, gint week_number)
|
||||
|
@ -49,7 +49,7 @@ typedef struct
|
||||
GArray *elements;
|
||||
|
||||
/** The cup determining how the promotion games are handled. */
|
||||
Cup prom_games_cup;
|
||||
GString *prom_games_cup_sid;
|
||||
} PromRel;
|
||||
|
||||
/**
|
||||
@ -69,6 +69,9 @@ typedef struct
|
||||
gint first_week;
|
||||
/** Weeks between two matchdays. Default 1. */
|
||||
gint week_gap;
|
||||
/** How many round robins are played. Important for
|
||||
small leagues with 10 teams or so. Default: 1. */
|
||||
gint round_robins;
|
||||
/** Number of yellow cards until a player gets banned.
|
||||
Default 1000 (which means 'off', basically). */
|
||||
gint yellow_red;
|
||||
|
@ -71,8 +71,7 @@ load_save_save_game(const gchar *filename)
|
||||
for(i=0;i<cps->len;i++)
|
||||
xml_loadsave_cup_write(prefix, &cp(i));
|
||||
|
||||
for(i=0;i<scps->len;i++)
|
||||
xml_loadsave_cup_write(prefix, &scp(i));
|
||||
/*todo: acps*/
|
||||
|
||||
if(debug > 60)
|
||||
printf("load_save_save users \n");
|
||||
|
10
src/main.c
10
src/main.c
@ -23,7 +23,7 @@ main_init_variables(void)
|
||||
{
|
||||
gint i;
|
||||
|
||||
ligs = cps = scps = NULL;
|
||||
ligs = cps = NULL;
|
||||
acps = NULL;
|
||||
country.name = country.symbol = country.sid = NULL;
|
||||
player_names = NULL;
|
||||
@ -35,8 +35,6 @@ main_init_variables(void)
|
||||
|
||||
counters[COUNT_LEAGUE_ID] = ID_LEAGUE_START;
|
||||
counters[COUNT_CUP_ID] = ID_CUP_START;
|
||||
counters[COUNT_PROM_CUP_ID] = ID_PROM_CUP_START;
|
||||
counters[COUNT_SUPERCUP_ID] = ID_SUPERCUP_START;
|
||||
|
||||
window.main = window.startup =
|
||||
window.live = window.warning = window.progress = window.digits =
|
||||
@ -52,8 +50,10 @@ main_init_variables(void)
|
||||
|
||||
save_file = g_string_new("");
|
||||
|
||||
constants.list = options.list = NULL;
|
||||
constants.datalist = options.datalist = NULL;
|
||||
constants_app.list =
|
||||
constants.list = options.list = NULL;
|
||||
constants_app.datalist =
|
||||
constants.datalist = options.datalist = NULL;
|
||||
|
||||
popups_active = 0;
|
||||
selected_row[0] = selected_row[1] = -1;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#define opt_user_set_str(name, value) option_set_string(name, ¤t_user.options, value)
|
||||
#define opt_user_set_float(name, value) option_set_float(name, ¤t_user.options, value)
|
||||
|
||||
#define const_app(name) option_string(name, &constants_app)
|
||||
#define const_str(name) option_string(name, &constants)
|
||||
#define const_int(name) option_int(name, &constants)
|
||||
#define const_float(name) option_float(name, &constants)
|
||||
|
103
src/start_end.c
103
src/start_end.c
@ -10,6 +10,7 @@
|
||||
#include "load_save.h"
|
||||
#include "main.h"
|
||||
#include "maths.h"
|
||||
#include "misc.h"
|
||||
#include "option.h"
|
||||
#include "start_end.h"
|
||||
#include "stat.h"
|
||||
@ -79,18 +80,27 @@ start_new_season(void)
|
||||
live_game_reset(&usr(i).live_game, NULL, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
start_load_cup_teams();
|
||||
|
||||
for(i=acps->len - 1;i >= 0;i--)
|
||||
else
|
||||
{
|
||||
if(acp(i)->id >= ID_PROM_CUP_START)
|
||||
{
|
||||
g_array_free(acp(i)->fixtures, TRUE);
|
||||
acp(i)->fixtures = g_array_new(FALSE, FALSE, sizeof(Fixture));
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(cp(i).add_week == 0)
|
||||
g_ptr_array_add(acps, &cp(i));
|
||||
}
|
||||
|
||||
for(i = acps->len - 1; i >= 0; i--)
|
||||
{
|
||||
g_ptr_array_free(acp(i)->team_names, TRUE);
|
||||
acp(i)->team_names = g_ptr_array_new();
|
||||
|
||||
if(acp(i)->add_week != 0)
|
||||
g_ptr_array_remove_index(acps, i);
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
for(i=cps->len - 1; i >= 0; i--)
|
||||
{
|
||||
cup_reset(&cp(i));
|
||||
|
||||
if(cp(i).add_week == 0)
|
||||
fixture_write_cup_fixtures(&cp(i));
|
||||
}
|
||||
|
||||
@ -100,7 +110,6 @@ start_new_season(void)
|
||||
league_season_start(&lig(i));
|
||||
fixture_write_league_fixtures(&lig(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Fill some global variables with default values at the
|
||||
@ -132,30 +141,6 @@ start_generate_league_teams(void)
|
||||
team_generate_players_stadium(&g_array_index(lig(i).teams, Team, j));
|
||||
}
|
||||
|
||||
/** Load the names from the xml files for the cups
|
||||
and generate the teams. */
|
||||
void
|
||||
start_load_cup_teams(void)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(cp(i).type == CUP_TYPE_INTERNATIONAL)
|
||||
{
|
||||
free_teams_array(&cp(i).teams, TRUE);
|
||||
g_ptr_array_free(cp(i).user_teams, TRUE);
|
||||
cp(i).user_teams = g_ptr_array_new();
|
||||
}
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(cp(i).type == CUP_TYPE_INTERNATIONAL)
|
||||
{
|
||||
cup_load_choose_teams(&cp(i));
|
||||
cup_load_choose_team_user(&cp(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** End a week round. */
|
||||
void
|
||||
end_week_round(void)
|
||||
@ -239,7 +224,7 @@ end_week_round_results(void)
|
||||
}
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
if(week_round > 1 || query_cup_is_prom(acp(i)->id))
|
||||
if(week_round > 1 || query_cup_is_promotion(acp(i)->id))
|
||||
{
|
||||
for(j=0;j<acp(i)->fixtures->len;j++)
|
||||
{
|
||||
@ -309,33 +294,19 @@ end_week_round_update_fixtures(void)
|
||||
fixture_update(acp(i));
|
||||
|
||||
for(i=0;i<ligs->len;i++)
|
||||
if(league_has_prom_games((&lig(i))) &&
|
||||
query_league_prom_games_begin(&lig(i)))
|
||||
{
|
||||
if(season == 1)
|
||||
lig(i).prom_rel.prom_games_cup.last_week =
|
||||
cup_get_last_week_from_first(&lig(i).prom_rel.prom_games_cup, week + 1);
|
||||
|
||||
fixture_write_cup_fixtures(&lig(i).prom_rel.prom_games_cup);
|
||||
g_ptr_array_add(acps, &lig(i).prom_rel.prom_games_cup);
|
||||
}
|
||||
else if(week == (lig(i).teams->len - 1) * 2 && week_round == 1 &&
|
||||
team_is_user(g_array_index(lig(i).table.elements, TableElement, 0).team) != -1)
|
||||
if(week == (lig(i).teams->len - 1) * 2 && week_round == 1 &&
|
||||
team_is_user(g_array_index(lig(i).table.elements, TableElement, 0).team) != -1)
|
||||
user_history_add(&usr(team_is_user(g_array_index(lig(i).table.elements, TableElement, 0).team)),
|
||||
USER_HISTORY_CHAMPION, g_array_index(lig(i).table.elements, TableElement, 0).team_id,
|
||||
lig(i).id, -1, "");
|
||||
|
||||
for(i=0;i<scps->len;i++)
|
||||
{
|
||||
if(query_cup_supercup_begins(&scp(i)))
|
||||
{
|
||||
if(season == 1)
|
||||
scp(i).last_week = cup_get_last_week_from_first(&scp(i), week + 1);
|
||||
|
||||
fixture_write_cup_fixtures(&scp(i));
|
||||
g_ptr_array_add(acps, &scp(i));
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(cp(i).add_week == 1000 && query_cup_begins(&cp(i)))
|
||||
{
|
||||
cp(i).last_week = cup_get_last_week_from_first(&cp(i), week + 1);
|
||||
fixture_write_cup_fixtures(&cp(i));
|
||||
g_ptr_array_add(acps, &cp(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Start a new week round. */
|
||||
@ -393,6 +364,20 @@ end_week(void)
|
||||
}
|
||||
}
|
||||
|
||||
/** Add the cups that begin later in the season to the acps array. */
|
||||
void
|
||||
start_week_add_cups(void)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(cp(i).add_week == week)
|
||||
{
|
||||
fixture_write_cup_fixtures(&cp(i));
|
||||
g_ptr_array_add(acps, &cp(i));
|
||||
}
|
||||
}
|
||||
|
||||
/** Age increase etc. of players.
|
||||
CPU teams get updated at the end of their matches
|
||||
(to avoid cup teams getting updated too often). */
|
||||
@ -480,7 +465,6 @@ start_new_season_team_movements(void)
|
||||
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;
|
||||
@ -488,7 +472,6 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** End a season (store stats etc.) */
|
||||
|
@ -15,9 +15,6 @@ start_write_variables(void);
|
||||
void
|
||||
start_generate_league_teams(void);
|
||||
|
||||
void
|
||||
start_load_cup_teams(void);
|
||||
|
||||
void
|
||||
end_week_round(void);
|
||||
|
||||
|
14
src/stat.c
14
src/stat.c
@ -159,14 +159,12 @@ stat_create_season_stat(void)
|
||||
}
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
if(acp(i)->id < ID_PROM_CUP_START ||
|
||||
acp(i)->id >= ID_SUPERCUP_START)
|
||||
{
|
||||
new_champ.cl_name = g_string_new(acp(i)->name->str);
|
||||
new_champ.team_name =
|
||||
g_string_new(cup_get_winner(acp(i))->name->str);
|
||||
g_array_append_val(new.cup_champs, new_champ);
|
||||
}
|
||||
{
|
||||
new_champ.cl_name = g_string_new(acp(i)->name->str);
|
||||
new_champ.team_name =
|
||||
g_string_new(cup_get_winner(acp(i))->name->str);
|
||||
g_array_append_val(new.cup_champs, new_champ);
|
||||
}
|
||||
|
||||
g_array_append_val(season_stats, new);
|
||||
}
|
||||
|
45
src/team.c
45
src/team.c
@ -169,8 +169,6 @@ team_return_league_cup_value_int(const Team *tm, gint value_type)
|
||||
return cp(idx).week_gap;
|
||||
case LEAGUE_CUP_VALUE_YELLOW_RED:
|
||||
return cp(idx).yellow_red;
|
||||
case LEAGUE_CUP_VALUE_CUP_TYPE:
|
||||
return cp(idx).type;
|
||||
case LEAGUE_CUP_VALUE_SKILL_DIFF:
|
||||
return cp(idx).skill_diff;
|
||||
default:
|
||||
@ -248,24 +246,22 @@ team_get_league_cup_string(const Team *tm, gint value_type, gchar *buf)
|
||||
international cup. We'd like to avoid having Real Madrid
|
||||
both in the Champions' League and in the CWC.
|
||||
@param tm The team we check (by comparing names).
|
||||
@param group The cup group the team shouldn't be in.
|
||||
@return TRUE if the team's already participating in a cup,
|
||||
FALSE otherwise. */
|
||||
gboolean
|
||||
query_is_in_international_cups(const Team *tm)
|
||||
query_team_is_in_international_cups(const Team *tm, gint group)
|
||||
{
|
||||
gint i, j;
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
{
|
||||
for(j=0;j<cp(i).teams->len;j++)
|
||||
if(cp(i).type == CUP_TYPE_INTERNATIONAL &&
|
||||
strcmp(tm->name->str, g_array_index(cp(i).teams, Team, j).name->str) == 0)
|
||||
return TRUE;
|
||||
if(group == -1)
|
||||
return FALSE;
|
||||
|
||||
for(j=0;j<cp(i).user_teams->len;j++)
|
||||
if(tm == g_ptr_array_index(cp(i).user_teams, j))
|
||||
return TRUE;
|
||||
}
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(cp(i).group == group)
|
||||
for(j=0;j<cp(i).team_names->len;j++)
|
||||
if(strcmp(tm->name->str, ((GString*)g_ptr_array_index(cp(i).team_names, j))->str) == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -279,24 +275,11 @@ query_is_in_cup(const Team *tm, const Cup *cup)
|
||||
{
|
||||
gint i;
|
||||
|
||||
if(tm->clid >= ID_CUP_START)
|
||||
return (tm->clid == cup->id);
|
||||
|
||||
if(cup->type == CUP_TYPE_INTERNATIONAL)
|
||||
{
|
||||
for(i=0;i<cup->user_teams->len;i++)
|
||||
if(tm == g_ptr_array_index(cup->user_teams, i))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for(i=0;i<cup->fixtures->len;i++)
|
||||
if(tm == g_array_index(cup->fixtures, Fixture, i).teams[0] ||
|
||||
tm == g_array_index(cup->fixtures, Fixture, i).teams[1])
|
||||
for(i=0;i<cup->team_names->len;i++)
|
||||
if(strcmp(tm->name->str, ((GString*)g_ptr_array_index(cup->team_names, i))->str) == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/** Return a GPtrArray containing the pointers
|
||||
@ -384,7 +367,7 @@ team_get_fixture(const Team *tm, gboolean last_fixture)
|
||||
|
||||
for(i=0;i<acps->len;i++)
|
||||
{
|
||||
if(acp(i)->type == CUP_TYPE_NATIONAL ||
|
||||
if(/*d?*//* acp(i)->type == CUP_TYPE_NATIONAL || */
|
||||
query_is_in_cup(tm, acp(i)))
|
||||
{
|
||||
for(j=0;j<acp(i)->fixtures->len;j++)
|
||||
@ -880,7 +863,7 @@ team_get_sorted(GCompareDataFunc compare_function, gint type, gboolean cup)
|
||||
{
|
||||
for(i=0;i<cps->len;i++)
|
||||
{
|
||||
if(cp(i).type == CUP_TYPE_INTERNATIONAL)
|
||||
if(cp(i).teams->len > 0)
|
||||
for(j=0;j<cp(i).teams->len;j++)
|
||||
g_ptr_array_add(teams, &g_array_index(cp(i).teams, Team, j));
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ void
|
||||
team_get_league_cup_string(const Team *tm, gint value_type, gchar *buf);
|
||||
|
||||
gboolean
|
||||
query_is_in_international_cups(const Team *tm);
|
||||
query_team_is_in_international_cups(const Team *tm, gint group);
|
||||
|
||||
gboolean
|
||||
query_is_in_cup(const Team *tm, const Cup *cup);
|
||||
|
@ -17,7 +17,6 @@ enum LeagueCupValue
|
||||
LEAGUE_CUP_VALUE_YELLOW_RED,
|
||||
LEAGUE_CUP_VALUE_AVERAGE_SKILL,
|
||||
LEAGUE_CUP_VALUE_AVERAGE_CAPACITY,
|
||||
LEAGUE_CUP_VALUE_CUP_TYPE,
|
||||
LEAGUE_CUP_VALUE_SKILL_DIFF,
|
||||
LEAGUE_CUP_VALUE_END
|
||||
};
|
||||
|
@ -62,7 +62,7 @@ treeview_create_team_selection_list(gboolean show_cup_teams, gboolean show_user_
|
||||
return GTK_TREE_MODEL(ls);
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(cp(i).type == CUP_TYPE_INTERNATIONAL)
|
||||
if(cp(i).teams->len > 0)
|
||||
for(j=0;j<cp(i).teams->len;j++)
|
||||
{
|
||||
gtk_list_store_append(ls, &iter);
|
||||
@ -388,13 +388,13 @@ treeview_live_game_show_commentary(const LiveGameUnit *unit)
|
||||
sprintf(buf, "%3d.", live_game_unit_get_minute(unit));
|
||||
if(unit->possession == 1)
|
||||
sprintf(buf2, "<span background='%s' foreground='%s'>%s</span>",
|
||||
const_str("string_treeview_live_game_commentary_away_bg"),
|
||||
const_str("string_treeview_live_game_commentary_away_fg"),
|
||||
const_app("string_treeview_live_game_commentary_away_bg"),
|
||||
const_app("string_treeview_live_game_commentary_away_fg"),
|
||||
unit->event.commentary->str);
|
||||
else
|
||||
sprintf(buf2, "<span background='%s' foreground='%s'>%s</span>",
|
||||
const_str("string_treeview_helper_color_default_background"),
|
||||
const_str("string_treeview_helper_color_default_foreground"),
|
||||
const_app("string_treeview_helper_color_default_background"),
|
||||
const_app("string_treeview_helper_color_default_foreground"),
|
||||
unit->event.commentary->str);
|
||||
|
||||
gtk_list_store_prepend(ls, &iter);
|
||||
@ -681,13 +681,13 @@ treeview_create_game_stats(LiveGame *live_game)
|
||||
strcpy(buf[1], " </span>");
|
||||
if(k == LIVE_GAME_STAT_ARRAY_INJURED)
|
||||
sprintf(buf[0], "<span background='%s'> ",
|
||||
const_str("string_treeview_helper_color_player_injury"));
|
||||
const_app("string_treeview_helper_color_player_injury"));
|
||||
else if(k == LIVE_GAME_STAT_ARRAY_REDS)
|
||||
sprintf(buf[0], "<span background='%s'> ",
|
||||
const_str("string_treeview_helper_color_player_banned"));
|
||||
const_app("string_treeview_helper_color_player_banned"));
|
||||
else if(k == LIVE_GAME_STAT_ARRAY_YELLOWS)
|
||||
sprintf(buf[0], "<span background='%s'> ",
|
||||
const_str("string_treeview_helper_color_player_yellow_danger"));
|
||||
const_app("string_treeview_helper_color_player_yellow_danger"));
|
||||
}
|
||||
|
||||
for(i=0;i<MAX(stats->players[0][k]->len,
|
||||
@ -718,13 +718,13 @@ treeview_create_game_stats(LiveGame *live_game)
|
||||
gtk_list_store_append(ls, &iter);
|
||||
if(live_game->stadium_event == LIVE_GAME_EVENT_STADIUM_BREAKDOWN)
|
||||
sprintf(buf[0], _("<span background='%s'>There were technical problems\nin the stadium.</span>"),
|
||||
const_str("string_treeview_stadium_event_bg"));
|
||||
const_app("string_treeview_stadium_event_bg"));
|
||||
else if(live_game->stadium_event == LIVE_GAME_EVENT_STADIUM_RIOTS)
|
||||
sprintf(buf[0], _("<span background='%s'>There were riots\nin the stadium.</span>"),
|
||||
const_str("string_treeview_stadium_event_bg"));
|
||||
const_app("string_treeview_stadium_event_bg"));
|
||||
else
|
||||
sprintf(buf[0], _("<span background='%s'>There was a fire\nin the stadium.</span>"),
|
||||
const_str("string_treeview_stadium_event_bg"));
|
||||
const_app("string_treeview_stadium_event_bg"));
|
||||
|
||||
gtk_list_store_set(ls, &iter, 0, buf[0], 1, "", 2, "", -1);
|
||||
}
|
||||
@ -827,12 +827,12 @@ treeview_create_fixtures_header(const Fixture *fix, GtkListStore *ls, gboolean b
|
||||
}
|
||||
|
||||
sprintf(buf, "<span background='%s' foreground='%s'>%s%s</span>",
|
||||
const_str("string_treeview_fixture_header_bg"),
|
||||
const_str("string_treeview_fixture_header_fg"),
|
||||
const_app("string_treeview_fixture_header_bg"),
|
||||
const_app("string_treeview_fixture_header_fg"),
|
||||
name, round_name);
|
||||
sprintf(buf2, "<span background='%s' foreground='%s'>%s</span>",
|
||||
const_str("string_treeview_fixture_header_bg"),
|
||||
const_str("string_treeview_fixture_header_fg"), buf3);
|
||||
const_app("string_treeview_fixture_header_bg"),
|
||||
const_app("string_treeview_fixture_header_fg"), buf3);
|
||||
|
||||
gtk_list_store_append(ls, &iter);
|
||||
treeview_helper_insert_icon(ls, &iter, 0, symbol);
|
||||
@ -857,7 +857,7 @@ treeview_create_fixture(const Fixture *fix, GtkListStore *ls)
|
||||
gchar *colour_fg = NULL, *colour_bg = NULL;
|
||||
|
||||
if(fix->clid >= ID_CUP_START &&
|
||||
cup_from_clid(fix->clid)->type == CUP_TYPE_INTERNATIONAL)
|
||||
query_cup_is_international(fix->clid))
|
||||
for(i=0;i<2;i++)
|
||||
symbol[i] = fix->teams[i]->symbol->str;
|
||||
|
||||
@ -866,8 +866,8 @@ treeview_create_fixture(const Fixture *fix, GtkListStore *ls)
|
||||
&colour_bg, &colour_fg);
|
||||
else
|
||||
{
|
||||
colour_fg = const_str("string_treeview_helper_color_default_foreground");
|
||||
colour_bg = const_str("string_treeview_helper_color_default_background");
|
||||
colour_fg = const_app("string_treeview_helper_color_default_foreground");
|
||||
colour_bg = const_app("string_treeview_helper_color_default_background");
|
||||
}
|
||||
|
||||
fixture_result_to_buf(fix, buf_result);
|
||||
@ -884,10 +884,10 @@ treeview_create_fixture(const Fixture *fix, GtkListStore *ls)
|
||||
colour_bg, colour_fg, fix->teams[i]->name->str, rank);
|
||||
}
|
||||
else if(fix->clid >= ID_CUP_START &&
|
||||
cup_from_clid(fix->clid)->type == CUP_TYPE_NATIONAL)
|
||||
query_cup_is_national(fix->clid))
|
||||
sprintf(buf[i], "<span background='%s' foreground='%s'>%s (%d)</span>",
|
||||
colour_bg, colour_fg, fix->teams[i]->name->str,
|
||||
league_get_index(fix->teams[i]->clid) + 1);
|
||||
league_cup_get_index_from_clid(fix->teams[i]->clid) + 1);
|
||||
else
|
||||
sprintf(buf[i], "<span background='%s' foreground='%s'>%s</span>",
|
||||
colour_bg, colour_fg, fix->teams[i]->name->str);
|
||||
@ -949,7 +949,7 @@ treeview_set_up_fixtures(GtkTreeView *treeview)
|
||||
gtk_tree_view_append_column(treeview, col);
|
||||
renderer = gtk_cell_renderer_pixbuf_new();
|
||||
g_object_set(renderer, "cell-background",
|
||||
const_str("string_treeview_symbol_bg"), NULL);
|
||||
const_app("string_treeview_symbol_bg"), NULL);
|
||||
gtk_tree_view_column_pack_start(col, renderer, TRUE);
|
||||
gtk_tree_view_column_add_attribute(col, renderer,
|
||||
"pixbuf", 0);
|
||||
@ -971,7 +971,7 @@ treeview_set_up_fixtures(GtkTreeView *treeview)
|
||||
gtk_tree_view_append_column(treeview, col);
|
||||
renderer = gtk_cell_renderer_pixbuf_new();
|
||||
g_object_set(renderer, "cell-background",
|
||||
const_str("string_treeview_symbol_bg"), NULL);
|
||||
const_app("string_treeview_symbol_bg"), NULL);
|
||||
gtk_tree_view_column_pack_start(col, renderer, FALSE);
|
||||
gtk_tree_view_column_add_attribute(col, renderer,
|
||||
"pixbuf", 4);
|
||||
@ -1051,13 +1051,13 @@ treeview_create_single_table(GtkListStore *ls, const Table *table, gint number)
|
||||
|
||||
if(elem->old_rank > i)
|
||||
treeview_helper_insert_icon(ls, &iter, 2,
|
||||
const_str("string_treeview_table_up_icon"));
|
||||
const_app("string_treeview_table_up_icon"));
|
||||
else if(elem->old_rank < i)
|
||||
treeview_helper_insert_icon(ls, &iter, 2,
|
||||
const_str("string_treeview_table_down_icon"));
|
||||
const_app("string_treeview_table_down_icon"));
|
||||
else
|
||||
treeview_helper_insert_icon(ls, &iter, 2,
|
||||
const_str("string_treeview_table_stay_icon"));
|
||||
const_app("string_treeview_table_stay_icon"));
|
||||
|
||||
/*todo: cup choose team user */
|
||||
treeview_helper_get_table_element_colours(table, i, colour_fg, colour_bg, FALSE);
|
||||
@ -1145,7 +1145,7 @@ treeview_set_up_table(GtkTreeView *treeview)
|
||||
gtk_tree_view_append_column(treeview, col);
|
||||
renderer = gtk_cell_renderer_pixbuf_new();
|
||||
g_object_set(renderer, "cell-background",
|
||||
const_str("string_treeview_symbol_bg"), NULL);
|
||||
const_app("string_treeview_symbol_bg"), NULL);
|
||||
gtk_tree_view_column_pack_start(col, renderer, TRUE);
|
||||
gtk_tree_view_column_add_attribute(col, renderer,
|
||||
"pixbuf", 0);
|
||||
@ -1266,7 +1266,7 @@ treeview_create_finances(const User* user)
|
||||
misc_print_grouped_int(in[MON_IN_TRANSFERS], buf, FALSE);
|
||||
misc_print_grouped_int(out[MON_OUT_TRANSFERS], buf3, FALSE);
|
||||
sprintf(buf2, "<span foreground='%s'>%s</span>",
|
||||
const_str("string_treeview_finances_expenses_fg"), buf3);
|
||||
const_app("string_treeview_finances_expenses_fg"), buf3);
|
||||
gtk_list_store_append(ls, &iter);
|
||||
gtk_list_store_set(ls, &iter, 0, _("Transfers"), 1, buf, 2, buf2, -1);
|
||||
balance += (in[MON_IN_TRANSFERS] + out[MON_OUT_TRANSFERS]);
|
||||
@ -1277,7 +1277,7 @@ treeview_create_finances(const User* user)
|
||||
{
|
||||
misc_print_grouped_int(out[i], buf3, FALSE);
|
||||
sprintf(buf, "<span foreground='%s'>%s</span>",
|
||||
const_str("string_treeview_finances_expenses_fg"), buf3);
|
||||
const_app("string_treeview_finances_expenses_fg"), buf3);
|
||||
gtk_list_store_append(ls, &iter);
|
||||
gtk_list_store_set(ls, &iter, 0, out_titles[i], 1, "", 2, buf, -1);
|
||||
balance += out[i];
|
||||
@ -1290,7 +1290,7 @@ treeview_create_finances(const User* user)
|
||||
strcpy(buf2, buf);
|
||||
else
|
||||
sprintf(buf2, "<span foreground='%s'>%s</span>",
|
||||
const_str("string_treeview_finances_expenses_fg"), buf);
|
||||
const_app("string_treeview_finances_expenses_fg"), buf);
|
||||
gtk_list_store_set(ls, &iter, 1 + (balance < 0), buf2, -1);
|
||||
|
||||
gtk_list_store_append(ls, &iter);
|
||||
@ -1302,7 +1302,7 @@ treeview_create_finances(const User* user)
|
||||
strcpy(buf2, buf);
|
||||
else
|
||||
sprintf(buf2, "<span foreground='%s'>%s</span>",
|
||||
const_str("string_treeview_finances_expenses_fg"), buf);
|
||||
const_app("string_treeview_finances_expenses_fg"), buf);
|
||||
gtk_list_store_set(ls, &iter, 0, _("Money"), 1, buf2, 2, "", -1);
|
||||
|
||||
misc_print_grouped_int(finance_team_drawing_credit_loan(user->tm, FALSE), buf, FALSE);
|
||||
@ -1313,7 +1313,7 @@ treeview_create_finances(const User* user)
|
||||
{
|
||||
misc_print_grouped_int(user->debt, buf, FALSE);
|
||||
sprintf(buf2, "<span foreground='%s'>%s</span>",
|
||||
const_str("string_treeview_finances_expenses_fg"), buf);
|
||||
const_app("string_treeview_finances_expenses_fg"), buf);
|
||||
sprintf(buf, _("Debt (repay in %d weeks)"), user->counters[COUNT_USER_LOAN]);
|
||||
gtk_list_store_append(ls, &iter);
|
||||
gtk_list_store_set(ls, &iter, 0, buf, 1, "", 2, buf2, -1);
|
||||
@ -1495,7 +1495,7 @@ treeview_create_next_opponent_values(GtkListStore *ls, const Fixture *fix)
|
||||
strcat(buf2, "|");
|
||||
|
||||
sprintf(buf, "%s\n<span foreground='%s'>", buf2,
|
||||
const_str("string_treeview_opponent_value_colour_fg"));
|
||||
const_app("string_treeview_opponent_value_colour_fg"));
|
||||
for(j=0;j<(gint)rint((gfloat)const_int("int_treeview_max_pipes") *
|
||||
(team_values[fix->teams[0] != current_user.tm][i] / max_values[i]));j++)
|
||||
strcat(buf, "|");
|
||||
@ -1519,9 +1519,16 @@ treeview_create_next_opponent(void)
|
||||
if(opp == NULL)
|
||||
return NULL;
|
||||
|
||||
if(fix->clid < ID_CUP_START)
|
||||
strcpy(buf, league_cup_get_name_string(fix->clid));
|
||||
else
|
||||
{
|
||||
cup_round_name(fix, buf2);
|
||||
sprintf(buf, "%s (%s)", league_cup_get_name_string(fix->clid), buf2);
|
||||
}
|
||||
|
||||
gtk_list_store_append(ls, &iter);
|
||||
gtk_list_store_set(ls, &iter, 0, _("Your next opponent"), 1,
|
||||
league_cup_get_name_string(fix->clid), -1);
|
||||
gtk_list_store_set(ls, &iter, 0, _("Your next opponent"), 1, buf, -1);
|
||||
|
||||
gtk_list_store_append(ls, &iter);
|
||||
sprintf(buf, "Week %d Round %d", fix->week_number, fix->week_round_number);
|
||||
@ -1550,12 +1557,12 @@ treeview_create_next_opponent(void)
|
||||
if(team_get_average_skill(opp, TRUE) >
|
||||
team_get_average_skill(current_user.tm, TRUE))
|
||||
sprintf(buf2, " (<span foreground='%s'>%+.1f</span>)",
|
||||
const_str("string_treeview_opponent_skill_positive_fg"),
|
||||
const_app("string_treeview_opponent_skill_positive_fg"),
|
||||
team_get_average_skill(opp, TRUE) -
|
||||
team_get_average_skill(current_user.tm, TRUE));
|
||||
else
|
||||
sprintf(buf2, " (<span foreground='%s'>%+.1f</span>)",
|
||||
const_str("string_treeview_opponent_skill_negative_fg"),
|
||||
const_app("string_treeview_opponent_skill_negative_fg"),
|
||||
team_get_average_skill(opp, TRUE) -
|
||||
team_get_average_skill(current_user.tm, TRUE));
|
||||
|
||||
@ -1645,7 +1652,7 @@ treeview_create_league_results(void)
|
||||
{
|
||||
if(team_is_user(g_array_index(table_elements, TableElement, i).team) != -1)
|
||||
sprintf(name, "<span background='%s'>%s</span>",
|
||||
const_str("string_treeview_user_bg"),
|
||||
const_app("string_treeview_user_bg"),
|
||||
g_array_index(table_elements, TableElement, i).team->name->str);
|
||||
else
|
||||
strcpy(name, g_array_index(table_elements, TableElement, i).team->name->str);
|
||||
@ -1666,8 +1673,8 @@ treeview_create_league_results(void)
|
||||
"--:--");
|
||||
|
||||
sprintf(away, "<span background='%s' foreground='%s'>%s</span>",
|
||||
const_str("string_treeview_league_results_away_bg"),
|
||||
const_str("string_treeview_league_results_away_fg"),
|
||||
const_app("string_treeview_league_results_away_bg"),
|
||||
const_app("string_treeview_league_results_away_fg"),
|
||||
buf[1]);
|
||||
gtk_list_store_append(ls, &iter);
|
||||
gtk_list_store_set(ls, &iter, 0, name,
|
||||
@ -2019,12 +2026,12 @@ treeview_create_league_stats(GtkListStore *ls, const LeagueStat *league_stat)
|
||||
GArray *players[2] = {league_stat->player_scorers, league_stat->player_goalies};
|
||||
gchar *team_titles[2] = {_("Best offensive teams"),
|
||||
_("Best defensive teams")};
|
||||
gchar *team_icons[2] = {const_str("string_treeview_league_stats_off_teams_icon"),
|
||||
const_str("string_treeview_league_stats_def_teams_icon")};
|
||||
gchar *team_icons[2] = {const_app("string_treeview_league_stats_off_teams_icon"),
|
||||
const_app("string_treeview_league_stats_def_teams_icon")};
|
||||
gchar *player_titles[2][2] = {{_("Best goal scorers"), _("Shot %")},
|
||||
{_("Best goalkeepers"), _("Save %")}};
|
||||
gchar *player_icons[2] = {const_str("string_treeview_league_stats_scorers_icon"),
|
||||
const_str("string_treeview_league_stats_goalies_icon")};
|
||||
gchar *player_icons[2] = {const_app("string_treeview_league_stats_scorers_icon"),
|
||||
const_app("string_treeview_league_stats_goalies_icon")};
|
||||
gchar *colour_fg = NULL, *colour_bg = NULL;
|
||||
|
||||
gtk_list_store_append(ls, &iter);
|
||||
@ -2171,8 +2178,8 @@ treeview_create_season_history_champions(GtkListStore *ls, const GArray* league_
|
||||
const GArray *champs[2] = {league_champs, cup_champs};
|
||||
gchar *titles[2] = {_("League champions"),
|
||||
_("Cup champions")};
|
||||
gchar *icons[2] = {const_str("string_treeview_season_hist_league_champions_icon"),
|
||||
const_str("string_treeview_season_hist_cup_champions_icon")};
|
||||
gchar *icons[2] = {const_app("string_treeview_season_hist_league_champions_icon"),
|
||||
const_app("string_treeview_season_hist_cup_champions_icon")};
|
||||
|
||||
for(i=0;i<2;i++)
|
||||
{
|
||||
|
@ -169,61 +169,62 @@ treeview_helper_live_game_icon(gint event_type)
|
||||
event_type == LIVE_GAME_EVENT_HALF_TIME ||
|
||||
event_type == LIVE_GAME_EVENT_EXTRA_TIME ||
|
||||
event_type == LIVE_GAME_EVENT_PENALTIES)
|
||||
return const_str("string_live_game_event_start_match_icon");
|
||||
return const_app("string_live_game_event_start_match_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_LOST_POSSESSION)
|
||||
return const_str("string_live_game_event_lost_possession_icon");
|
||||
return const_app("string_live_game_event_lost_possession_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_PENALTY)
|
||||
return const_str("string_live_game_event_penalty_icon");
|
||||
return const_app("string_live_game_event_penalty_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_SCORING_CHANCE ||
|
||||
event_type == LIVE_GAME_EVENT_FREE_KICK)
|
||||
return const_str("string_live_game_event_scoring_chance_icon");
|
||||
return const_app("string_live_game_event_scoring_chance_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_GOAL)
|
||||
return const_str("string_live_game_event_goal_icon");
|
||||
return const_app("string_live_game_event_goal_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_OWN_GOAL)
|
||||
return const_str("string_live_game_event_own_goal_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_POST ||
|
||||
event_type == LIVE_GAME_EVENT_CROSS_BAR)
|
||||
return const_str("string_live_game_event_post_icon");
|
||||
return const_app("string_live_game_event_own_goal_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_POST)
|
||||
return const_app("string_live_game_event_post_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_CROSS_BAR)
|
||||
return const_app("string_live_game_event_cross_bar_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_SAVE)
|
||||
return const_str("string_live_game_event_save_icon");
|
||||
return const_app("string_live_game_event_save_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_MISSED)
|
||||
return const_str("string_live_game_event_missed_icon");
|
||||
return const_app("string_live_game_event_missed_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_FOUL)
|
||||
return const_str("string_live_game_event_foul_icon");
|
||||
return const_app("string_live_game_event_foul_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_FOUL_YELLOW)
|
||||
return const_str("string_live_game_event_foul_yellow_icon");
|
||||
return const_app("string_live_game_event_foul_yellow_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_SEND_OFF)
|
||||
return const_str("string_live_game_event_send_off_icon");
|
||||
return const_app("string_live_game_event_send_off_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_INJURY)
|
||||
return const_str("string_live_game_event_injury_icon");
|
||||
return const_app("string_live_game_event_injury_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_TEMP_INJURY)
|
||||
return const_str("string_live_game_event_temp_injury_icon");
|
||||
return const_app("string_live_game_event_temp_injury_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_STADIUM_BREAKDOWN)
|
||||
return const_str("string_live_game_event_stadium_breakdown_icon");
|
||||
return const_app("string_live_game_event_stadium_breakdown_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_STADIUM_FIRE)
|
||||
return const_str("string_live_game_event_stadium_fire_icon");
|
||||
return const_app("string_live_game_event_stadium_fire_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_STADIUM_RIOTS)
|
||||
return const_str("string_live_game_event_stadium_riots_icon");
|
||||
return const_app("string_live_game_event_stadium_riots_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_SUBSTITUTION)
|
||||
return const_str("string_live_game_event_substitution_icon");
|
||||
return const_app("string_live_game_event_substitution_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_STRUCTURE_CHANGE)
|
||||
return const_str("string_live_game_event_structure_change_icon");
|
||||
return const_app("string_live_game_event_structure_change_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_STYLE_CHANGE_ALL_OUT_DEFEND)
|
||||
return const_str("string_game_gui_style_all_out_defend_icon");
|
||||
return const_app("string_game_gui_style_all_out_defend_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_STYLE_CHANGE_DEFEND)
|
||||
return const_str("string_game_gui_style_defend_icon");
|
||||
return const_app("string_game_gui_style_defend_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_STYLE_CHANGE_BALANCED)
|
||||
return const_str("string_game_gui_style_balanced_icon");
|
||||
return const_app("string_game_gui_style_balanced_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_STYLE_CHANGE_ATTACK)
|
||||
return const_str("string_game_gui_style_attack_icon");
|
||||
return const_app("string_game_gui_style_attack_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_STYLE_CHANGE_ALL_OUT_ATTACK)
|
||||
return const_str("string_game_gui_style_all_out_attack_icon");
|
||||
return const_app("string_game_gui_style_all_out_attack_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_BOOST_CHANGE_ANTI)
|
||||
return const_str("string_game_gui_boost_anti_icon");
|
||||
return const_app("string_game_gui_boost_anti_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_BOOST_CHANGE_OFF)
|
||||
return const_str("string_game_gui_boost_off_icon");
|
||||
return const_app("string_game_gui_boost_off_icon");
|
||||
else if(event_type == LIVE_GAME_EVENT_BOOST_CHANGE_ON)
|
||||
return const_str("string_game_gui_boost_on_icon");
|
||||
return const_app("string_game_gui_boost_on_icon");
|
||||
else
|
||||
return "";
|
||||
}
|
||||
@ -239,27 +240,27 @@ treeview_helper_get_user_history_icon(gint history_type)
|
||||
g_warning("treeview_helper_get_user_history_icon: unknown type %d.\n", history_type);
|
||||
return NULL;
|
||||
case USER_HISTORY_START_GAME:
|
||||
return const_str("string_treeview_helper_user_history_symbol_start_game_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_start_game_icon");
|
||||
case USER_HISTORY_FIRE_FINANCES:
|
||||
return const_str("string_treeview_helper_user_history_symbol_fire_finances_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_fire_finances_icon");
|
||||
case USER_HISTORY_FIRE_FAILURE:
|
||||
return const_str("string_treeview_helper_user_history_symbol_fire_failure_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_fire_failure_icon");
|
||||
case USER_HISTORY_JOB_OFFER_ACCEPTED:
|
||||
return const_str("string_treeview_helper_user_history_symbol_job_offer_accepted_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_job_offer_accepted_icon");
|
||||
case USER_HISTORY_END_SEASON:
|
||||
return const_str("string_treeview_helper_user_history_symbol_end_season_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_end_season_icon");
|
||||
case USER_HISTORY_WIN_FINAL:
|
||||
return const_str("string_treeview_helper_user_history_symbol_win_final_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_win_final_icon");
|
||||
case USER_HISTORY_LOSE_FINAL:
|
||||
return const_str("string_treeview_helper_user_history_symbol_lose_final_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_lose_final_icon");
|
||||
case USER_HISTORY_PROMOTED:
|
||||
return const_str("string_treeview_helper_user_history_symbol_promoted_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_promoted_icon");
|
||||
case USER_HISTORY_RELEGATED:
|
||||
return const_str("string_treeview_helper_user_history_symbol_relegated_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_relegated_icon");
|
||||
case USER_HISTORY_REACH_CUP_ROUND:
|
||||
return const_str("string_treeview_helper_user_history_symbol_reach_cup_round_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_reach_cup_round_icon");
|
||||
case USER_HISTORY_CHAMPION:
|
||||
return const_str("string_treeview_helper_user_history_symbol_champion_icon");
|
||||
return const_app("string_treeview_helper_user_history_symbol_champion_icon");
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -412,25 +413,26 @@ treeview_helper_player_compare(GtkTreeModel *model,
|
||||
gboolean
|
||||
treeview_helper_get_table_element_colour_cups(const League *league, gint idx, gchar *colour_bg)
|
||||
{
|
||||
gint i;
|
||||
gint league_idx = league_get_index(league->id) + 1;
|
||||
gint i, j;
|
||||
gint league_idx = league_cup_get_index_from_clid(league->id) + 1;
|
||||
gchar buf[SMALL];
|
||||
|
||||
sprintf(buf, "league%d", league_idx);
|
||||
|
||||
for(i=0;i<cps->len;i++)
|
||||
if(cp(i).type == CUP_TYPE_INTERNATIONAL &&
|
||||
strcmp(cp(i).choose_team_user.sid->str, buf) == 0)
|
||||
for(j=0;j<cp(i).choose_teams->len;j++)
|
||||
if(query_cup_is_international(cp(i).id) &&
|
||||
strcmp(g_array_index(cp(i).choose_teams, CupChooseTeam, j).sid->str, buf) == 0)
|
||||
{
|
||||
if((idx + 1 >= cp(i).choose_team_user.start_idx &&
|
||||
idx + 1 <= cp(i).choose_team_user.end_idx &&
|
||||
cp(i).choose_team_user.randomly) ||
|
||||
(idx + 1 >= cp(i).choose_team_user.start_idx &&
|
||||
idx + 1 < cp(i).choose_team_user.start_idx +
|
||||
cp(i).choose_team_user.number_of_teams &&
|
||||
!cp(i).choose_team_user.randomly))
|
||||
if((idx + 1 >= g_array_index(cp(i).choose_teams, CupChooseTeam, j).start_idx &&
|
||||
idx + 1 <= g_array_index(cp(i).choose_teams, CupChooseTeam, j).end_idx &&
|
||||
g_array_index(cp(i).choose_teams, CupChooseTeam, j).randomly) ||
|
||||
(idx + 1 >= g_array_index(cp(i).choose_teams, CupChooseTeam, j).start_idx &&
|
||||
idx + 1 < g_array_index(cp(i).choose_teams, CupChooseTeam, j).start_idx +
|
||||
g_array_index(cp(i).choose_teams, CupChooseTeam, j).number_of_teams &&
|
||||
!g_array_index(cp(i).choose_teams, CupChooseTeam, j).randomly))
|
||||
{
|
||||
strcpy(colour_bg, const_str("string_treeview_table_cup"));
|
||||
strcpy(colour_bg, const_app("string_treeview_table_cup"));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -452,25 +454,25 @@ treeview_helper_get_table_element_colours(const Table *table, gint idx, gchar *c
|
||||
const League *league = NULL;
|
||||
GPtrArray *cup_advance = NULL;
|
||||
|
||||
strcpy(colour_fg, const_str("string_treeview_helper_color_default_foreground"));
|
||||
strcpy(colour_bg, const_str("string_treeview_helper_color_default_background"));
|
||||
strcpy(colour_fg, const_app("string_treeview_helper_color_default_foreground"));
|
||||
strcpy(colour_bg, const_app("string_treeview_helper_color_default_background"));
|
||||
|
||||
if(user && elem->team == current_user.tm)
|
||||
{
|
||||
strcpy(colour_fg, const_str("string_treeview_current_user_fg"));
|
||||
strcpy(colour_bg, const_str("string_treeview_current_user_bg"));
|
||||
strcpy(colour_fg, const_app("string_treeview_current_user_fg"));
|
||||
strcpy(colour_bg, const_app("string_treeview_current_user_bg"));
|
||||
}
|
||||
else if(user && team_is_user(elem->team) != -1)
|
||||
{
|
||||
strcpy(colour_fg, const_str("string_treeview_user_fg"));
|
||||
strcpy(colour_bg, const_str("string_treeview_user_bg"));
|
||||
strcpy(colour_fg, const_app("string_treeview_user_fg"));
|
||||
strcpy(colour_bg, const_app("string_treeview_user_bg"));
|
||||
}
|
||||
else if(table->clid < ID_CUP_START)
|
||||
{
|
||||
league = league_from_clid(table->clid);
|
||||
|
||||
if(idx + 1 == 1)
|
||||
strcpy(colour_bg, const_str("string_treeview_table_first"));
|
||||
strcpy(colour_bg, const_app("string_treeview_table_first"));
|
||||
else
|
||||
{
|
||||
if(!treeview_helper_get_table_element_colour_cups(league, idx, colour_bg))
|
||||
@ -481,14 +483,14 @@ treeview_helper_get_table_element_colours(const Table *table, gint idx, gchar *c
|
||||
if(pelem->ranks[0] <= idx + 1 && idx + 1 <= pelem->ranks[1])
|
||||
{
|
||||
if(pelem->type == PROM_REL_PROMOTION)
|
||||
strcpy(colour_bg, const_str("string_treeview_table_promotion"));
|
||||
strcpy(colour_bg, const_app("string_treeview_table_promotion"));
|
||||
else if(pelem->type == PROM_REL_RELEGATION)
|
||||
strcpy(colour_bg, const_str("string_treeview_table_relegation"));
|
||||
strcpy(colour_bg, const_app("string_treeview_table_relegation"));
|
||||
}
|
||||
}
|
||||
|
||||
if(query_league_rank_in_prom_games(league, idx + 1))
|
||||
strcpy(colour_bg, const_str("string_treeview_table_promgames"));
|
||||
strcpy(colour_bg, const_app("string_treeview_table_promgames"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -498,7 +500,7 @@ treeview_helper_get_table_element_colours(const Table *table, gint idx, gchar *c
|
||||
fixture_get_round_robin_advance(cup_from_clid(table->clid), table->round);
|
||||
for(i=0;i<cup_advance->len;i++)
|
||||
if((Team*)g_ptr_array_index(cup_advance, i) == elem->team)
|
||||
strcpy(colour_bg, const_str("string_treeview_table_promotion"));
|
||||
strcpy(colour_bg, const_app("string_treeview_table_promotion"));
|
||||
|
||||
free_g_ptr_array(&cup_advance);
|
||||
}
|
||||
@ -511,18 +513,18 @@ treeview_helper_set_user_colours(const Team *tm, gchar **colour_bg, gchar **colo
|
||||
{
|
||||
if(tm == current_user.tm)
|
||||
{
|
||||
*colour_fg = const_str("string_treeview_current_user_fg");
|
||||
*colour_bg = const_str("string_treeview_current_user_bg");
|
||||
*colour_fg = const_app("string_treeview_current_user_fg");
|
||||
*colour_bg = const_app("string_treeview_current_user_bg");
|
||||
}
|
||||
else if(team_is_user(tm) != -1)
|
||||
{
|
||||
*colour_fg = const_str("string_treeview_user_fg");
|
||||
*colour_bg = const_str("string_treeview_user_bg");
|
||||
*colour_fg = const_app("string_treeview_user_fg");
|
||||
*colour_bg = const_app("string_treeview_user_bg");
|
||||
}
|
||||
else
|
||||
{
|
||||
*colour_fg = const_str("string_treeview_helper_color_default_foreground");
|
||||
*colour_bg = const_str("string_treeview_helper_color_default_background");
|
||||
*colour_fg = const_app("string_treeview_helper_color_default_foreground");
|
||||
*colour_bg = const_app("string_treeview_helper_color_default_background");
|
||||
}
|
||||
}
|
||||
|
||||
@ -616,9 +618,9 @@ treeview_helper_player_ext_info_to_cell(GtkTreeViewColumn *col,
|
||||
const Player *pl;
|
||||
|
||||
g_object_set(renderer, "text", "", "foreground",
|
||||
const_str("string_treeview_helper_color_default_foreground"),
|
||||
const_app("string_treeview_helper_color_default_foreground"),
|
||||
"background",
|
||||
const_str("string_treeview_helper_color_default_background"), NULL);
|
||||
const_app("string_treeview_helper_color_default_background"), NULL);
|
||||
|
||||
gtk_tree_model_get(model, iter, column, &pl, -1);
|
||||
|
||||
@ -717,7 +719,7 @@ treeview_helper_player_info_banned_to_cell(GtkCellRenderer *renderer, const GArr
|
||||
|
||||
if(strlen(buf) > 0)
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_player_banned"), NULL);
|
||||
const_app("string_treeview_helper_color_player_banned"), NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -783,7 +785,7 @@ treeview_helper_player_info_health_to_cell(GtkCellRenderer *renderer, const Play
|
||||
sprintf(buf, "%s (expected recovery in %d weeks)",
|
||||
player_injury_to_char(pl->health), pl->recovery);
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_player_injury"), NULL);
|
||||
const_app("string_treeview_helper_color_player_injury"), NULL);
|
||||
}
|
||||
else
|
||||
strcpy(buf, "OK");
|
||||
@ -805,9 +807,9 @@ treeview_helper_player_to_cell(GtkTreeViewColumn *col,
|
||||
const Player *pl;
|
||||
|
||||
g_object_set(renderer, "text", "", "foreground",
|
||||
const_str("string_treeview_helper_color_default_foreground"),
|
||||
const_app("string_treeview_helper_color_default_foreground"),
|
||||
"background",
|
||||
const_str("string_treeview_helper_color_default_background"), NULL);
|
||||
const_app("string_treeview_helper_color_default_background"), NULL);
|
||||
strcpy(buf, "");
|
||||
|
||||
gtk_tree_model_get(model, iter, column, &pl, -1);
|
||||
@ -895,16 +897,16 @@ treeview_helper_player_contract_to_cell(GtkCellRenderer *renderer, gchar *buf, g
|
||||
|
||||
if(contract_time < const_float("float_treeview_helper_limit_player_contract_below3"))
|
||||
g_object_set(renderer, "foreground",
|
||||
const_str("string_treeview_helper_color_player_contract_below3"), NULL);
|
||||
const_app("string_treeview_helper_color_player_contract_below3"), NULL);
|
||||
else if(contract_time < const_float("float_treeview_helper_limit_player_contract_below2"))
|
||||
g_object_set(renderer, "foreground",
|
||||
const_str("string_treeview_helper_color_player_contract_below2"), NULL);
|
||||
const_app("string_treeview_helper_color_player_contract_below2"), NULL);
|
||||
else if(contract_time < const_float("float_treeview_helper_limit_player_contract_below1"))
|
||||
g_object_set(renderer, "foreground",
|
||||
const_str("string_treeview_helper_color_player_contract_below1"), NULL);
|
||||
const_app("string_treeview_helper_color_player_contract_below1"), NULL);
|
||||
else
|
||||
g_object_set(renderer, "foreground",
|
||||
const_str("string_treeview_helper_color_player_contract_normal"), NULL);
|
||||
const_app("string_treeview_helper_color_player_contract_normal"), NULL);
|
||||
}
|
||||
|
||||
/** Render a cell of player yellow cards.
|
||||
@ -960,7 +962,7 @@ treeview_helper_player_status_to_cell(GtkCellRenderer *renderer, gchar *buf, con
|
||||
{
|
||||
sprintf(buf, _("INJ(%d)"), pl->recovery);
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_player_injury"), NULL);
|
||||
const_app("string_treeview_helper_color_player_injury"), NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -969,14 +971,14 @@ treeview_helper_player_status_to_cell(GtkCellRenderer *renderer, gchar *buf, con
|
||||
{
|
||||
sprintf(buf, _("BAN(%d)"), ban);
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_player_banned"), NULL);
|
||||
const_app("string_treeview_helper_color_player_banned"), NULL);
|
||||
}
|
||||
else
|
||||
strcpy(buf, _("OK"));
|
||||
|
||||
if(ban == -1)
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_player_yellow_danger"), NULL);
|
||||
const_app("string_treeview_helper_color_player_yellow_danger"), NULL);
|
||||
}
|
||||
|
||||
/** Render a cell of player games or goals.
|
||||
@ -1017,16 +1019,16 @@ treeview_helper_player_fitness_to_cell(GtkCellRenderer *renderer, gchar *buf, gf
|
||||
|
||||
if(fitness < const_float("float_treeview_helper_limit_player_fitness_below3"))
|
||||
g_object_set(renderer, "foreground",
|
||||
const_str("string_treeview_helper_color_player_fitness_below3"), NULL);
|
||||
const_app("string_treeview_helper_color_player_fitness_below3"), NULL);
|
||||
else if(fitness < const_float("float_treeview_helper_limit_player_fitness_below2"))
|
||||
g_object_set(renderer, "foreground",
|
||||
const_str("string_treeview_helper_color_player_fitness_below2"), NULL);
|
||||
const_app("string_treeview_helper_color_player_fitness_below2"), NULL);
|
||||
else if(fitness < const_float("float_treeview_helper_limit_player_fitness_below2"))
|
||||
g_object_set(renderer, "foreground",
|
||||
const_str("string_treeview_helper_color_player_fitness_below2"), NULL);
|
||||
const_app("string_treeview_helper_color_player_fitness_below2"), NULL);
|
||||
else
|
||||
g_object_set(renderer, "foreground",
|
||||
const_str("string_treeview_helper_color_player_fitness_normal"), NULL);
|
||||
const_app("string_treeview_helper_color_player_fitness_normal"), NULL);
|
||||
}
|
||||
|
||||
/** Render a cell of player position or cposition.
|
||||
@ -1041,30 +1043,30 @@ treeview_helper_player_pos_to_cell(GtkCellRenderer *renderer, gchar *buf, gint p
|
||||
default:
|
||||
strcpy(buf, "G");
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_player_pos_goalie_bg"),
|
||||
const_app("string_treeview_helper_color_player_pos_goalie_bg"),
|
||||
"foreground",
|
||||
const_str("string_treeview_helper_color_player_pos_goalie_fg"), NULL);
|
||||
const_app("string_treeview_helper_color_player_pos_goalie_fg"), NULL);
|
||||
break;
|
||||
case PLAYER_POS_DEFENDER:
|
||||
strcpy(buf, "D");
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_player_pos_defender_bg"),
|
||||
const_app("string_treeview_helper_color_player_pos_defender_bg"),
|
||||
"foreground",
|
||||
const_str("string_treeview_helper_color_player_pos_defender_fg"), NULL);
|
||||
const_app("string_treeview_helper_color_player_pos_defender_fg"), NULL);
|
||||
break;
|
||||
case PLAYER_POS_MIDFIELDER:
|
||||
strcpy(buf, "M");
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_player_pos_midfielder_bg"),
|
||||
const_app("string_treeview_helper_color_player_pos_midfielder_bg"),
|
||||
"foreground",
|
||||
const_str("string_treeview_helper_color_player_pos_midfielder_fg"), NULL);
|
||||
const_app("string_treeview_helper_color_player_pos_midfielder_fg"), NULL);
|
||||
break;
|
||||
case PLAYER_POS_FORWARD:
|
||||
strcpy(buf, "F");
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_player_pos_forward_bg"),
|
||||
const_app("string_treeview_helper_color_player_pos_forward_bg"),
|
||||
"foreground",
|
||||
const_str("string_treeview_helper_color_player_pos_forward_fg"), NULL);
|
||||
const_app("string_treeview_helper_color_player_pos_forward_fg"), NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1081,14 +1083,14 @@ treeview_helper_player_cskill_to_cell(GtkCellRenderer *renderer, gchar *buf, con
|
||||
|
||||
if(pl->cskill < pl->skill)
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_player_bad_cskill_bg"),
|
||||
const_app("string_treeview_helper_color_player_bad_cskill_bg"),
|
||||
"foreground",
|
||||
const_str("string_treeview_helper_color_player_bad_cskill_fg"), NULL);
|
||||
const_app("string_treeview_helper_color_player_bad_cskill_fg"), NULL);
|
||||
else
|
||||
g_object_set(renderer, "background",
|
||||
const_str("string_treeview_helper_color_default_background"),
|
||||
const_app("string_treeview_helper_color_default_background"),
|
||||
"foreground",
|
||||
const_str("string_treeview_helper_color_default_foreground"), NULL);
|
||||
const_app("string_treeview_helper_color_default_foreground"), NULL);
|
||||
|
||||
}
|
||||
|
||||
@ -1112,14 +1114,14 @@ treeview_helper_live_game_result(GtkTreeViewColumn *col,
|
||||
{
|
||||
gtk_tree_model_get(model, iter, column, &fix, -1);
|
||||
sprintf(buf, "<span %s>%s</span>",
|
||||
const_str("string_treeview_helper_live_game_result_attributes"),
|
||||
const_app("string_treeview_helper_live_game_result_attributes"),
|
||||
fix->teams[column == 2]->name->str);
|
||||
}
|
||||
else if(column == 1)
|
||||
{
|
||||
gtk_tree_model_get(model, iter, column, &unit, -1);
|
||||
sprintf(buf, "<span %s>%d : %d</span>",
|
||||
const_str("string_treeview_helper_live_game_result_attributes"),
|
||||
const_app("string_treeview_helper_live_game_result_attributes"),
|
||||
unit->result[0], unit->result[1]);
|
||||
|
||||
}
|
||||
|
17
src/user.c
17
src/user.c
@ -604,39 +604,40 @@ user_history_add(User *user, gint type, gint team_id,
|
||||
|
||||
if(type == USER_HISTORY_WIN_FINAL)
|
||||
{
|
||||
if(cup_from_clid(value1)->type == CUP_TYPE_INTERNATIONAL)
|
||||
if(query_cup_is_international(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_winner");
|
||||
else if(cup_from_clid(value1)->type == CUP_TYPE_NATIONAL)
|
||||
else if(query_cup_is_national(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_winner");
|
||||
}
|
||||
else if(type == USER_HISTORY_LOSE_FINAL)
|
||||
{
|
||||
if(cup_from_clid(value1)->type == CUP_TYPE_INTERNATIONAL)
|
||||
if(query_cup_is_international(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_final");
|
||||
else if(cup_from_clid(value1)->type == CUP_TYPE_NATIONAL)
|
||||
else if(query_cup_is_national(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_winner");
|
||||
const_int("int_user_success_national_final");
|
||||
}
|
||||
else if(type == USER_HISTORY_REACH_CUP_ROUND)
|
||||
{
|
||||
if(value2 == cup_from_clid(value1)->rounds->len - 2)
|
||||
{
|
||||
if(cup_from_clid(value1)->type == CUP_TYPE_INTERNATIONAL)
|
||||
if(query_cup_is_international(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_semis");
|
||||
else if(cup_from_clid(value1)->type == CUP_TYPE_NATIONAL)
|
||||
else if(query_cup_is_national(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_semis");
|
||||
}
|
||||
else if(value2 == cup_from_clid(value1)->rounds->len - 3)
|
||||
{
|
||||
if(cup_from_clid(value1)->type == CUP_TYPE_INTERNATIONAL)
|
||||
if(query_cup_is_international(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_international_quarter");
|
||||
else if(cup_from_clid(value1)->type == CUP_TYPE_NATIONAL)
|
||||
else if(query_cup_is_national(value1))
|
||||
user->counters[COUNT_USER_SUCCESS] +=
|
||||
const_int("int_user_success_national_quarter");
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ OptionList options;
|
||||
/** Array of constants that get read from the constants
|
||||
file specified in bygfoot.conf. */
|
||||
OptionList constants;
|
||||
/** Array of constants affecting game appearance rather than
|
||||
behaviour. */
|
||||
OptionList constants_app;
|
||||
|
||||
/** The array containing players to be transfered.
|
||||
@see TransferPlayer */
|
||||
|
39
src/xml.c
39
src/xml.c
@ -78,7 +78,6 @@ xml_load_leagues(const gchar *dirname, const gchar *basename)
|
||||
void
|
||||
xml_load_league(const gchar *dirname, const gchar *basename, const GPtrArray *dir_contents)
|
||||
{
|
||||
gint i;
|
||||
gchar buf[SMALL];
|
||||
League new = league_new(FALSE);
|
||||
gchar *prefix = g_strndup(basename, strlen(basename) - 4);
|
||||
@ -106,24 +105,6 @@ xml_load_league(const gchar *dirname, const gchar *basename, const GPtrArray *di
|
||||
sprintf(buf, "%s/%s_stat.xml", dirname, prefix);
|
||||
xml_loadsave_league_stat_read(buf, &lig(ligs->len - 1).stats);
|
||||
|
||||
if(league_has_prom_games((&lig(ligs->len - 1))))
|
||||
{
|
||||
lig(ligs->len - 1).prom_rel.prom_games_cup = cup_new(FALSE);
|
||||
sprintf(buf, "%s_promcup", prefix);
|
||||
|
||||
for(i=0;i<dir_contents->len;i++)
|
||||
if(g_str_has_prefix(((GString*)g_ptr_array_index(dir_contents, i))->str, buf) &&
|
||||
!query_misc_string_contains(((GString*)g_ptr_array_index(dir_contents, i))->str, "_table") &&
|
||||
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_fixtures.xml") &&
|
||||
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_teams.xml"))
|
||||
{
|
||||
xml_load_cup(&lig(ligs->len - 1).prom_rel.prom_games_cup,
|
||||
dirname, ((GString*)g_ptr_array_index(dir_contents, i))->str,
|
||||
dir_contents);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_free(prefix);
|
||||
}
|
||||
|
||||
@ -139,7 +120,6 @@ xml_load_cups(const gchar *dirname, const gchar *basename)
|
||||
dir_contents = file_dir_get_contents(dirname, buf, ".xml");
|
||||
|
||||
free_cups_array(&cps, TRUE);
|
||||
free_cups_array(&scps, TRUE);
|
||||
|
||||
for(i=0;i<dir_contents->len;i++)
|
||||
{
|
||||
@ -168,16 +148,8 @@ xml_load_cup(Cup *cup, const gchar *dirname, const gchar *basename, const GPtrAr
|
||||
sprintf(buf, "%s/%s", dirname, basename);
|
||||
xml_loadsave_cup_read(buf, cup);
|
||||
|
||||
if(cup->id < ID_PROM_CUP_START)
|
||||
{
|
||||
g_array_append_val(cps, *cup);
|
||||
local_cup = &cp(cps->len - 1);
|
||||
}
|
||||
else if(cup->id >= ID_SUPERCUP_START)
|
||||
{
|
||||
g_array_append_val(scps, *cup);
|
||||
local_cup = &scp(scps->len - 1);
|
||||
}
|
||||
g_array_append_val(cps, *cup);
|
||||
local_cup = &cp(cps->len - 1);
|
||||
|
||||
sprintf(buf, "Loading cup: %s",
|
||||
local_cup->name->str);
|
||||
@ -185,11 +157,8 @@ xml_load_cup(Cup *cup, const gchar *dirname, const gchar *basename, const GPtrAr
|
||||
gtk_progress_bar_get_fraction(
|
||||
GTK_PROGRESS_BAR(lookup_widget(window.progress, "progressbar"))), buf);
|
||||
|
||||
if(local_cup->type == CUP_TYPE_INTERNATIONAL)
|
||||
{
|
||||
sprintf(buf, "%s/%s_teams.xml", dirname, prefix);
|
||||
xml_loadsave_teams_read(buf, local_cup->teams);
|
||||
}
|
||||
sprintf(buf, "%s/%s_teams.xml", dirname, prefix);
|
||||
xml_loadsave_teams_read(buf, local_cup->teams);
|
||||
|
||||
sprintf(buf, "%s/%s_fixtures.xml", dirname, prefix);
|
||||
xml_loadsave_fixtures_read(buf, local_cup->fixtures);
|
||||
|
@ -17,7 +17,6 @@
|
||||
#define TAG_LEAGUE "league"
|
||||
#define TAG_CUPS "cups"
|
||||
#define TAG_CUP "cup"
|
||||
#define TAG_SUPERCUPS "supercups"
|
||||
|
||||
/**
|
||||
* Enum with the states used in the XML parser functions.
|
||||
@ -32,7 +31,6 @@ enum XmlCountryStates
|
||||
STATE_LEAGUE,
|
||||
STATE_CUPS,
|
||||
STATE_CUP,
|
||||
STATE_SUPERCUPS,
|
||||
STATE_END
|
||||
};
|
||||
|
||||
@ -40,7 +38,6 @@ enum XmlCountryStates
|
||||
* The state variable used in the XML parsing functions.
|
||||
*/
|
||||
gint state;
|
||||
gboolean in_supercups;
|
||||
|
||||
/**
|
||||
* The function called by the parser when an opening tag is read.
|
||||
@ -75,14 +72,6 @@ xml_country_read_start_element (GMarkupParseContext *context,
|
||||
state = STATE_CUPS;
|
||||
if(cps == NULL)
|
||||
cps = g_array_new(FALSE, FALSE, sizeof(Cup));
|
||||
in_supercups = FALSE;
|
||||
}
|
||||
else if(strcmp(element_name, TAG_SUPERCUPS) == 0)
|
||||
{
|
||||
state = STATE_SUPERCUPS;
|
||||
if(scps == NULL)
|
||||
scps = g_array_new(FALSE, FALSE, sizeof(Cup));
|
||||
in_supercups = TRUE;
|
||||
}
|
||||
else if(strcmp(element_name, TAG_CUP) == 0)
|
||||
state = STATE_CUP;
|
||||
@ -106,13 +95,12 @@ xml_country_read_end_element (GMarkupParseContext *context,
|
||||
strcmp(element_name, TAG_SYMBOL) == 0 ||
|
||||
strcmp(element_name, TAG_SID) == 0 ||
|
||||
strcmp(element_name, TAG_LEAGUES) == 0 ||
|
||||
strcmp(element_name, TAG_CUPS) == 0 ||
|
||||
strcmp(element_name, TAG_SUPERCUPS) == 0)
|
||||
strcmp(element_name, TAG_CUPS) == 0)
|
||||
state = STATE_COUNTRY;
|
||||
else if(strcmp(element_name, TAG_LEAGUE) == 0)
|
||||
state = STATE_LEAGUES;
|
||||
else if(strcmp(element_name, TAG_CUP) == 0)
|
||||
state = (in_supercups) ? STATE_SUPERCUPS : STATE_CUPS;
|
||||
state = STATE_CUPS;
|
||||
|
||||
else if(strcmp(element_name, TAG_COUNTRY) != 0)
|
||||
g_warning("xml_country_read_start_element: unknown tag: %s; I'm in state %d\n",
|
||||
@ -146,7 +134,7 @@ xml_country_read_text (GMarkupParseContext *context,
|
||||
else if(state == STATE_LEAGUE)
|
||||
xml_league_read(buf, ligs);
|
||||
else if(state == STATE_CUP)
|
||||
xml_cup_read(buf, (in_supercups) ? scps : cps);
|
||||
xml_cup_read(buf, cps);
|
||||
}
|
||||
|
||||
|
||||
@ -161,7 +149,6 @@ xml_country_read_text (GMarkupParseContext *context,
|
||||
void
|
||||
xml_country_read(const gchar *country_name)
|
||||
{
|
||||
gint i;
|
||||
gchar *file_name = file_find_support_file(country_name, FALSE);
|
||||
GMarkupParser parser = {xml_country_read_start_element,
|
||||
xml_country_read_end_element,
|
||||
@ -205,9 +192,4 @@ xml_country_read(const gchar *country_name)
|
||||
g_critical("xml_country_read: error parsing file %s\n", buf);
|
||||
misc_print_error(&error, TRUE);
|
||||
}
|
||||
|
||||
free_g_ptr_array(&acps);
|
||||
acps = g_ptr_array_new();
|
||||
for(i=0;i<cps->len;i++)
|
||||
g_ptr_array_add(acps, &cp(i));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "file.h"
|
||||
#include "main.h"
|
||||
#include "misc.h"
|
||||
#include "option.h"
|
||||
#include "variables.h"
|
||||
#include "xml_cup.h"
|
||||
|
||||
@ -13,8 +14,10 @@
|
||||
#define TAG_SHORT_NAME "short_name"
|
||||
#define TAG_SYMBOL "symbol"
|
||||
#define TAG_SID "sid"
|
||||
#define TAG_TYPE "type"
|
||||
#define TAG_GROUP "group"
|
||||
#define TAG_PROPERTY "property"
|
||||
#define TAG_LAST_WEEK "last_week"
|
||||
#define TAG_ADD_WEEK "add_week"
|
||||
#define TAG_WEEK_GAP "week_gap"
|
||||
#define TAG_YELLOW_RED "yellow_red"
|
||||
#define TAG_SKILL_DIFF "skill_diff"
|
||||
@ -34,7 +37,7 @@
|
||||
#define TAG_CHOOSE_TEAM_START_IDX "start_idx"
|
||||
#define TAG_CHOOSE_TEAM_END_IDX "end_idx"
|
||||
#define TAG_CHOOSE_TEAM_RANDOMLY "randomly"
|
||||
#define TAG_CHOOSE_TEAM_USER "choose_team_user"
|
||||
#define TAG_CHOOSE_TEAM_GENERATE "generate"
|
||||
|
||||
/**
|
||||
* Enum with the states used in the XML parser functions.
|
||||
@ -46,8 +49,10 @@ enum XmlCupStates
|
||||
STATE_SHORT_NAME,
|
||||
STATE_SYMBOL,
|
||||
STATE_SID,
|
||||
STATE_TYPE,
|
||||
STATE_GROUP,
|
||||
STATE_PROPERTY,
|
||||
STATE_LAST_WEEK,
|
||||
STATE_ADD_WEEK,
|
||||
STATE_WEEK_GAP,
|
||||
STATE_YELLOW_RED,
|
||||
STATE_SKILL_DIFF,
|
||||
@ -67,24 +72,14 @@ enum XmlCupStates
|
||||
STATE_CHOOSE_TEAM_START_IDX,
|
||||
STATE_CHOOSE_TEAM_END_IDX,
|
||||
STATE_CHOOSE_TEAM_RANDOMLY,
|
||||
STATE_CHOOSE_TEAM_USER,
|
||||
STATE_CHOOSE_TEAM_GENERATE,
|
||||
STATE_END
|
||||
};
|
||||
|
||||
/**
|
||||
* Possible values for 'type'.
|
||||
*/
|
||||
#define TYPE_NATIONAL "national"
|
||||
#define TYPE_INTERNATIONAL "international"
|
||||
#define TYPE_SUPERCUP "supercup"
|
||||
|
||||
/**
|
||||
* The state variable used in the XML parsing functions.
|
||||
*/
|
||||
gint state;
|
||||
/** This tells us whether we are in a normal choose_team or
|
||||
in the choose_team for the user's league. */
|
||||
gboolean in_choose_team_user;
|
||||
|
||||
/** The variable we will fill and append to an array. */
|
||||
Cup new_cup;
|
||||
@ -119,10 +114,14 @@ xml_cup_read_start_element (GMarkupParseContext *context,
|
||||
state = STATE_SYMBOL;
|
||||
else if(strcmp(element_name, TAG_SID) == 0)
|
||||
state = STATE_SID;
|
||||
else if(strcmp(element_name, TAG_TYPE) == 0)
|
||||
state = STATE_TYPE;
|
||||
else if(strcmp(element_name, TAG_GROUP) == 0)
|
||||
state = STATE_GROUP;
|
||||
else if(strcmp(element_name, TAG_LAST_WEEK) == 0)
|
||||
state = STATE_LAST_WEEK;
|
||||
else if(strcmp(element_name, TAG_PROPERTY) == 0)
|
||||
state = STATE_PROPERTY;
|
||||
else if(strcmp(element_name, TAG_ADD_WEEK) == 0)
|
||||
state = STATE_ADD_WEEK;
|
||||
else if(strcmp(element_name, TAG_WEEK_GAP) == 0)
|
||||
state = STATE_WEEK_GAP;
|
||||
else if(strcmp(element_name, TAG_YELLOW_RED) == 0)
|
||||
@ -169,11 +168,8 @@ xml_cup_read_start_element (GMarkupParseContext *context,
|
||||
state = STATE_CHOOSE_TEAM_END_IDX;
|
||||
else if(strcmp(element_name, TAG_CHOOSE_TEAM_RANDOMLY) == 0)
|
||||
state = STATE_CHOOSE_TEAM_RANDOMLY;
|
||||
else if(strcmp(element_name, TAG_CHOOSE_TEAM_USER) == 0)
|
||||
{
|
||||
state = STATE_CHOOSE_TEAM_USER;
|
||||
in_choose_team_user = TRUE;
|
||||
}
|
||||
else if(strcmp(element_name, TAG_CHOOSE_TEAM_GENERATE) == 0)
|
||||
state = STATE_CHOOSE_TEAM_GENERATE;
|
||||
else
|
||||
g_warning("xml_cup_read_start_element: unknown tag: %s; I'm in state %d\n",
|
||||
element_name, state);
|
||||
@ -194,8 +190,10 @@ xml_cup_read_end_element (GMarkupParseContext *context,
|
||||
strcmp(element_name, TAG_SHORT_NAME) == 0 ||
|
||||
strcmp(element_name, TAG_SYMBOL) == 0 ||
|
||||
strcmp(element_name, TAG_SID) == 0 ||
|
||||
strcmp(element_name, TAG_TYPE) == 0 ||
|
||||
strcmp(element_name, TAG_GROUP) == 0 ||
|
||||
strcmp(element_name, TAG_LAST_WEEK) == 0 ||
|
||||
strcmp(element_name, TAG_PROPERTY) == 0 ||
|
||||
strcmp(element_name, TAG_ADD_WEEK) == 0 ||
|
||||
strcmp(element_name, TAG_WEEK_GAP) == 0 ||
|
||||
strcmp(element_name, TAG_YELLOW_RED) == 0 ||
|
||||
strcmp(element_name, TAG_SKILL_DIFF) == 0 ||
|
||||
@ -214,24 +212,15 @@ xml_cup_read_end_element (GMarkupParseContext *context,
|
||||
state = STATE_CUP_ROUND;
|
||||
else if(strcmp(element_name, TAG_CHOOSE_TEAM) == 0)
|
||||
state = STATE_CHOOSE_TEAMS;
|
||||
else if(strcmp(element_name, TAG_CHOOSE_TEAM_USER) == 0 )
|
||||
{
|
||||
state = STATE_CHOOSE_TEAMS;
|
||||
in_choose_team_user = FALSE;
|
||||
}
|
||||
else if(strcmp(element_name, TAG_CHOOSE_TEAM_SID) == 0 ||
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_NUMBER_OF_TEAMS) == 0 ||
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_START_IDX) == 0 ||
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_END_IDX) == 0 ||
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_RANDOMLY) == 0)
|
||||
{
|
||||
if(in_choose_team_user)
|
||||
state = STATE_CHOOSE_TEAM_USER;
|
||||
else
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_RANDOMLY) == 0 ||
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_GENERATE) == 0)
|
||||
state = STATE_CHOOSE_TEAM;
|
||||
}
|
||||
else if(strcmp(element_name, TAG_CUP) != 0)
|
||||
g_warning("xml_cup_end_start_element: unknown tag: %s; I'm in state %d\n",
|
||||
g_warning("xml_cup_read_end_element: unknown tag: %s; I'm in state %d\n",
|
||||
element_name, state);
|
||||
}
|
||||
|
||||
@ -248,11 +237,11 @@ xml_cup_read_text (GMarkupParseContext *context,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
CupChooseTeam *choose_team = (in_choose_team_user) ?
|
||||
&new_cup.choose_team_user :
|
||||
CupChooseTeam *choose_team =
|
||||
&g_array_index(new_cup.choose_teams, CupChooseTeam, new_cup.choose_teams->len - 1);
|
||||
gchar buf[text_len + 1];
|
||||
gint value;
|
||||
GString *new_property = NULL;
|
||||
|
||||
strncpy(buf, text, text_len);
|
||||
buf[text_len] = '\0';
|
||||
@ -267,19 +256,17 @@ xml_cup_read_text (GMarkupParseContext *context,
|
||||
g_string_printf(new_cup.symbol, "%s", buf);
|
||||
else if(state == STATE_SID)
|
||||
g_string_printf(new_cup.sid, "%s", buf);
|
||||
else if(state == STATE_TYPE)
|
||||
{
|
||||
if(strcmp(buf, TYPE_NATIONAL) == 0)
|
||||
new_cup.type = CUP_TYPE_NATIONAL;
|
||||
else if(strcmp(buf, TYPE_INTERNATIONAL) == 0)
|
||||
new_cup.type = CUP_TYPE_INTERNATIONAL;
|
||||
else if(strcmp(buf, TYPE_SUPERCUP) == 0)
|
||||
new_cup.type = CUP_TYPE_SUPERCUP;
|
||||
else
|
||||
g_warning("xml_cup_read_text: unknown cup type %s\n", buf);
|
||||
}
|
||||
else if(state == STATE_GROUP)
|
||||
new_cup.group = value;
|
||||
else if(state == STATE_LAST_WEEK)
|
||||
new_cup.last_week = value;
|
||||
else if(state == STATE_PROPERTY)
|
||||
{
|
||||
new_property = g_string_new(buf);
|
||||
g_ptr_array_add(new_cup.properties, new_property);
|
||||
}
|
||||
else if(state == STATE_ADD_WEEK)
|
||||
new_cup.add_week = value;
|
||||
else if(state == STATE_WEEK_GAP)
|
||||
new_cup.week_gap = value;
|
||||
else if(state == STATE_YELLOW_RED)
|
||||
@ -310,6 +297,8 @@ xml_cup_read_text (GMarkupParseContext *context,
|
||||
choose_team->end_idx = value;
|
||||
else if(state == STATE_CHOOSE_TEAM_RANDOMLY)
|
||||
choose_team->randomly = value;
|
||||
else if(state == STATE_CHOOSE_TEAM_GENERATE)
|
||||
choose_team->generate = value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -350,7 +339,6 @@ xml_cup_read(const gchar *cup_name, GArray *cups)
|
||||
}
|
||||
|
||||
state = STATE_CUP;
|
||||
in_choose_team_user = FALSE;
|
||||
strcpy(buf, file_name);
|
||||
g_free(file_name);
|
||||
|
||||
@ -366,10 +354,7 @@ xml_cup_read(const gchar *cup_name, GArray *cups)
|
||||
misc_print_error(&error, TRUE);
|
||||
}
|
||||
|
||||
if(cups == cps)
|
||||
new_cup.id = cup_id_new;
|
||||
else if(cups == scps)
|
||||
new_cup.id = supercup_id_new;
|
||||
new_cup.id = cup_id_new;
|
||||
|
||||
g_array_append_val(cups, new_cup);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define TAG_SYMBOL "symbol"
|
||||
#define TAG_FIRST_WEEK "first_week"
|
||||
#define TAG_WEEK_GAP "week_gap"
|
||||
#define TAG_ROUND_ROBINS "round_robins"
|
||||
#define TAG_YELLOW_RED "yellow_red"
|
||||
#define TAG_AVERAGE_SKILL "average_skill"
|
||||
#define TAG_PROM_REL "prom_rel"
|
||||
@ -26,7 +27,7 @@
|
||||
#define TAG_PROM_GAMES_DEST_SID "prom_games_dest_sid"
|
||||
#define TAG_PROM_GAMES_LOSER_SID "prom_games_loser_sid"
|
||||
#define TAG_PROM_GAMES_NUMBER_OF_ADVANCE "prom_games_number_of_advance"
|
||||
#define TAG_PROM_GAMES_CUP "cup"
|
||||
#define TAG_PROM_GAMES_CUP_SID "prom_games_cup_sid"
|
||||
#define TAG_PROM_REL_ELEMENT "prom_rel_element"
|
||||
#define TAG_PROM_REL_ELEMENT_RANK_START "rank_start"
|
||||
#define TAG_PROM_REL_ELEMENT_RANK_END "rank_end"
|
||||
@ -48,6 +49,7 @@ enum XmlLeagueStates
|
||||
STATE_SYMBOL,
|
||||
STATE_FIRST_WEEK,
|
||||
STATE_WEEK_GAP,
|
||||
STATE_ROUND_ROBINS,
|
||||
STATE_YELLOW_RED,
|
||||
STATE_AVERAGE_SKILL,
|
||||
STATE_PROM_REL,
|
||||
@ -55,7 +57,7 @@ enum XmlLeagueStates
|
||||
STATE_PROM_GAMES_DEST_SID,
|
||||
STATE_PROM_GAMES_LOSER_SID,
|
||||
STATE_PROM_GAMES_NUMBER_OF_ADVANCE,
|
||||
STATE_PROM_GAMES_CUP,
|
||||
STATE_PROM_GAMES_CUP_SID,
|
||||
STATE_PROM_REL_ELEMENT,
|
||||
STATE_PROM_REL_ELEMENT_RANK_START,
|
||||
STATE_PROM_REL_ELEMENT_RANK_END,
|
||||
@ -109,6 +111,8 @@ xml_league_read_start_element (GMarkupParseContext *context,
|
||||
state = STATE_FIRST_WEEK;
|
||||
else if(strcmp(element_name, TAG_WEEK_GAP) == 0)
|
||||
state = STATE_WEEK_GAP;
|
||||
else if(strcmp(element_name, TAG_ROUND_ROBINS) == 0)
|
||||
state = STATE_ROUND_ROBINS;
|
||||
else if(strcmp(element_name, TAG_YELLOW_RED) == 0)
|
||||
state = STATE_YELLOW_RED;
|
||||
else if(strcmp(element_name, TAG_AVERAGE_SKILL) == 0)
|
||||
@ -123,8 +127,8 @@ xml_league_read_start_element (GMarkupParseContext *context,
|
||||
state = STATE_PROM_GAMES_LOSER_SID;
|
||||
else if(strcmp(element_name, TAG_PROM_GAMES_NUMBER_OF_ADVANCE) == 0)
|
||||
state = STATE_PROM_GAMES_NUMBER_OF_ADVANCE;
|
||||
else if(strcmp(element_name, TAG_PROM_GAMES_CUP) == 0)
|
||||
state = STATE_PROM_GAMES_CUP;
|
||||
else if(strcmp(element_name, TAG_PROM_GAMES_CUP_SID) == 0)
|
||||
state = STATE_PROM_GAMES_CUP_SID;
|
||||
else if(strcmp(element_name, TAG_PROM_REL_ELEMENT) == 0)
|
||||
{
|
||||
new_element = prom_rel_element_new();
|
||||
@ -174,6 +178,7 @@ xml_league_read_end_element (GMarkupParseContext *context,
|
||||
strcmp(element_name, TAG_SYMBOL) == 0 ||
|
||||
strcmp(element_name, TAG_FIRST_WEEK) == 0 ||
|
||||
strcmp(element_name, TAG_WEEK_GAP) == 0 ||
|
||||
strcmp(element_name, TAG_ROUND_ROBINS) == 0 ||
|
||||
strcmp(element_name, TAG_YELLOW_RED) == 0 ||
|
||||
strcmp(element_name, TAG_AVERAGE_SKILL) == 0 ||
|
||||
strcmp(element_name, TAG_PROM_REL) == 0 ||
|
||||
@ -185,7 +190,7 @@ xml_league_read_end_element (GMarkupParseContext *context,
|
||||
else if(strcmp(element_name, TAG_PROM_GAMES_DEST_SID) == 0 ||
|
||||
strcmp(element_name, TAG_PROM_GAMES_LOSER_SID) == 0 ||
|
||||
strcmp(element_name, TAG_PROM_GAMES_NUMBER_OF_ADVANCE) == 0 ||
|
||||
strcmp(element_name, TAG_PROM_GAMES_CUP) == 0)
|
||||
strcmp(element_name, TAG_PROM_GAMES_CUP_SID) == 0)
|
||||
state = STATE_PROM_GAMES;
|
||||
else if(strcmp(element_name, TAG_PROM_REL_ELEMENT_RANK_START) == 0 ||
|
||||
strcmp(element_name, TAG_PROM_REL_ELEMENT_RANK_END) == 0 ||
|
||||
@ -216,7 +221,6 @@ xml_league_read_text (GMarkupParseContext *context,
|
||||
{
|
||||
gchar buf[text_len + 1];
|
||||
gint value;
|
||||
GArray *temp_cups = NULL;
|
||||
|
||||
strncpy(buf, text, text_len);
|
||||
buf[text_len] = '\0';
|
||||
@ -238,6 +242,8 @@ xml_league_read_text (GMarkupParseContext *context,
|
||||
new_league.first_week = value;
|
||||
else if(state == STATE_WEEK_GAP)
|
||||
new_league.week_gap = value;
|
||||
else if(state == STATE_ROUND_ROBINS)
|
||||
new_league.round_robins = value;
|
||||
else if(state == STATE_YELLOW_RED)
|
||||
new_league.yellow_red = value;
|
||||
else if(state == STATE_AVERAGE_SKILL)
|
||||
@ -248,14 +254,8 @@ xml_league_read_text (GMarkupParseContext *context,
|
||||
g_string_printf(new_league.prom_rel.prom_games_loser_sid, "%s", buf);
|
||||
else if(state == STATE_PROM_GAMES_NUMBER_OF_ADVANCE)
|
||||
new_league.prom_rel.prom_games_number_of_advance = value;
|
||||
else if(state == STATE_PROM_GAMES_CUP)
|
||||
{
|
||||
temp_cups = g_array_new(FALSE, FALSE, sizeof(Cup));
|
||||
xml_cup_read(buf, temp_cups);
|
||||
new_league.prom_rel.prom_games_cup = g_array_index(temp_cups, Cup, 0);
|
||||
new_league.prom_rel.prom_games_cup.id = prom_cup_id_new;
|
||||
free_g_array(&temp_cups);
|
||||
}
|
||||
else if(state == STATE_PROM_GAMES_CUP_SID)
|
||||
g_string_printf(new_league.prom_rel.prom_games_cup_sid, "%s", buf);
|
||||
else if(state == STATE_PROM_REL_ELEMENT_RANK_START)
|
||||
g_array_index(new_league.prom_rel.elements,
|
||||
PromRelElement,
|
||||
|
@ -12,17 +12,19 @@
|
||||
enum
|
||||
{
|
||||
TAG_CUP = TAG_START_CUP,
|
||||
TAG_CUP_TYPE,
|
||||
TAG_CUP_LAST_WEEK,
|
||||
TAG_CUP_SKILL_DIFF,
|
||||
TAG_CUP_ADD_WEEK,
|
||||
TAG_CUP_PROPERTY,
|
||||
TAG_CUP_GROUP,
|
||||
TAG_CUP_SKILL_DIFF,
|
||||
TAG_CUP_OVERALL_TEAMS,
|
||||
TAG_CUP_CHOOSE_TEAM_USER,
|
||||
TAG_CUP_CHOOSE_TEAM,
|
||||
TAG_CUP_CHOOSE_TEAM_SID,
|
||||
TAG_CUP_CHOOSE_TEAM_NUMBER_OF_TEAMS,
|
||||
TAG_CUP_CHOOSE_TEAM_START_IDX,
|
||||
TAG_CUP_CHOOSE_TEAM_END_IDX,
|
||||
TAG_CUP_CHOOSE_TEAM_RANDOMLY,
|
||||
TAG_CUP_CHOOSE_TEAM_GENERATE,
|
||||
TAG_CUP_ROUND,
|
||||
TAG_CUP_ROUND_HOME_AWAY,
|
||||
TAG_CUP_ROUND_REPLAY,
|
||||
@ -31,17 +33,17 @@ enum
|
||||
TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_ADVANCE,
|
||||
TAG_CUP_ROUND_ROUND_ROBIN_NUMBER_OF_BEST_ADVANCE,
|
||||
TAG_CUP_BYE,
|
||||
TAG_CUP_USER_TEAM,
|
||||
TAG_CUP_TEAM_NAME,
|
||||
TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK,
|
||||
TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK_ROUND,
|
||||
TAG_END
|
||||
};
|
||||
|
||||
gint state;
|
||||
gboolean in_choose_team_user, in_bye;
|
||||
Cup *new_cup;
|
||||
CupChooseTeam new_choose_team;
|
||||
CupRound new_round;
|
||||
GString *new_team_name;
|
||||
|
||||
void
|
||||
xml_loadsave_cup_start_element (GMarkupParseContext *context,
|
||||
@ -71,10 +73,6 @@ xml_loadsave_cup_start_element (GMarkupParseContext *context,
|
||||
|
||||
if(tag == TAG_CUP_CHOOSE_TEAM)
|
||||
new_choose_team = cup_choose_team_new();
|
||||
else if(tag == TAG_CUP_CHOOSE_TEAM_USER)
|
||||
in_choose_team_user = TRUE;
|
||||
else if(tag == TAG_CUP_BYE)
|
||||
in_bye = TRUE;
|
||||
else if(tag == TAG_CUP_ROUND)
|
||||
new_round = cup_round_new();
|
||||
|
||||
@ -99,43 +97,35 @@ xml_loadsave_cup_end_element (GMarkupParseContext *context,
|
||||
tag == TAG_YELLOW_RED ||
|
||||
tag == TAG_WEEK_GAP ||
|
||||
tag == TAG_CUP_LAST_WEEK ||
|
||||
tag == TAG_CUP_TYPE ||
|
||||
tag == TAG_CUP_ADD_WEEK ||
|
||||
tag == TAG_CUP_PROPERTY ||
|
||||
tag == TAG_CUP_GROUP ||
|
||||
tag == TAG_CUP_SKILL_DIFF ||
|
||||
tag == TAG_CUP_OVERALL_TEAMS ||
|
||||
tag == TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK ||
|
||||
tag == TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK_ROUND ||
|
||||
tag == TAG_CUP_USER_TEAM ||
|
||||
tag == TAG_CUP_CHOOSE_TEAM_USER ||
|
||||
tag == TAG_CUP_ROUND ||
|
||||
tag == TAG_CUP_TEAM_NAME ||
|
||||
tag == TAG_CUP_BYE)
|
||||
{
|
||||
state = TAG_CUP;
|
||||
if(tag == TAG_CUP_CHOOSE_TEAM_USER)
|
||||
in_choose_team_user = FALSE;
|
||||
else if(tag == TAG_CUP_BYE)
|
||||
in_bye = FALSE;
|
||||
else if(tag == TAG_CUP_ROUND)
|
||||
if(tag == TAG_CUP_ROUND)
|
||||
g_array_append_val(new_cup->rounds, new_round);
|
||||
else if(tag == TAG_CUP_TEAM_NAME)
|
||||
g_ptr_array_add(new_cup->team_names, new_team_name);
|
||||
}
|
||||
else if(tag == TAG_CUP_CHOOSE_TEAM)
|
||||
{
|
||||
if(in_choose_team_user)
|
||||
{
|
||||
state = TAG_CUP_CHOOSE_TEAM_USER;
|
||||
new_cup->choose_team_user = new_choose_team;
|
||||
}
|
||||
else
|
||||
{
|
||||
state = TAG_CUP;
|
||||
g_array_append_val(new_cup->choose_teams, new_choose_team);
|
||||
}
|
||||
state = TAG_CUP;
|
||||
g_array_append_val(new_cup->choose_teams, new_choose_team);
|
||||
}
|
||||
else if(tag == TAG_TEAM_ID)
|
||||
state = (in_bye) ? TAG_CUP_BYE : TAG_CUP_USER_TEAM;
|
||||
state = TAG_CUP_BYE;
|
||||
else if(tag == TAG_CUP_CHOOSE_TEAM_NUMBER_OF_TEAMS ||
|
||||
tag == TAG_CUP_CHOOSE_TEAM_START_IDX ||
|
||||
tag == TAG_CUP_CHOOSE_TEAM_END_IDX ||
|
||||
tag == TAG_CUP_CHOOSE_TEAM_SID ||
|
||||
tag == TAG_CUP_CHOOSE_TEAM_GENERATE ||
|
||||
tag == TAG_CUP_CHOOSE_TEAM_RANDOMLY)
|
||||
state = TAG_CUP_CHOOSE_TEAM;
|
||||
else if(tag == TAG_CUP_ROUND_HOME_AWAY ||
|
||||
@ -159,6 +149,7 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
|
||||
{
|
||||
gchar buf[SMALL];
|
||||
gint int_value = -1;
|
||||
GString *new_property = NULL;
|
||||
|
||||
strncpy(buf, text, text_len);
|
||||
buf[text_len] = '\0';
|
||||
@ -179,10 +170,17 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
|
||||
new_cup->week_gap = int_value;
|
||||
else if(state == TAG_YELLOW_RED)
|
||||
new_cup->yellow_red = int_value;
|
||||
else if(state == TAG_CUP_TYPE)
|
||||
new_cup->type = int_value;
|
||||
else if(state == TAG_CUP_LAST_WEEK)
|
||||
new_cup->last_week = int_value;
|
||||
else if(state == TAG_CUP_ADD_WEEK)
|
||||
new_cup->add_week = int_value;
|
||||
else if(state == TAG_CUP_PROPERTY)
|
||||
{
|
||||
new_property = g_string_new(buf);
|
||||
g_ptr_array_add(new_cup->properties, new_property);
|
||||
}
|
||||
else if(state == TAG_CUP_GROUP)
|
||||
new_cup->group = int_value;
|
||||
else if(state == TAG_CUP_SKILL_DIFF)
|
||||
new_cup->skill_diff = int_value;
|
||||
else if(state == TAG_CUP_OVERALL_TEAMS)
|
||||
@ -193,15 +191,12 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
|
||||
new_cup->next_fixture_update_week_round = int_value;
|
||||
else if(state == TAG_TEAM_ID)
|
||||
{
|
||||
if(in_bye)
|
||||
{
|
||||
if(new_cup->bye == NULL)
|
||||
new_cup->bye = g_ptr_array_new();
|
||||
g_ptr_array_add(new_cup->bye, team_of_id(int_value));
|
||||
}
|
||||
else
|
||||
g_ptr_array_add(new_cup->user_teams, team_of_id(int_value));
|
||||
if(new_cup->bye == NULL)
|
||||
new_cup->bye = g_ptr_array_new();
|
||||
g_ptr_array_add(new_cup->bye, team_of_id(int_value));
|
||||
}
|
||||
else if(state == TAG_CUP_TEAM_NAME)
|
||||
new_team_name = g_string_new(buf);
|
||||
else if(state == TAG_CUP_CHOOSE_TEAM_SID)
|
||||
g_string_printf(new_choose_team.sid, "%s", buf);
|
||||
else if(state == TAG_CUP_CHOOSE_TEAM_NUMBER_OF_TEAMS)
|
||||
@ -212,6 +207,8 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
|
||||
new_choose_team.end_idx = int_value;
|
||||
else if(state == TAG_CUP_CHOOSE_TEAM_RANDOMLY)
|
||||
new_choose_team.randomly = int_value;
|
||||
else if(state == TAG_CUP_CHOOSE_TEAM_GENERATE)
|
||||
new_choose_team.generate = int_value;
|
||||
else if(state == TAG_CUP_ROUND_HOME_AWAY)
|
||||
new_round.home_away = int_value;
|
||||
else if(state == TAG_CUP_ROUND_REPLAY)
|
||||
@ -282,35 +279,25 @@ xml_loadsave_cup_write(const gchar *prefix, const Cup *cup)
|
||||
xml_write_g_string(fil, cup->symbol, TAG_SYMBOL, I0);
|
||||
|
||||
xml_write_int(fil, cup->id, TAG_ID, I0);
|
||||
xml_write_int(fil, cup->type, TAG_CUP_TYPE, I0);
|
||||
xml_write_int(fil, cup->last_week, TAG_CUP_LAST_WEEK, I0);
|
||||
xml_write_int(fil, cup->add_week, TAG_CUP_ADD_WEEK, I0);
|
||||
xml_write_int(fil, cup->group, TAG_CUP_GROUP, 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->skill_diff, TAG_CUP_SKILL_DIFF, I0);
|
||||
xml_write_int(fil, cup->overall_teams, TAG_CUP_OVERALL_TEAMS, I0);
|
||||
|
||||
for(i=0;i<cup->properties->len;i++)
|
||||
xml_write_g_string(fil, (GString*)g_ptr_array_index(cup->properties, i),
|
||||
TAG_CUP_PROPERTY, I0);
|
||||
|
||||
xml_write_int(fil, cup->next_fixture_update_week,
|
||||
TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK, I0);
|
||||
xml_write_int(fil, cup->next_fixture_update_week_round,
|
||||
TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK_ROUND, I0);
|
||||
|
||||
if(cup->type == CUP_TYPE_INTERNATIONAL)
|
||||
{
|
||||
sprintf(buf, "%s___cup_%d_teams.xml", prefix, cup->id);
|
||||
xml_loadsave_teams_write(buf, cup->teams);
|
||||
|
||||
fprintf(fil, "<_%d>\n", TAG_CUP_CHOOSE_TEAM_USER);
|
||||
xml_loadsave_cup_write_choose_team(fil, &cup->choose_team_user);
|
||||
fprintf(fil, "</_%d>\n", TAG_CUP_CHOOSE_TEAM_USER);
|
||||
}
|
||||
|
||||
for(i=0;i<cup->user_teams->len;i++)
|
||||
{
|
||||
fprintf(fil, "<_%d>\n", TAG_CUP_USER_TEAM);
|
||||
xml_write_int(fil, ((Team*)g_ptr_array_index(cup->user_teams, i))->id,
|
||||
TAG_TEAM_ID, I1);
|
||||
fprintf(fil, "</_%d>\n", TAG_CUP_USER_TEAM);
|
||||
}
|
||||
sprintf(buf, "%s___cup_%d_teams.xml", prefix, cup->id);
|
||||
xml_loadsave_teams_write(buf, cup->teams);
|
||||
|
||||
for(i=0;i<cup->choose_teams->len;i++)
|
||||
xml_loadsave_cup_write_choose_team(fil,
|
||||
@ -329,6 +316,10 @@ xml_loadsave_cup_write(const gchar *prefix, const Cup *cup)
|
||||
fprintf(fil, "</_%d>\n", TAG_CUP_BYE);
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<cup->team_names->len;i++)
|
||||
xml_write_g_string(fil, (GString*)g_ptr_array_index(cup->team_names, i),
|
||||
TAG_CUP_TEAM_NAME, I1);
|
||||
|
||||
fprintf(fil, "</_%d>\n", TAG_CUP);
|
||||
|
||||
@ -349,6 +340,8 @@ xml_loadsave_cup_write_choose_team(FILE *fil, const CupChooseTeam *choose_team)
|
||||
TAG_CUP_CHOOSE_TEAM_END_IDX, I1);
|
||||
xml_write_int(fil, choose_team->randomly,
|
||||
TAG_CUP_CHOOSE_TEAM_RANDOMLY, I1);
|
||||
xml_write_int(fil, choose_team->generate,
|
||||
TAG_CUP_CHOOSE_TEAM_GENERATE, I1);
|
||||
|
||||
fprintf(fil, "</_%d>\n", TAG_CUP_CHOOSE_TEAM);
|
||||
}
|
||||
|
@ -13,9 +13,11 @@ enum
|
||||
{
|
||||
TAG_LEAGUE = TAG_START_LEAGUE,
|
||||
TAG_LEAGUE_FIRST_WEEK,
|
||||
TAG_LEAGUE_ROUND_ROBINS,
|
||||
TAG_LEAGUE_AVERAGE_SKILL,
|
||||
TAG_LEAGUE_PROM_REL,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_DEST_SID,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_CUP_SID,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_LOSER_SID,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE,
|
||||
TAG_LEAGUE_PROM_REL_CUP,
|
||||
@ -78,6 +80,7 @@ xml_loadsave_league_end_element (GMarkupParseContext *context,
|
||||
|
||||
if(tag == TAG_LEAGUE_FIRST_WEEK ||
|
||||
tag == TAG_LEAGUE_AVERAGE_SKILL ||
|
||||
tag == TAG_LEAGUE_ROUND_ROBINS ||
|
||||
tag == TAG_NAME ||
|
||||
tag == TAG_SHORT_NAME ||
|
||||
tag == TAG_SYMBOL ||
|
||||
@ -88,6 +91,7 @@ xml_loadsave_league_end_element (GMarkupParseContext *context,
|
||||
tag == TAG_LEAGUE_PROM_REL)
|
||||
state = TAG_LEAGUE;
|
||||
else if(tag == TAG_LEAGUE_PROM_REL_PROM_GAMES_DEST_SID ||
|
||||
tag == TAG_LEAGUE_PROM_REL_PROM_GAMES_CUP_SID ||
|
||||
tag == TAG_LEAGUE_PROM_REL_PROM_GAMES_LOSER_SID ||
|
||||
tag == TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE ||
|
||||
tag == TAG_LEAGUE_PROM_REL_CUP ||
|
||||
@ -138,6 +142,8 @@ xml_loadsave_league_text (GMarkupParseContext *context,
|
||||
new_league->id = int_value;
|
||||
else if(state == TAG_LEAGUE_FIRST_WEEK)
|
||||
new_league->first_week = int_value;
|
||||
else if(state == TAG_LEAGUE_ROUND_ROBINS)
|
||||
new_league->round_robins = int_value;
|
||||
else if(state == TAG_WEEK_GAP)
|
||||
new_league->week_gap = int_value;
|
||||
else if(state == TAG_YELLOW_RED)
|
||||
@ -146,6 +152,8 @@ xml_loadsave_league_text (GMarkupParseContext *context,
|
||||
new_league->average_skill = int_value;
|
||||
else if(state == TAG_LEAGUE_PROM_REL_PROM_GAMES_DEST_SID)
|
||||
g_string_printf(new_league->prom_rel.prom_games_dest_sid, "%s", buf);
|
||||
else if(state == TAG_LEAGUE_PROM_REL_PROM_GAMES_CUP_SID)
|
||||
g_string_printf(new_league->prom_rel.prom_games_cup_sid, "%s", buf);
|
||||
else if(state == TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE)
|
||||
new_league->prom_rel.prom_games_number_of_advance = int_value;
|
||||
else if(state == TAG_LEAGUE_PROM_REL_PROM_GAMES_LOSER_SID)
|
||||
@ -224,41 +232,37 @@ xml_loadsave_league_write(const gchar *prefix, const League *league)
|
||||
|
||||
xml_write_int(fil, league->id, TAG_ID, I0);
|
||||
xml_write_int(fil, league->first_week, TAG_LEAGUE_FIRST_WEEK, I0);
|
||||
xml_write_int(fil, league->round_robins, TAG_LEAGUE_ROUND_ROBINS, I0);
|
||||
xml_write_int(fil, league->week_gap, TAG_WEEK_GAP, I0);
|
||||
xml_write_int(fil, league->yellow_red, TAG_YELLOW_RED, I0);
|
||||
xml_write_int(fil, league->average_skill, TAG_LEAGUE_AVERAGE_SKILL, I0);
|
||||
|
||||
fprintf(fil, "%s<_%d>\n", I0, TAG_LEAGUE_PROM_REL);
|
||||
if(league_has_prom_games(league))
|
||||
{
|
||||
xml_write_g_string(fil, league->prom_rel.prom_games_dest_sid,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_DEST_SID, I2);
|
||||
xml_write_int(fil, league->prom_rel.prom_games_number_of_advance,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE, I2);
|
||||
|
||||
sprintf(buf, "%s___league_%d_promcup", prefix, league->id);
|
||||
xml_loadsave_cup_write(buf, &league->prom_rel.prom_games_cup);
|
||||
}
|
||||
|
||||
if(league_has_prom_games(league))
|
||||
xml_write_g_string(fil, league->prom_rel.prom_games_loser_sid,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_LOSER_SID, I2);
|
||||
xml_write_g_string(fil, league->prom_rel.prom_games_dest_sid,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_DEST_SID, I1);
|
||||
xml_write_g_string(fil, league->prom_rel.prom_games_cup_sid,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_CUP_SID, I1);
|
||||
xml_write_int(fil, league->prom_rel.prom_games_number_of_advance,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_NUMBER_OF_ADVANCE, I1);
|
||||
xml_write_g_string(fil, league->prom_rel.prom_games_loser_sid,
|
||||
TAG_LEAGUE_PROM_REL_PROM_GAMES_LOSER_SID, I1);
|
||||
|
||||
fprintf(fil, "%s<_%d>\n", I2, TAG_LEAGUE_PROM_REL_ELEMENTS);
|
||||
fprintf(fil, "%s<_%d>\n", I1, TAG_LEAGUE_PROM_REL_ELEMENTS);
|
||||
for(i=0;i<league->prom_rel.elements->len;i++)
|
||||
{
|
||||
fprintf(fil, "%s<_%d>\n", I2, TAG_LEAGUE_PROM_REL_ELEMENT);
|
||||
fprintf(fil, "%s<_%d>\n", I1, TAG_LEAGUE_PROM_REL_ELEMENT);
|
||||
xml_write_int(fil, g_array_index(league->prom_rel.elements, PromRelElement, i).ranks[0],
|
||||
TAG_LEAGUE_PROM_REL_ELEMENT_RANK, I3);
|
||||
TAG_LEAGUE_PROM_REL_ELEMENT_RANK, I2);
|
||||
xml_write_int(fil, g_array_index(league->prom_rel.elements, PromRelElement, i).ranks[1],
|
||||
TAG_LEAGUE_PROM_REL_ELEMENT_RANK, I3);
|
||||
TAG_LEAGUE_PROM_REL_ELEMENT_RANK, I2);
|
||||
xml_write_int(fil, g_array_index(league->prom_rel.elements, PromRelElement, i).type,
|
||||
TAG_LEAGUE_PROM_REL_ELEMENT_TYPE, I3);
|
||||
TAG_LEAGUE_PROM_REL_ELEMENT_TYPE, I2);
|
||||
xml_write_g_string(fil, g_array_index(league->prom_rel.elements, PromRelElement, i).dest_sid,
|
||||
TAG_LEAGUE_PROM_REL_ELEMENT_DEST_SID, I3);
|
||||
fprintf(fil, "%s</_%d>\n", I2, TAG_LEAGUE_PROM_REL_ELEMENT);
|
||||
TAG_LEAGUE_PROM_REL_ELEMENT_DEST_SID, I2);
|
||||
fprintf(fil, "%s</_%d>\n", I1, TAG_LEAGUE_PROM_REL_ELEMENT);
|
||||
}
|
||||
fprintf(fil, "%s</_%d>\n", I2, TAG_LEAGUE_PROM_REL_ELEMENTS);
|
||||
fprintf(fil, "%s</_%d>\n", I1, TAG_LEAGUE_PROM_REL_ELEMENTS);
|
||||
|
||||
fprintf(fil, "%s</_%d>\n", I0, TAG_LEAGUE_PROM_REL);
|
||||
|
||||
|
171
support_files/bygfoot_app
Normal file
171
support_files/bygfoot_app
Normal file
@ -0,0 +1,171 @@
|
||||
# this file contains all the constants (mostly string constants)
|
||||
# that are related to the appearance of the game -- treeview colours,
|
||||
# icons etc.
|
||||
|
||||
###################################################
|
||||
# treeview background and foreground colours ######
|
||||
###################################################
|
||||
|
||||
# colours of the live game commentary for the away team
|
||||
string_treeview_live_game_commentary_away_fg black
|
||||
string_treeview_live_game_commentary_away_bg lightgrey
|
||||
|
||||
# font attributes for the live game window result.
|
||||
string_treeview_helper_live_game_result_attributes weight='bold' size='large'
|
||||
|
||||
# default background and foreground in treeviews
|
||||
string_treeview_helper_color_default_background white
|
||||
string_treeview_helper_color_default_foreground black
|
||||
|
||||
# player list colours
|
||||
string_treeview_helper_color_player_pos_goalie_bg black
|
||||
string_treeview_helper_color_player_pos_goalie_fg white
|
||||
string_treeview_helper_color_player_pos_defender_bg darkgreen
|
||||
string_treeview_helper_color_player_pos_defender_fg white
|
||||
string_treeview_helper_color_player_pos_midfielder_bg darkblue
|
||||
string_treeview_helper_color_player_pos_midfielder_fg white
|
||||
string_treeview_helper_color_player_pos_forward_bg darkred
|
||||
string_treeview_helper_color_player_pos_forward_fg white
|
||||
|
||||
string_treeview_helper_color_player_injury lightgreen
|
||||
string_treeview_helper_color_player_banned red
|
||||
string_treeview_helper_color_player_yellow_danger yellow
|
||||
|
||||
string_treeview_helper_color_player_fitness_normal darkgreen
|
||||
string_treeview_helper_color_player_fitness_below1 darkorange
|
||||
string_treeview_helper_color_player_fitness_below2 orangered
|
||||
string_treeview_helper_color_player_fitness_below3 red
|
||||
|
||||
# see also the int constants for contract limits
|
||||
string_treeview_helper_color_player_contract_normal darkgreen
|
||||
string_treeview_helper_color_player_contract_below1 darkorange
|
||||
string_treeview_helper_color_player_contract_below2 orangered
|
||||
string_treeview_helper_color_player_contract_below3 red
|
||||
|
||||
# colours for cskill in wrong position
|
||||
string_treeview_helper_color_player_bad_cskill_bg lightblue
|
||||
string_treeview_helper_color_player_bad_cskill_fg red
|
||||
|
||||
# fixture list colours
|
||||
# the header, e.g. 'champions' league round robin'
|
||||
string_treeview_fixture_header_bg lightgrey
|
||||
string_treeview_fixture_header_fg black
|
||||
|
||||
# team of current user
|
||||
string_treeview_current_user_bg darkblue
|
||||
string_treeview_current_user_fg white
|
||||
|
||||
# teams of other users
|
||||
string_treeview_user_bg wheat
|
||||
string_treeview_user_fg black
|
||||
|
||||
# background of the team and league/cup symbols
|
||||
string_treeview_symbol_bg lightgrey
|
||||
|
||||
# background for the teams in a table
|
||||
string_treeview_table_first tomato
|
||||
string_treeview_table_promotion lightblue
|
||||
string_treeview_table_relegation lightgreen
|
||||
string_treeview_table_promgames khaki
|
||||
string_treeview_table_best_advance khaki
|
||||
string_treeview_table_cup lightblue
|
||||
|
||||
# colour for expenses in the finances
|
||||
string_treeview_finances_expenses_fg red
|
||||
|
||||
# background colour of a stadium event in the stats
|
||||
string_treeview_stadium_event_bg orange
|
||||
|
||||
# foregrounds for positive or negative skill difference
|
||||
# in the oppononent info
|
||||
string_treeview_opponent_skill_positive_fg darkred
|
||||
string_treeview_opponent_skill_negative_fg darkgreen
|
||||
|
||||
# background of the home column in the league results
|
||||
string_treeview_league_results_away_bg white
|
||||
string_treeview_league_results_away_fg black
|
||||
|
||||
# foreground of own team bar in the opponent preview
|
||||
string_treeview_opponent_value_colour_fg darkgreen
|
||||
|
||||
|
||||
#############################################
|
||||
# various colours ###########################
|
||||
#############################################
|
||||
|
||||
# live game scale configuration
|
||||
string_game_gui_live_game_scale_color_defend lightblue
|
||||
string_game_gui_live_game_scale_color_midfield khaki
|
||||
string_game_gui_live_game_scale_color_attack gold
|
||||
string_game_gui_live_game_scale_color_chance orange
|
||||
string_game_gui_live_game_scale_color_goal red
|
||||
string_game_gui_live_game_scale_color_miss lightgreen
|
||||
|
||||
# colour indicating ball possession during a live game
|
||||
string_live_game_possession_color darkblue
|
||||
|
||||
|
||||
#############################################
|
||||
# icons in treeviews ########################
|
||||
#############################################
|
||||
|
||||
# meter icons (style, boost) in the main window
|
||||
string_game_gui_style_all_out_attack_icon style_all_atk.png
|
||||
string_game_gui_style_attack_icon style_atk.png
|
||||
string_game_gui_style_balanced_icon style_bal.png
|
||||
string_game_gui_style_defend_icon style_def.png
|
||||
string_game_gui_style_all_out_defend_icon style_all_def.png
|
||||
|
||||
string_game_gui_boost_on_icon boost_on.png
|
||||
string_game_gui_boost_off_icon boost_off.png
|
||||
string_game_gui_boost_anti_icon boost_anti.png
|
||||
|
||||
# icons used in live games
|
||||
string_live_game_event_start_match_icon whistle.png
|
||||
string_live_game_event_lost_possession_icon
|
||||
string_live_game_event_penalty_icon penalty.png
|
||||
string_live_game_event_scoring_chance_icon scoring_chance.png
|
||||
string_live_game_event_goal_icon goal.png
|
||||
string_live_game_event_own_goal_icon own_goal.png
|
||||
string_live_game_event_post_icon post.png
|
||||
string_live_game_event_cross_bar_icon cross_bar.png
|
||||
string_live_game_event_save_icon save.png
|
||||
string_live_game_event_missed_icon miss.png
|
||||
string_live_game_event_foul_icon foul.png
|
||||
string_live_game_event_foul_yellow_icon yellow.png
|
||||
string_live_game_event_send_off_icon red.png
|
||||
string_live_game_event_injury_icon injury.png
|
||||
string_live_game_event_temp_injury_icon injury_temp.png
|
||||
string_live_game_event_stadium_breakdown_icon stadium_brkn.png
|
||||
string_live_game_event_stadium_fire_icon stadium_fire.png
|
||||
string_live_game_event_stadium_riots_icon
|
||||
string_live_game_event_substitution_icon sub.png
|
||||
string_live_game_event_structure_change_icon structure_change.png
|
||||
|
||||
# icons for the league stats view
|
||||
string_treeview_league_stats_off_teams_icon style_all_atk.png
|
||||
string_treeview_league_stats_def_teams_icon style_all_def.png
|
||||
string_treeview_league_stats_scorers_icon scoring_chance.png
|
||||
string_treeview_league_stats_goalies_icon save.png
|
||||
|
||||
# icons for the season history
|
||||
string_treeview_season_hist_league_champions_icon ribbon.png
|
||||
string_treeview_season_hist_cup_champions_icon cup.png
|
||||
|
||||
# icons in the user history view
|
||||
string_treeview_helper_user_history_symbol_start_game_icon
|
||||
string_treeview_helper_user_history_symbol_fire_finances_icon
|
||||
string_treeview_helper_user_history_symbol_fire_failure_icon
|
||||
string_treeview_helper_user_history_symbol_end_season_icon
|
||||
string_treeview_helper_user_history_symbol_win_final_icon cup.png
|
||||
string_treeview_helper_user_history_symbol_lose_final_icon cup2.png
|
||||
string_treeview_helper_user_history_symbol_reach_cup_round_icon ribbon2.png
|
||||
string_treeview_helper_user_history_symbol_job_offer_accepted_icon
|
||||
string_treeview_helper_user_history_symbol_promoted_icon prom.png
|
||||
string_treeview_helper_user_history_symbol_relegated_icon rel.png
|
||||
string_treeview_helper_user_history_symbol_champion_icon ribbon.png
|
||||
|
||||
# arrow icons in the tables
|
||||
string_treeview_table_up_icon table_up.png
|
||||
string_treeview_table_down_icon table_down.png
|
||||
string_treeview_table_stay_icon table_stay.png
|
@ -1,3 +1,8 @@
|
||||
######## Bygfoot constants file. a lot of fine-tuning stuff gets loaded
|
||||
# from here. constants affecting the appearance of the game
|
||||
# can be found in 'bygfoot_app'.
|
||||
#########
|
||||
|
||||
#### float constants get divided by 10000 and loaded as floats
|
||||
#### so we write 5000 if we'd like to have 0.5
|
||||
|
||||
@ -686,160 +691,3 @@ float_contract_scale_factor 300
|
||||
|
||||
# max. number of offers when a new contract is negotiated
|
||||
int_contract_max_offers 3
|
||||
|
||||
#### colours and icons
|
||||
|
||||
# live game scale configuration
|
||||
string_game_gui_live_game_scale_color_defend lightblue
|
||||
string_game_gui_live_game_scale_color_midfield khaki
|
||||
string_game_gui_live_game_scale_color_attack gold
|
||||
string_game_gui_live_game_scale_color_chance orange
|
||||
string_game_gui_live_game_scale_color_goal red
|
||||
string_game_gui_live_game_scale_color_miss lightgreen
|
||||
|
||||
# meter icons (style, boost) in the main window
|
||||
string_game_gui_style_all_out_attack_icon style_all_atk.png
|
||||
string_game_gui_style_attack_icon style_atk.png
|
||||
string_game_gui_style_balanced_icon style_bal.png
|
||||
string_game_gui_style_defend_icon style_def.png
|
||||
string_game_gui_style_all_out_defend_icon style_all_def.png
|
||||
|
||||
string_game_gui_boost_on_icon boost_on.png
|
||||
string_game_gui_boost_off_icon boost_off.png
|
||||
string_game_gui_boost_anti_icon boost_anti.png
|
||||
|
||||
# icons used in live games
|
||||
string_live_game_event_start_match_icon whistle.png
|
||||
string_live_game_event_lost_possession_icon
|
||||
string_live_game_event_penalty_icon penalty.png
|
||||
string_live_game_event_scoring_chance_icon scoring_chance.png
|
||||
string_live_game_event_goal_icon goal.png
|
||||
string_live_game_event_own_goal_icon own_goal.png
|
||||
string_live_game_event_post_icon post.png
|
||||
string_live_game_event_cross_bar_icon cross_bar.png
|
||||
string_live_game_event_save_icon save.png
|
||||
string_live_game_event_missed_icon miss.png
|
||||
string_live_game_event_foul_icon foul.png
|
||||
string_live_game_event_foul_yellow_icon yellow.png
|
||||
string_live_game_event_send_off_icon red.png
|
||||
string_live_game_event_injury_icon injury.png
|
||||
string_live_game_event_temp_injury_icon injury_temp.png
|
||||
string_live_game_event_stadium_breakdown_icon
|
||||
string_live_game_event_stadium_fire_icon
|
||||
string_live_game_event_stadium_riots_icon
|
||||
string_live_game_event_substitution_icon sub.png
|
||||
string_live_game_event_structure_change_icon structure_change.png
|
||||
|
||||
# font attributes for the live game window result.
|
||||
string_treeview_helper_live_game_result_attributes weight='bold' size='large'
|
||||
|
||||
# colours of the live game commentary for the away team
|
||||
string_treeview_live_game_commentary_away_fg black
|
||||
string_treeview_live_game_commentary_away_bg lightgrey
|
||||
|
||||
# colour indicating ball possession during a live game
|
||||
string_live_game_possession_color darkblue
|
||||
|
||||
# icons for the league stats view
|
||||
string_treeview_league_stats_off_teams_icon style_all_atk.png
|
||||
string_treeview_league_stats_def_teams_icon style_all_def.png
|
||||
string_treeview_league_stats_scorers_icon scoring_chance.png
|
||||
string_treeview_league_stats_goalies_icon save.png
|
||||
|
||||
# icons for the season history
|
||||
string_treeview_season_hist_league_champions_icon
|
||||
string_treeview_season_hist_cup_champions_icon
|
||||
|
||||
# icons in the user history view
|
||||
string_treeview_helper_user_history_symbol_start_game_icon
|
||||
string_treeview_helper_user_history_symbol_fire_finances_icon
|
||||
string_treeview_helper_user_history_symbol_fire_failure_icon
|
||||
string_treeview_helper_user_history_symbol_end_season_icon
|
||||
string_treeview_helper_user_history_symbol_win_final_icon
|
||||
string_treeview_helper_user_history_symbol_lose_final_icon
|
||||
string_treeview_helper_user_history_symbol_reach_cup_round_icon
|
||||
string_treeview_helper_user_history_symbol_job_offer_accepted_icon
|
||||
string_treeview_helper_user_history_symbol_promoted_icon
|
||||
string_treeview_helper_user_history_symbol_relegated_icon
|
||||
string_treeview_helper_user_history_symbol_champion_icon
|
||||
|
||||
# arrow icons in the tables
|
||||
string_treeview_table_up_icon table_up.png
|
||||
string_treeview_table_down_icon table_down.png
|
||||
string_treeview_table_stay_icon table_stay.png
|
||||
|
||||
# default background and foreground in treeviews
|
||||
string_treeview_helper_color_default_background white
|
||||
string_treeview_helper_color_default_foreground black
|
||||
|
||||
# player list colours
|
||||
string_treeview_helper_color_player_pos_goalie_bg black
|
||||
string_treeview_helper_color_player_pos_goalie_fg white
|
||||
string_treeview_helper_color_player_pos_defender_bg darkgreen
|
||||
string_treeview_helper_color_player_pos_defender_fg white
|
||||
string_treeview_helper_color_player_pos_midfielder_bg darkblue
|
||||
string_treeview_helper_color_player_pos_midfielder_fg white
|
||||
string_treeview_helper_color_player_pos_forward_bg darkred
|
||||
string_treeview_helper_color_player_pos_forward_fg white
|
||||
|
||||
string_treeview_helper_color_player_injury lightgreen
|
||||
string_treeview_helper_color_player_banned red
|
||||
string_treeview_helper_color_player_yellow_danger yellow
|
||||
|
||||
string_treeview_helper_color_player_fitness_normal darkgreen
|
||||
string_treeview_helper_color_player_fitness_below1 darkorange
|
||||
string_treeview_helper_color_player_fitness_below2 orangered
|
||||
string_treeview_helper_color_player_fitness_below3 red
|
||||
|
||||
string_treeview_helper_color_player_contract_normal darkgreen
|
||||
# see also the int constants for contract limits
|
||||
string_treeview_helper_color_player_contract_below1 darkorange
|
||||
string_treeview_helper_color_player_contract_below2 orangered
|
||||
string_treeview_helper_color_player_contract_below3 red
|
||||
|
||||
# colours for cskill in wrong position
|
||||
string_treeview_helper_color_player_bad_cskill_bg lightblue
|
||||
string_treeview_helper_color_player_bad_cskill_fg red
|
||||
|
||||
# fixture list colours
|
||||
# the header, e.g. 'champions' league round robin'
|
||||
string_treeview_fixture_header_bg lightgrey
|
||||
string_treeview_fixture_header_fg black
|
||||
|
||||
# team of current user
|
||||
string_treeview_current_user_bg darkblue
|
||||
string_treeview_current_user_fg white
|
||||
|
||||
# teams of other users
|
||||
string_treeview_user_bg wheat
|
||||
string_treeview_user_fg black
|
||||
|
||||
# background of the team and league/cup symbols
|
||||
string_treeview_symbol_bg lightgrey
|
||||
|
||||
# background for the teams in a table
|
||||
string_treeview_table_first tomato
|
||||
string_treeview_table_promotion lightblue
|
||||
string_treeview_table_relegation lightgreen
|
||||
string_treeview_table_promgames khaki
|
||||
string_treeview_table_best_advance khaki
|
||||
string_treeview_table_cup lightblue
|
||||
|
||||
# colour for expenses in the finances
|
||||
string_treeview_finances_expenses_fg red
|
||||
|
||||
# background colour of a stadium event in the stats
|
||||
string_treeview_stadium_event_bg orange
|
||||
|
||||
# foregrounds for positive or negative skill difference
|
||||
# in the oppononent info
|
||||
string_treeview_opponent_skill_positive_fg darkred
|
||||
string_treeview_opponent_skill_negative_fg darkgreen
|
||||
|
||||
# background of the home column in the league results
|
||||
string_treeview_league_results_away_bg white
|
||||
string_treeview_league_results_away_fg black
|
||||
|
||||
# foreground of own team bar in the opponent preview
|
||||
string_treeview_opponent_value_colour_fg darkgreen
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user