mirror of
https://github.com/tstellar/bygfoot.git
synced 2025-01-28 14:39:22 +01:00
Possibility to specify table in choose_team.
This commit is contained in:
parent
2c84d539c0
commit
83908c2c8d
@ -1,8 +1,8 @@
|
||||
06/12/2008: v2.3.1
|
||||
- updated Chinese translations
|
||||
- updated the way team definitions are handled
|
||||
- updated Romanian translation
|
||||
- added Multiple tables for leagues feature
|
||||
- added Multiple tables for leagues feature
|
||||
- added joined leagues feature (think conferences in US sports)
|
||||
- Solved some minor bugs
|
||||
|
||||
06/11/2008: v2.3.0
|
||||
|
19
src/cup.c
19
src/cup.c
@ -86,6 +86,7 @@ cup_choose_team_new(void)
|
||||
new.randomly = FALSE;
|
||||
new.generate = FALSE;
|
||||
new.skip_group_check = FALSE;
|
||||
new.from_table = 0;
|
||||
|
||||
return new;
|
||||
}
|
||||
@ -392,19 +393,21 @@ cup_load_choose_team_from_league(Cup *cup, const League *league,
|
||||
gint start, end;
|
||||
gint number_of_teams;
|
||||
gint j;
|
||||
Table *table;
|
||||
|
||||
number_of_teams = 0;
|
||||
table = &g_array_index(league->tables, Table, ct->from_table);
|
||||
|
||||
if(ct->number_of_teams == -1)
|
||||
{
|
||||
for(j=0;j<league_table(league)->elements->len;j++)
|
||||
for(j=0;j<table->elements->len;j++)
|
||||
{
|
||||
g_ptr_array_add(
|
||||
teams, team_of_id(
|
||||
g_array_index(league_table(league)->elements, TableElement, j).team_id));
|
||||
g_array_index(table->elements, TableElement, j).team_id));
|
||||
g_ptr_array_add(
|
||||
cup->team_names,
|
||||
g_strdup(team_of_id(g_array_index(league_table(league)->elements, TableElement, j).team_id)->name));
|
||||
g_strdup(team_of_id(g_array_index(table->elements, TableElement, j).team_id)->name));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -423,23 +426,23 @@ cup_load_choose_team_from_league(Cup *cup, const League *league,
|
||||
{
|
||||
if(debug > 80)
|
||||
g_print("team %s isinint %d numteams %d\n",
|
||||
team_of_id(g_array_index(league_table(league)->elements,
|
||||
team_of_id(g_array_index(table->elements,
|
||||
TableElement, order[j]).team_id)->name,
|
||||
query_team_is_in_cups(
|
||||
team_of_id(g_array_index(league_table(league)->elements,
|
||||
team_of_id(g_array_index(table->elements,
|
||||
TableElement, order[j]).team_id),
|
||||
cup->group),
|
||||
number_of_teams);
|
||||
|
||||
if(ct->skip_group_check ||
|
||||
!query_team_is_in_cups(
|
||||
team_of_id(g_array_index(league_table(league)->elements, TableElement, order[j]).team_id), cup->group))
|
||||
team_of_id(g_array_index(table->elements, TableElement, order[j]).team_id), cup->group))
|
||||
{
|
||||
g_ptr_array_add(teams,
|
||||
team_of_id(g_array_index(league_table(league)->elements, TableElement, order[j]).team_id));
|
||||
team_of_id(g_array_index(table->elements, TableElement, order[j]).team_id));
|
||||
g_ptr_array_add(
|
||||
cup->team_names,
|
||||
g_strdup(team_of_id(g_array_index(league_table(league)->elements, TableElement, order[j]).team_id)->name));
|
||||
g_strdup(team_of_id(g_array_index(table->elements, TableElement, order[j]).team_id)->name));
|
||||
number_of_teams++;
|
||||
|
||||
if(number_of_teams == ct->number_of_teams)
|
||||
|
@ -101,6 +101,10 @@ typedef struct
|
||||
/** The number of teams chosen.
|
||||
Default: -1 (ie. all teams are chosen). */
|
||||
gint number_of_teams;
|
||||
/** Which league table to use. Only relevant
|
||||
for leagues which use more than one table during
|
||||
the season. Default is 0, ie. the cumulative table. */
|
||||
gint from_table;
|
||||
/** The range from which the teams are chosen,
|
||||
e.g. 2 and 5 means the teams from 2 to 5 are chosen
|
||||
(given that 'number_of_teams' is 4).
|
||||
|
@ -55,9 +55,9 @@ language_set(gint index)
|
||||
if(strcmp(buf, opt_str("string_opt_language_code")) != 0 ||
|
||||
window.main == NULL)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
sprintf(buf2, "%s%slocale", pwd, G_DIR_SEPARATOR_S);
|
||||
g_free(pwd);
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
if(g_file_test(buf2, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
bindtextdomain (GETTEXT_PACKAGE, buf2);
|
||||
@ -83,7 +83,7 @@ language_set(gint index)
|
||||
}
|
||||
|
||||
lg_commentary_load_commentary_file_from_option();
|
||||
|
||||
g_free(pwd);
|
||||
free_gchar_array(&codes);
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,7 @@
|
||||
#define TAG_CHOOSE_TEAM_RANDOMLY "randomly"
|
||||
#define TAG_CHOOSE_TEAM_GENERATE "generate"
|
||||
#define TAG_CHOOSE_TEAM_SKIP_GROUP_CHECK "skip_group_check"
|
||||
#define TAG_CHOOSE_TEAM_FROM_TABLE "from_table"
|
||||
|
||||
/**
|
||||
* Enum with the states used in the XML parser functions.
|
||||
@ -112,6 +113,7 @@ enum XmlCupStates
|
||||
STATE_CHOOSE_TEAM_RANDOMLY,
|
||||
STATE_CHOOSE_TEAM_GENERATE,
|
||||
STATE_CHOOSE_TEAM_SKIP_GROUP_CHECK,
|
||||
STATE_CHOOSE_TEAM_FROM_TABLE,
|
||||
STATE_END
|
||||
};
|
||||
|
||||
@ -220,6 +222,8 @@ xml_cup_read_start_element (GMarkupParseContext *context,
|
||||
state = STATE_CHOOSE_TEAM_GENERATE;
|
||||
else if(strcmp(element_name, TAG_CHOOSE_TEAM_SKIP_GROUP_CHECK) == 0)
|
||||
state = STATE_CHOOSE_TEAM_SKIP_GROUP_CHECK;
|
||||
else if(strcmp(element_name, TAG_CHOOSE_TEAM_FROM_TABLE) == 0)
|
||||
state = STATE_CHOOSE_TEAM_FROM_TABLE;
|
||||
else
|
||||
g_warning("xml_cup_read_start_element: unknown tag: %s; I'm in state %d\n",
|
||||
element_name, state);
|
||||
@ -280,6 +284,7 @@ xml_cup_read_end_element (GMarkupParseContext *context,
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_END_IDX) == 0 ||
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_RANDOMLY) == 0 ||
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_SKIP_GROUP_CHECK) == 0 ||
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_FROM_TABLE) == 0 ||
|
||||
strcmp(element_name, TAG_CHOOSE_TEAM_GENERATE) == 0)
|
||||
state = STATE_CHOOSE_TEAM;
|
||||
else if(strcmp(element_name, TAG_CUP) != 0)
|
||||
@ -373,6 +378,8 @@ xml_cup_read_text (GMarkupParseContext *context,
|
||||
new_choose_team.generate = int_value;
|
||||
else if(state == STATE_CHOOSE_TEAM_SKIP_GROUP_CHECK)
|
||||
new_choose_team.skip_group_check = int_value;
|
||||
else if(state == STATE_CHOOSE_TEAM_FROM_TABLE)
|
||||
new_choose_team.from_table = int_value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,6 +50,7 @@ enum
|
||||
TAG_CUP_CHOOSE_TEAM_RANDOMLY,
|
||||
TAG_CUP_CHOOSE_TEAM_GENERATE,
|
||||
TAG_CUP_CHOOSE_TEAM_SKIP_GROUP_CHECK,
|
||||
TAG_CUP_CHOOSE_TEAM_FROM_TABLE,
|
||||
TAG_CUP_ROUND,
|
||||
TAG_CUP_ROUND_NEW_TEAMS,
|
||||
TAG_CUP_ROUND_BYES,
|
||||
@ -157,6 +158,7 @@ xml_loadsave_cup_end_element (GMarkupParseContext *context,
|
||||
tag == TAG_CUP_CHOOSE_TEAM_SID ||
|
||||
tag == TAG_CUP_CHOOSE_TEAM_GENERATE ||
|
||||
tag == TAG_CUP_CHOOSE_TEAM_SKIP_GROUP_CHECK ||
|
||||
tag == TAG_CUP_CHOOSE_TEAM_FROM_TABLE ||
|
||||
tag == TAG_CUP_CHOOSE_TEAM_RANDOMLY)
|
||||
state = TAG_CUP_CHOOSE_TEAM;
|
||||
else if(tag == TAG_CUP_ROUND_HOME_AWAY ||
|
||||
@ -246,6 +248,8 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
|
||||
new_choose_team.generate = int_value;
|
||||
else if(state == TAG_CUP_CHOOSE_TEAM_SKIP_GROUP_CHECK)
|
||||
new_choose_team.skip_group_check = int_value;
|
||||
else if(state == TAG_CUP_CHOOSE_TEAM_FROM_TABLE)
|
||||
new_choose_team.from_table = int_value;
|
||||
else if(state == TAG_CUP_ROUND_HOME_AWAY)
|
||||
new_round.home_away = int_value;
|
||||
else if(state == TAG_CUP_ROUND_NEW_TEAMS)
|
||||
@ -478,6 +482,8 @@ xml_loadsave_cup_write_choose_team(FILE *fil, const CupChooseTeam *choose_team)
|
||||
TAG_CUP_CHOOSE_TEAM_GENERATE, I2);
|
||||
xml_write_int(fil, choose_team->skip_group_check,
|
||||
TAG_CUP_CHOOSE_TEAM_SKIP_GROUP_CHECK, I2);
|
||||
xml_write_int(fil, choose_team->from_table,
|
||||
TAG_CUP_CHOOSE_TEAM_FROM_TABLE, I2);
|
||||
|
||||
fprintf(fil, "%s</_%d>\n", I1, TAG_CUP_CHOOSE_TEAM);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user