2004-12-30 17:48:19 +01:00
|
|
|
#include "cup.h"
|
2005-01-09 21:21:22 +01:00
|
|
|
#include "file.h"
|
2005-03-16 21:48:25 +01:00
|
|
|
#include "finance.h"
|
2004-12-30 17:48:19 +01:00
|
|
|
#include "fixture.h"
|
2005-04-13 15:01:59 +02:00
|
|
|
#include "free.h"
|
2005-03-16 21:48:25 +01:00
|
|
|
#include "game_gui.h"
|
2005-03-10 21:59:39 +01:00
|
|
|
#include "gui.h"
|
2004-12-30 17:48:19 +01:00
|
|
|
#include "league.h"
|
2005-03-03 13:46:48 +01:00
|
|
|
#include "live_game.h"
|
2005-04-07 18:44:33 +02:00
|
|
|
#include "load_save.h"
|
2004-12-30 17:48:19 +01:00
|
|
|
#include "main.h"
|
|
|
|
#include "maths.h"
|
2005-04-06 00:10:18 +02:00
|
|
|
#include "option.h"
|
2004-12-30 17:48:19 +01:00
|
|
|
#include "start_end.h"
|
2005-03-03 13:46:48 +01:00
|
|
|
#include "table.h"
|
2004-12-30 17:48:19 +01:00
|
|
|
#include "team.h"
|
|
|
|
#include "transfer.h"
|
2005-03-03 13:46:48 +01:00
|
|
|
#include "user.h"
|
2004-12-30 17:48:19 +01:00
|
|
|
#include "variables.h"
|
|
|
|
#include "xml_name.h"
|
|
|
|
|
2005-03-03 13:46:48 +01:00
|
|
|
/** Prototype of a function called at the start or
|
|
|
|
end of a week round. */
|
|
|
|
typedef void(*WeekFunc)(void);
|
|
|
|
|
|
|
|
/** Array of functions called when a week round
|
|
|
|
is ended. */
|
|
|
|
WeekFunc end_week_round_funcs[] =
|
2005-04-13 15:01:59 +02:00
|
|
|
{end_week_round_results, end_week_round_sort_tables,
|
2005-03-03 13:46:48 +01:00
|
|
|
end_week_round_update_fixtures, NULL};
|
|
|
|
|
|
|
|
/** Array of functions called when a week round
|
|
|
|
is started. */
|
|
|
|
WeekFunc start_week_round_funcs[] =
|
2005-04-13 15:01:59 +02:00
|
|
|
{start_week_round_update_user_teams , NULL};
|
2005-03-03 13:46:48 +01:00
|
|
|
|
|
|
|
/** Array of functions called when a week
|
|
|
|
is started. */
|
2005-03-16 21:48:25 +01:00
|
|
|
WeekFunc start_week_funcs[] =
|
|
|
|
{start_week_update_users, start_week_update_user_teams,
|
2005-03-19 21:04:08 +01:00
|
|
|
start_week_update_user_finances, transfer_update, NULL};
|
2005-03-13 16:46:15 +01:00
|
|
|
|
|
|
|
WeekFunc end_week_funcs[] = {NULL};
|
2005-03-03 13:46:48 +01:00
|
|
|
|
2004-12-30 17:48:19 +01:00
|
|
|
/** Generate the teams etc. */
|
|
|
|
void
|
|
|
|
start_new_game(void)
|
|
|
|
{
|
2005-04-06 00:10:18 +02:00
|
|
|
xml_name_read(opt_str("string_opt_player_names_file"), -1);
|
2005-01-09 21:21:22 +01:00
|
|
|
start_write_variables();
|
2004-12-30 17:48:19 +01:00
|
|
|
start_generate_league_teams();
|
|
|
|
start_new_season();
|
2005-04-06 00:10:18 +02:00
|
|
|
xml_name_read(opt_str("string_opt_player_names_file"), 1000);
|
2004-12-30 17:48:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Make new fixtures, nullify things etc. */
|
|
|
|
void
|
|
|
|
start_new_season(void)
|
|
|
|
{
|
2005-01-09 21:21:22 +01:00
|
|
|
gint i;
|
|
|
|
|
2005-04-13 15:01:59 +02:00
|
|
|
xml_name_read(opt_str("string_opt_player_names_file"), 1000);
|
|
|
|
|
2005-04-10 18:34:27 +02:00
|
|
|
week = week_round = 1;
|
|
|
|
|
2005-04-13 15:01:59 +02:00
|
|
|
/*todo: nullify, promotion/relegation*/
|
|
|
|
if(season > 1)
|
2005-04-15 15:55:59 +02:00
|
|
|
{
|
2005-04-13 15:01:59 +02:00
|
|
|
start_new_season_team_movements();
|
|
|
|
|
2005-04-15 15:55:59 +02:00
|
|
|
for(i=0;i<users->len;i++)
|
|
|
|
usr(i).tm = team_of_id(usr(i).team_id);
|
|
|
|
}
|
2005-01-09 21:21:22 +01:00
|
|
|
|
|
|
|
for(i=0;i<ligs->len;i++)
|
2005-04-13 15:01:59 +02:00
|
|
|
{
|
2005-04-15 15:55:59 +02:00
|
|
|
if(season > 1)
|
|
|
|
league_season_start(&lig(i));
|
2005-01-09 21:21:22 +01:00
|
|
|
fixture_write_league_fixtures(&lig(i));
|
2005-04-13 15:01:59 +02:00
|
|
|
}
|
2005-01-09 21:21:22 +01:00
|
|
|
|
2005-04-15 15:55:59 +02:00
|
|
|
start_load_cup_teams();
|
|
|
|
|
2005-04-14 21:07:25 +02:00
|
|
|
for(i=acps->len - 1;i >= 0;i--)
|
2005-04-13 15:01:59 +02:00
|
|
|
{
|
2005-04-14 21:07:25 +02:00
|
|
|
if(acp(i)->id >= ID_PROM_CUP_START)
|
|
|
|
g_ptr_array_remove_index(acps, i);
|
2005-04-13 15:01:59 +02:00
|
|
|
else
|
|
|
|
fixture_write_cup_fixtures(&cp(i));
|
|
|
|
}
|
2004-12-30 17:48:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Fill some global variables with default values at the
|
|
|
|
beginning of a new game. */
|
|
|
|
void
|
|
|
|
start_write_variables(void)
|
|
|
|
{
|
2005-01-09 21:21:22 +01:00
|
|
|
gint i;
|
|
|
|
|
2005-04-10 18:34:27 +02:00
|
|
|
season = 1;
|
2005-03-18 23:03:23 +01:00
|
|
|
cur_user = 0;
|
2005-04-10 13:13:19 +02:00
|
|
|
|
|
|
|
/*d*/
|
2005-03-08 09:25:46 +01:00
|
|
|
/* week=24; week_round = 2; */
|
2005-03-03 13:46:48 +01:00
|
|
|
|
|
|
|
for(i=0;i<users->len;i++)
|
|
|
|
file_load_user_conf_file(&usr(i));
|
2004-12-30 17:48:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Generate the teams in the leagues. */
|
|
|
|
void
|
|
|
|
start_generate_league_teams(void)
|
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
|
|
|
|
if(ligs->len == 0)
|
2005-01-09 21:21:22 +01:00
|
|
|
main_exit_program(EXIT_NO_LEAGUES,
|
|
|
|
"start_generate_league_teams: no leagues found. there must be at least one league in the game.\n");
|
2004-12-30 17:48:19 +01:00
|
|
|
|
|
|
|
for(i=0;i<ligs->len;i++)
|
|
|
|
for(j=0;j<lig(i).teams->len;j++)
|
2005-03-15 16:10:57 +01:00
|
|
|
team_generate_players_stadium(&g_array_index(lig(i).teams, Team, j));
|
2004-12-30 17:48:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Load the names from the xml files for the cups
|
|
|
|
and generate the teams. */
|
|
|
|
void
|
|
|
|
start_load_cup_teams(void)
|
|
|
|
{
|
2005-04-04 12:36:04 +02:00
|
|
|
gint i;
|
2004-12-30 17:48:19 +01:00
|
|
|
|
|
|
|
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));
|
2005-03-03 13:46:48 +01:00
|
|
|
}
|
|
|
|
}
|
2004-12-30 17:48:19 +01:00
|
|
|
|
2005-03-03 13:46:48 +01:00
|
|
|
/** End a week round. */
|
|
|
|
void
|
|
|
|
end_week_round(void)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gboolean new_week = TRUE;
|
|
|
|
WeekFunc *end_func = end_week_round_funcs;
|
|
|
|
|
|
|
|
while(*end_func != NULL)
|
|
|
|
{
|
|
|
|
(*end_func)();
|
|
|
|
end_func++;
|
|
|
|
}
|
|
|
|
|
|
|
|
week_round++;
|
|
|
|
|
|
|
|
for(i=0;i<ligs->len;i++)
|
|
|
|
if(query_fixture_in_week_round(lig(i).id, week, week_round))
|
|
|
|
{
|
|
|
|
new_week = FALSE;
|
|
|
|
break;
|
2004-12-30 17:48:19 +01:00
|
|
|
}
|
2005-03-03 13:46:48 +01:00
|
|
|
|
2005-04-14 21:07:25 +02:00
|
|
|
for(i=0;i<acps->len;i++)
|
|
|
|
if(query_fixture_in_week_round(acp(i)->id, week, week_round))
|
2005-03-03 13:46:48 +01:00
|
|
|
{
|
|
|
|
new_week = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(new_week)
|
|
|
|
{
|
2005-04-13 15:01:59 +02:00
|
|
|
if(query_start_end_season_end())
|
|
|
|
{
|
|
|
|
season++;
|
|
|
|
week = 1;
|
|
|
|
|
|
|
|
start_new_season();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
week++;
|
2005-03-03 13:46:48 +01:00
|
|
|
|
2005-04-13 15:01:59 +02:00
|
|
|
week_round = 1;
|
2005-03-03 13:46:48 +01:00
|
|
|
start_week();
|
|
|
|
}
|
|
|
|
|
|
|
|
start_week_round();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Calculate the match results of a week round. */
|
|
|
|
void
|
|
|
|
end_week_round_results(void)
|
|
|
|
{
|
2005-03-14 18:47:27 +01:00
|
|
|
gint i, j, done = 0;
|
|
|
|
gchar buf[SMALL], buf2[SMALL];
|
|
|
|
gfloat num_matches =
|
|
|
|
(gfloat)fixture_get_number_of_matches(week, week_round);
|
2005-04-09 21:18:28 +02:00
|
|
|
|
2005-04-13 15:01:59 +02:00
|
|
|
for(i=0;i<ligs->len;i++)
|
|
|
|
if(week_round == 1)
|
|
|
|
{
|
2005-03-03 13:46:48 +01:00
|
|
|
for(j=0;j<lig(i).fixtures->len;j++)
|
|
|
|
if(g_array_index(lig(i).fixtures, Fixture, j).week_number == week &&
|
|
|
|
g_array_index(lig(i).fixtures, Fixture, j).week_round_number == week_round &&
|
|
|
|
g_array_index(lig(i).fixtures, Fixture, j).attendance == -1)
|
|
|
|
{
|
|
|
|
live_game_calculate_fixture(&g_array_index(lig(i).fixtures, Fixture, j));
|
2005-04-09 21:18:28 +02:00
|
|
|
|
2005-03-14 18:47:27 +01:00
|
|
|
done++;
|
|
|
|
fixture_result_to_buf(&g_array_index(lig(i).fixtures, Fixture, j), buf);
|
|
|
|
sprintf(buf2, "%s %s %s",
|
|
|
|
g_array_index(lig(i).fixtures, Fixture, j).teams[0]->name->str,
|
|
|
|
buf,
|
|
|
|
g_array_index(lig(i).fixtures, Fixture, j).teams[1]->name->str);
|
|
|
|
gui_show_progress((gfloat)done / num_matches, buf2);
|
2005-03-03 13:46:48 +01:00
|
|
|
}
|
2005-04-13 15:01:59 +02:00
|
|
|
}
|
|
|
|
|
2005-04-14 21:07:25 +02:00
|
|
|
for(i=0;i<acps->len;i++)
|
|
|
|
if(week_round > 1 || query_cup_is_prom(acp(i)->id))
|
2005-04-13 15:01:59 +02:00
|
|
|
{
|
2005-04-14 21:07:25 +02:00
|
|
|
for(j=0;j<acp(i)->fixtures->len;j++)
|
2005-04-13 15:01:59 +02:00
|
|
|
{
|
2005-04-14 21:07:25 +02:00
|
|
|
if(g_array_index(acp(i)->fixtures, Fixture, j).week_number == week &&
|
|
|
|
g_array_index(acp(i)->fixtures, Fixture, j).week_round_number == week_round &&
|
|
|
|
g_array_index(acp(i)->fixtures, Fixture, j).attendance == -1)
|
2005-03-03 13:46:48 +01:00
|
|
|
{
|
2005-04-14 21:07:25 +02:00
|
|
|
live_game_calculate_fixture(&g_array_index(acp(i)->fixtures, Fixture, j));
|
2005-04-09 21:18:28 +02:00
|
|
|
|
2005-03-14 18:47:27 +01:00
|
|
|
done++;
|
2005-04-14 21:07:25 +02:00
|
|
|
fixture_result_to_buf(&g_array_index(acp(i)->fixtures, Fixture, j), buf);
|
2005-03-14 18:47:27 +01:00
|
|
|
sprintf(buf2, "%s %s %s",
|
2005-04-14 21:07:25 +02:00
|
|
|
g_array_index(acp(i)->fixtures, Fixture, j).teams[0]->name->str,
|
2005-03-14 18:47:27 +01:00
|
|
|
buf,
|
2005-04-14 21:07:25 +02:00
|
|
|
g_array_index(acp(i)->fixtures, Fixture, j).teams[1]->name->str);
|
2005-03-14 18:47:27 +01:00
|
|
|
gui_show_progress((gfloat)done / num_matches, buf2);
|
2005-03-03 13:46:48 +01:00
|
|
|
}
|
2005-04-13 15:01:59 +02:00
|
|
|
}
|
|
|
|
}
|
2005-03-13 22:10:19 +01:00
|
|
|
|
2005-03-14 18:47:27 +01:00
|
|
|
gui_show_progress(-1, "");
|
2005-03-03 13:46:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Sort league and cup tables. */
|
|
|
|
void
|
|
|
|
end_week_round_sort_tables(void)
|
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
|
|
|
|
for(i=0;i<ligs->len;i++)
|
|
|
|
if(query_fixture_in_week_round(lig(i).id, week, week_round))
|
|
|
|
g_array_sort_with_data(lig(i).table.elements,
|
|
|
|
(GCompareDataFunc)table_element_compare_func,
|
|
|
|
GINT_TO_POINTER(lig(i).id));
|
|
|
|
|
2005-04-14 21:07:25 +02:00
|
|
|
for(i=0;i<acps->len;i++)
|
|
|
|
if(acp(i)->tables != NULL && acp(i)->tables->len != 0 &&
|
|
|
|
query_fixture_in_week_round(acp(i)->id, week, week_round) &&
|
|
|
|
g_array_index(acp(i)->fixtures, Fixture, acp(i)->fixtures->len - 1).round ==
|
|
|
|
g_array_index(acp(i)->tables, Table, 0).round)
|
|
|
|
for(j=0;j<acp(i)->tables->len;j++)
|
|
|
|
g_array_sort_with_data(g_array_index(acp(i)->tables, Table, j).elements,
|
2005-03-03 13:46:48 +01:00
|
|
|
(GCompareDataFunc)table_element_compare_func,
|
2005-04-14 21:07:25 +02:00
|
|
|
GINT_TO_POINTER(acp(i)->id));
|
2005-03-03 13:46:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Update cup fixtures. */
|
|
|
|
void
|
|
|
|
end_week_round_update_fixtures(void)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
2005-04-14 21:07:25 +02:00
|
|
|
for(i=0;i<acps->len;i++)
|
|
|
|
if(acp(i)->next_fixture_update_week == week &&
|
|
|
|
acp(i)->next_fixture_update_week_round == week_round)
|
|
|
|
fixture_update(acp(i));
|
|
|
|
|
2005-04-13 15:01:59 +02:00
|
|
|
for(i=0;i<ligs->len;i++)
|
2005-04-14 21:07:25 +02:00
|
|
|
if(league_has_prom_games((&lig(i))) &&
|
2005-04-13 15:01:59 +02:00
|
|
|
query_league_prom_games_begin(&lig(i)))
|
|
|
|
{
|
2005-04-14 21:07:25 +02:00
|
|
|
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);
|
2005-04-13 15:01:59 +02:00
|
|
|
}
|
|
|
|
|
2005-04-14 21:07:25 +02:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
2005-03-03 13:46:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Start a new week round. */
|
|
|
|
void
|
|
|
|
start_week_round(void)
|
|
|
|
{
|
|
|
|
WeekFunc *start_func = start_week_round_funcs;
|
|
|
|
|
|
|
|
while(*start_func != NULL)
|
|
|
|
{
|
|
|
|
(*start_func)();
|
|
|
|
start_func++;
|
|
|
|
}
|
2005-03-13 16:46:15 +01:00
|
|
|
|
2005-04-14 21:07:25 +02:00
|
|
|
if(/*d*/FALSE && !query_user_games_this_week_round() &&
|
2005-04-15 15:55:59 +02:00
|
|
|
((week_round == 1 &&
|
|
|
|
!query_user_games_in_week_round(week - 1, fixture_get_last_week_round(week - 1))) ||
|
|
|
|
(week_round > 1 &&
|
|
|
|
!query_user_games_in_week_round(week, week_round - 1))))
|
2005-03-16 21:48:25 +01:00
|
|
|
end_week_round();
|
2005-03-18 23:03:23 +01:00
|
|
|
else
|
|
|
|
{
|
2005-04-14 21:07:25 +02:00
|
|
|
cur_user = 0;
|
|
|
|
game_gui_show_main();
|
|
|
|
|
2005-04-07 18:44:33 +02:00
|
|
|
/*d ??*/
|
|
|
|
/* if(week_round == 1) */
|
2005-03-18 23:03:23 +01:00
|
|
|
user_event_show_next();
|
|
|
|
}
|
2005-03-03 13:46:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Start a new week. */
|
|
|
|
void
|
|
|
|
start_week(void)
|
|
|
|
{
|
|
|
|
WeekFunc *start_func = start_week_funcs;
|
|
|
|
|
|
|
|
while(*start_func != NULL)
|
|
|
|
{
|
|
|
|
(*start_func)();
|
|
|
|
start_func++;
|
|
|
|
}
|
2004-12-30 17:48:19 +01:00
|
|
|
}
|
2005-03-13 16:46:15 +01:00
|
|
|
|
2005-03-14 10:29:39 +01:00
|
|
|
/** Age increase etc. of players.
|
2005-03-13 16:46:15 +01:00
|
|
|
CPU teams get updated at the end of their matches
|
|
|
|
(to avoid cup teams getting updated too often). */
|
|
|
|
void
|
|
|
|
start_week_update_user_teams(void)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for(i=0;i<users->len;i++)
|
|
|
|
team_update_user_team_weekly(usr(i).tm);
|
|
|
|
}
|
2005-03-14 10:29:39 +01:00
|
|
|
|
|
|
|
/** Do some things at the beginning of each new round for
|
|
|
|
the user teams. */
|
|
|
|
void
|
|
|
|
start_week_round_update_user_teams(void)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for(i=0;i<users->len;i++)
|
|
|
|
team_update_user_team_week_roundly(usr(i).tm);
|
|
|
|
}
|
2005-03-16 21:48:25 +01:00
|
|
|
|
|
|
|
/** Deduce wages etc. */
|
|
|
|
void
|
|
|
|
start_week_update_user_finances(void)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for(i=0;i<users->len;i++)
|
|
|
|
finance_update_user_weekly(&usr(i));
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Some general user update. */
|
|
|
|
void
|
|
|
|
start_week_update_users(void)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for(i=0;i<users->len;i++)
|
|
|
|
{
|
|
|
|
if(usr(i).scout >= 100)
|
|
|
|
usr(i).scout = math_get_place(usr(i).scout, 2);
|
|
|
|
|
|
|
|
if(usr(i).physio >= 100)
|
|
|
|
usr(i).physio = math_get_place(usr(i).physio, 2);
|
2005-03-17 21:26:01 +01:00
|
|
|
|
|
|
|
user_weekly_update_counters(&usr(i));
|
2005-03-16 21:48:25 +01:00
|
|
|
}
|
|
|
|
}
|
2005-04-07 18:44:33 +02:00
|
|
|
|
2005-04-13 15:01:59 +02:00
|
|
|
/** Check whether the season has ended. */
|
|
|
|
gboolean
|
|
|
|
query_start_end_season_end(void)
|
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
|
|
|
|
for(i=0;i<ligs->len;i++)
|
|
|
|
for(j=0;j<lig(i).fixtures->len;j++)
|
|
|
|
if(g_array_index(lig(i).fixtures, Fixture, j).week_number > week)
|
|
|
|
return FALSE;
|
|
|
|
|
2005-04-14 21:07:25 +02:00
|
|
|
for(i=0;i<acps->len;i++)
|
|
|
|
for(j=0;j<acp(i)->fixtures->len;j++)
|
|
|
|
if(g_array_index(acp(i)->fixtures, Fixture, j).week_number > week)
|
2005-04-13 15:01:59 +02:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Manage promotions and relegations at the beginning of a new season. */
|
2005-04-07 18:44:33 +02:00
|
|
|
void
|
2005-04-13 15:01:59 +02:00
|
|
|
start_new_season_team_movements(void)
|
2005-04-07 18:44:33 +02:00
|
|
|
{
|
2005-04-13 15:01:59 +02:00
|
|
|
gint i, j, k;
|
|
|
|
GArray *team_movements = g_array_new(FALSE, FALSE, sizeof(TeamMove));
|
|
|
|
|
|
|
|
for(i=0;i<ligs->len;i++)
|
|
|
|
league_get_team_movements(&lig(i), team_movements);
|
|
|
|
|
|
|
|
for(i=0;i<team_movements->len;i++)
|
|
|
|
g_array_append_val(lig(g_array_index(team_movements, TeamMove, i).league_idx).teams,
|
|
|
|
g_array_index(team_movements, TeamMove, i).tm);
|
2005-04-07 18:44:33 +02:00
|
|
|
|
2005-04-13 15:01:59 +02:00
|
|
|
g_array_free(team_movements, TRUE);
|
2005-04-14 21:07:25 +02:00
|
|
|
|
2005-04-13 15:01:59 +02:00
|
|
|
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;
|
|
|
|
for(k=0;k<g_array_index(lig(i).teams, Team, j).players->len;k++)
|
|
|
|
g_array_index(g_array_index(lig(i).teams, Team, j).players, Player, k).team =
|
|
|
|
&g_array_index(lig(i).teams, Team, j);
|
|
|
|
}
|
|
|
|
}
|
2005-04-07 18:44:33 +02:00
|
|
|
}
|