1
1
mirror of https://github.com/tstellar/bygfoot.git synced 2025-03-13 17:20:08 +01:00

Load/save, id bug.

This commit is contained in:
gyboth 2005-04-05 22:10:18 +00:00
parent b7159723a2
commit 899295d9c2
18 changed files with 96 additions and 300 deletions

View File

@ -120,7 +120,7 @@
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.05</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">5</property>
@ -133,137 +133,40 @@
</child>
<child>
<widget class="GtkHBox" id="hbox44">
<widget class="GtkCombo" id="combo_country">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child>
<widget class="GtkCombo" id="combo_country">
<child internal-child="entry">
<widget class="GtkEntry" id="combo_country_entry">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo_country_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
<signal name="changed" handler="on_combo_country_entry_changed" last_modification_time="Thu, 09 Dec 2004 12:48:36 GMT"/>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="combo-list1">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVSeparator" id="vseparator17">
<property name="width_request">15</property>
<property name="height_request">1</property>
<property name="visible">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_select_country_file">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Choose a custom country file (see Help)</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<signal name="clicked" handler="on_button_select_country_file_clicked" last_modification_time="Mon, 05 Apr 2004 12:58:12 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment14">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkHBox" id="hbox45">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image45">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label70">
<property name="visible">True</property>
<property name="label" translatable="yes">Select a country file</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
<signal name="changed" handler="on_combo_country_entry_changed" last_modification_time="Thu, 09 Dec 2004 12:48:36 GMT"/>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="combo-list1">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
<packing>
<property name="padding">2</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>

View File

@ -17,7 +17,7 @@ bygfoot_SOURCES = \
fixture.c cup.h fixture.h free.h league.h main.h maths.h misc.h table.h team.h variables.h \
free.c free.h user.h variables.h \
game.c cup.h finance.h fixture.h game.h game_gui.h league.h live_game.h maths.h misc.h option.h player.h table.h team.h treeview.h user.h variables.h \
game_gui.c file.h game_gui.h gui.h league.h live_game.h maths.h misc.h option.h treeview.h support.h team.h user.h variables.h window.h \
game_gui.c file.h callbacks.h file.h game_gui.h gui.h league.h live_game.h maths.h misc.h option.h treeview.h support.h team.h user.h variables.h window.h \
gui.c gui.h misc.h support.h variables.h window.h \
interface.c callbacks.h interface.h support.h \
league.c cup.h league.h table.h team.h variables.h \
@ -26,7 +26,7 @@ bygfoot_SOURCES = \
main.c misc_callbacks.h file.h free.h live_game.h main.h transfer_struct.h variables.h window.h \
maths.c maths.h misc.h \
misc.c main.h maths.h misc.h \
misc_callbacks.c callbacks.h callback_func.h game.h game_gui.h live_game.h load_save.h main.h misc_callback_func.h misc_callbacks.h option.h user.h variables.h window.h \
misc_callbacks.c callbacks.h callback_func.h game.h game_gui.h live_game.h load_save.h main.h misc_callback_func.h misc_callbacks.h option.h user.h variables.h window.h xml_name.h \
misc_callback_func.c misc_callback_func.h start_end.h support.h team.h treeview.h user.h variables.h xml_country.h \
misc_interface.c misc_interface.h misc_callbacks.h support.h \
misc2_callbacks.c finance.h game_gui.h main.h misc2_callbacks.h misc2_callback_func.h misc2_interface.h player.h support.h transfer.h treeview.h user.h window.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 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 game_gui.h gui.h league.h live_game.h main.h maths.h start_end.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 game_gui.h gui.h league.h live_game.h main.h maths.h option.h start_end.h table.h team.h transfer.h user.h variables.h xml_name.h \
support.c support.h \
table.c cup.h league.h table.h variables.h \
team.c cup.h fixture.h game.h game_gui.h league.h maths.h misc.h option.h player.h team.h transfer.h user.h \

View File

@ -31,9 +31,6 @@
#define ID_LEAGUE_START 1000
#define ID_CUP_START 2000
/** The player names file. */
#define PLAYER_NAMES_FILE "player_names.xml"
/** Convenience abbreviation. */
#define ligs country.leagues
/** Convenience abbreviation. */

View File

@ -74,6 +74,7 @@ enum Status0Value
STATUS_SHOW_PREVIEW,
STATUS_SAVE_GAME,
STATUS_LOAD_GAME,
STATUS_LOAD_GAME_TEAM_SELECTION,
STATUS_END
};

View File

@ -422,7 +422,7 @@ file_load_user_conf_file(User *user)
sprintf(buf, "bygfoot_%s.conf", user->name->str);
conf_file = file_find_support_file(buf);
if(conf_file == NULL ||
!file_my_fopen(conf_file, "r", &fil, FALSE))
{

View File

@ -38,34 +38,11 @@ fixture_new(void)
void
fixture_write_league_fixtures(League *league)
{
/*d*/
gint i;
Fixture *fix = NULL;
GPtrArray *teams = NULL;
teams = team_get_pointers_from_array(league->teams);
fixture_write_round_robin((gpointer)league, -1, teams);
/*d*/
/* printf("\n%s\n", league->name->str); */
/* for(i=0;i<league->fixtures->len;i++) */
/* { */
/* fix = &g_array_index(league->fixtures, Fixture, i); */
/* if(i > 0 && */
/* g_array_index(league->fixtures, Fixture, i).week_number != */
/* g_array_index(league->fixtures, Fixture, i - 1).week_number) */
/* printf("\nweek %d\n", g_array_index(league->fixtures, Fixture, i).week_number); */
/* printf("%s -- %s round %d week %d wr %d res %d %d home %d sec %d dec %d\n", */
/* fix->teams[0]->name->str, fix->teams[1]->name->str, */
/* fix->round, */
/* fix->week_number, fix->week_round_number, */
/* fix->result[0][0], fix->result[1][0], */
/* fix->home_advantage, fix->second_leg, */
/* fix->decisive); */
/* } */
}
/** Write the fixtures for the given cup
@ -74,9 +51,6 @@ fixture_write_league_fixtures(League *league)
void
fixture_write_cup_fixtures(Cup *cup)
{
/*d*/
gint i;
Fixture *fix = NULL;
GPtrArray *teams = NULL;
if(g_array_index(cup->rounds, CupRound, 0).
@ -91,27 +65,6 @@ fixture_write_cup_fixtures(Cup *cup)
fixture_write_knockout_round(cup, 0, teams);
}
/*d*/
/* printf("\n%s\n", cup->name->str); */
/* for(i=0;i<cup->fixtures->len;i++) */
/* { */
/* fix = &g_array_index(cup->fixtures, Fixture, i); */
/* if(i > 0 && */
/* g_array_index(cup->fixtures, Fixture, i).week_number != */
/* g_array_index(cup->fixtures, Fixture, i - 1).week_number) */
/* printf("\nweek %d\n", g_array_index(cup->fixtures, Fixture, i).week_number); */
/* printf("%2d %s -- %s round %d week %d wr %d res %d %d home %d sec %d dec %d\n", i, */
/* fix->teams[0]->name->str, */
/* fix->teams[1]->name->str, */
/* fix->round, */
/* fix->week_number, fix->week_round_number, */
/* fix->result[0][0], fix->result[1][0], */
/* fix->home_advantage, fix->second_leg, */
/* fix->decisive); */
/* } */
}
/** Update the fixtures for the given cup.
@ -320,6 +273,7 @@ fixture_update_write_replays(Cup *cup)
return_value = (g_array_index(fixtures, Fixture, fixtures->len - 1).replay_number == replay_number);
/*d*/
printf("retval %d\n", return_value);
return return_value;
}

View File

@ -285,11 +285,14 @@ game_initialize(Fixture *fix)
if(i == 1 || !fix->home_advantage)
usr(user_idx[i]).money_out[1][MON_OUT_JOURNEY] -=
(gint)(finance_wage_unit(fix->teams[i]) * journey_factor);
if(!fix->home_advantage)
{
usr(user_idx[i]).money_in[1][MON_IN_TICKET] += (gint)rint((gfloat)ticket_income / 2);
usr(user_idx[i]).money += (gint)rint((gfloat)ticket_income / 2);
}
usr(user_idx[i]).counters[COUNT_USER_SHOW_RES] = 1;
}
}
}

View File

@ -1,5 +1,6 @@
#include <unistd.h>
#include "callbacks.h"
#include "file.h"
#include "game_gui.h"
#include "gui.h"
@ -313,7 +314,14 @@ game_gui_show_main(void)
{
game_gui_set_main_window_header();
treeview_show_user_player_list();
treeview_show_next_opponent();
if(current_user.counters[COUNT_USER_SHOW_RES])
{
on_menu_user_show_last_stats_activate(NULL, NULL);
current_user.counters[COUNT_USER_SHOW_RES] = 0;
}
else
treeview_show_next_opponent();
}
/** Print a message into the main window entry. */

View File

@ -76,7 +76,7 @@ live_game_create_unit(void)
{
LiveGameUnit new;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_create_unit\n");
if(unis->len == 0)
{
@ -127,7 +127,7 @@ live_game_fill_new_unit(LiveGameUnit *new)
gfloat possession_change, scoring_chance = 0,
injury_event_prob, foul_event_prob;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_fill_new_unit\n");
possession_change = const_float("float_live_game_event_general") *
@ -185,7 +185,7 @@ live_game_create_start_unit(void)
{
LiveGameUnit new;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_create_start_unit\n");
new.event.values[LIVE_GAME_EVENT_VALUE_PLAYER] =
new.event.values[LIVE_GAME_EVENT_VALUE_PLAYER2] = -1;
@ -215,7 +215,7 @@ live_game_evaluate_unit(LiveGameUnit *unit)
{
gint type = unit->event.type;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_evaluate_unit type %d\n", type);
if(type == LIVE_GAME_EVENT_FOUL)
live_game_event_foul();
@ -257,7 +257,7 @@ live_game_event_foul(void)
gfloat rndom = math_rnd(0, 1);
gint type, fouled_player, foul_player, foul_team;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_foul\n");
if(math_rnd(0, 1) > const_float("float_live_game_foul_by_possession") *
game_get_foul_possession_factor(
@ -331,7 +331,7 @@ live_game_event_foul(void)
void
live_game_event_lost_possession(void)
{
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_lost_possession\n");
last_unit.event.values[LIVE_GAME_EVENT_VALUE_PLAYER] =
game_get_player(tm[last_unit.possession],
@ -345,7 +345,7 @@ live_game_event_lost_possession(void)
game_get_player(tm[!last_unit.possession],
uni(unis->len - 2).area, 0, -1, FALSE);
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("## pls %d %d\n",
last_unit.event.values[LIVE_GAME_EVENT_VALUE_PLAYER],
last_unit.event.values[LIVE_GAME_EVENT_VALUE_PLAYER2]);
@ -367,7 +367,7 @@ live_game_event_injury(gint team, gint player, gboolean create_new)
LiveGameUnit new;
gint old_structure = -1;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_injury\n");
if(create_new)
{
@ -450,7 +450,7 @@ live_game_event_stadium(void)
for(i=1;i<3;i++)
probs[i] += probs[i - 1];
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_stadium\n");
if(rndom <= probs[0])
last_unit.event.type = LIVE_GAME_EVENT_STADIUM_BREAKDOWN;
@ -480,7 +480,7 @@ live_game_event_scoring_chance(void)
else
res_idx = 0;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_scoring_chance\n");
if(math_rnd(0, 1) < const_float("float_live_game_scoring_chance_is_own_goal"))
@ -534,7 +534,7 @@ live_game_event_penalty(void)
{
LiveGameUnit new;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_penalty\n");
if(last_unit.time != LIVE_GAME_UNIT_TIME_PENALTIES)
@ -602,7 +602,7 @@ live_game_event_general(gboolean create_new)
{
LiveGameUnit new;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_general\n");
if(create_new)
{
@ -629,7 +629,7 @@ live_game_event_general(gboolean create_new)
last_unit.event.type == LIVE_GAME_EVENT_CROSS_BAR) &&
math_rnd(0, 1) < const_float("float_live_game_possession_after_post")))
{
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("##### last type: %d\n", last_unit.event.type);
new.possession = last_unit.possession;
new.area = (last_unit.event.type == LIVE_GAME_EVENT_GENERAL) ?
@ -670,7 +670,7 @@ live_game_event_general(gboolean create_new)
live_game_event_general_get_players();
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("+++ general %d %d\n",
last_unit.event.values[LIVE_GAME_EVENT_VALUE_PLAYER],
last_unit.event.values[LIVE_GAME_EVENT_VALUE_PLAYER2]);
@ -688,7 +688,7 @@ live_game_event_general_get_players(void)
uni(unis->len - 2).event.values[LIVE_GAME_EVENT_VALUE_PLAYER];
gint type = uni(unis->len - 2).event.type;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_general_get_players\n");
*pl1 = *pl2 = -1;
@ -721,7 +721,7 @@ live_game_event_free_kick(void)
{
LiveGameUnit new = last_unit;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_free_kick\n");
new.event.values[LIVE_GAME_EVENT_VALUE_PLAYER] =
new.event.values[LIVE_GAME_EVENT_VALUE_PLAYER2] = -1;
@ -758,7 +758,7 @@ live_game_event_send_off(gint team, gint player, gboolean second_yellow)
LiveGameUnit new = last_unit;
gint substitute = -1, to_substitute = -1;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_send_off\n");
new.event.values[LIVE_GAME_EVENT_VALUE_PLAYER] =
new.event.values[LIVE_GAME_EVENT_VALUE_PLAYER2] = -1;
@ -882,7 +882,7 @@ live_game_event_duel(void)
Player *attacker, *goalie;
gint res_idx1, res_idx2;
if(opt_int("int_opt_debug"))
if(opt_int("int_opt_debug") > 100)
printf("live_game_event_duel\n");
new.minute = -1;

View File

@ -17,41 +17,12 @@
void
misc_callback_show_team_list(GtkWidget *widget, const gchar *country_file)
{
gint i,j;
GtkWidget *treeview_startup =
lookup_widget(widget, "treeview_startup");
xml_country_read(country_file);
treeview_show_team_list(GTK_TREE_VIEW(treeview_startup), FALSE, FALSE);
/*d*/
/* for(i=0;i<cps->len;i++) */
/* { */
/* printf("** %d **\n", i); */
/* printf("name %s short_name %s symbol %s id %s\n", cp(i).name->str, cp(i).short_name->str, cp(i).symbol->str, cp(i).sid->str); */
/* printf("nid %d type %d last %d gap %d skilldiff %d cap %d\n", cp(i).id, cp(i).type, cp(i).last_week, cp(i).week_gap, cp(i).skill_diff, cp(i).average_capacity); */
/* for(j=0;j<cp(i).rounds->len;j++) */
/* printf("%d homeaway %d repl %d neutr %d groups %d adv %d best %d\n", j, */
/* g_array_index(cp(i).rounds, CupRound, j).home_away, */
/* g_array_index(cp(i).rounds, CupRound, j).replay, */
/* g_array_index(cp(i).rounds, CupRound, j).neutral, */
/* g_array_index(cp(i).rounds, CupRound, j).round_robin_number_of_groups, */
/* g_array_index(cp(i).rounds, CupRound, j).round_robin_number_of_advance, */
/* g_array_index(cp(i).rounds, CupRound, j).round_robin_number_of_best_advance); */
/* printf("\n"); */
/* for(j=0;j<cp(i).choose_teams->len;j++) */
/* printf("%d id %s num %d start %d end %d rand %d\n", j, */
/* g_array_index(cp(i).choose_teams, CupChooseTeam, j).sid->str, */
/* g_array_index(cp(i).choose_teams, CupChooseTeam, j).number_of_teams, */
/* g_array_index(cp(i).choose_teams, CupChooseTeam, j).start_idx, */
/* g_array_index(cp(i).choose_teams, CupChooseTeam, j).end_idx, */
/* g_array_index(cp(i).choose_teams, CupChooseTeam, j).randomly); */
/* printf("\n"); */
/* } */
}
/** Start a new game after users and teams are selected. */
@ -123,15 +94,18 @@ misc_callback_add_player(void)
void
misc_callback_remove_user(GdkEventButton *event)
{
GtkTreeView *treeview =
GtkTreeView *treeview_users =
GTK_TREE_VIEW(lookup_widget(window.startup, "treeview_users"));
GtkTreeView *treeview_startup =
GTK_TREE_VIEW(lookup_widget(window.startup, "treeview_startup"));
if(!treeview_select_row(treeview, event))
if(!treeview_select_row(treeview_users, event))
return;
user_remove(treeview_get_index(treeview, 0) - 1, FALSE);
user_remove(treeview_get_index(treeview_users, 0) - 1, FALSE);
treeview_show_users(treeview);
treeview_show_users(treeview_users);
treeview_show_team_list(treeview_startup, FALSE, FALSE);
if(users->len == 0)
{

View File

@ -12,6 +12,7 @@
#include "user.h"
#include "variables.h"
#include "window.h"
#include "xml_name.h"
void
on_button_add_player_clicked (GtkButton *button,
@ -64,7 +65,8 @@ void
on_team_selection_load_clicked (GtkButton *button,
gpointer user_data)
{
stat1 = STATUS_LOAD_GAME_TEAM_SELECTION;
window_show_file_sel();
}
@ -90,14 +92,18 @@ on_button_fsel_ok_clicked (GtkButton *button,
load_save_save_game(filename);
else if(stat1 == STATUS_LOAD_GAME)
{
if(!g_file_test(filename, G_FILE_TEST_EXISTS))
game_gui_show_warning("File not found.");
else
{
load_save_load_game(filename);
cur_user = 0;
on_button_back_to_main_clicked(NULL, NULL);
}
load_save_load_game(filename);
cur_user = 0;
on_button_back_to_main_clicked(NULL, NULL);
}
else if(stat1 == STATUS_LOAD_GAME_TEAM_SELECTION)
{
window_destroy(&window.startup, TRUE);
window_create(WINDOW_MAIN);
xml_name_read(opt_str("string_opt_player_names_file"), 1000);
load_save_load_game(filename);
cur_user = 0;
on_button_back_to_main_clicked(NULL, NULL);
}
window_destroy(&window.file_sel, FALSE);
@ -251,7 +257,6 @@ on_treeview_users_button_press_event (GtkWidget *widget,
{
misc_callback_remove_user(event);
return FALSE;
}

View File

@ -39,15 +39,8 @@ create_window_startup (void)
GtkWidget *hseparator10;
GtkWidget *vbox34;
GtkWidget *label69;
GtkWidget *hbox44;
GtkWidget *combo_country;
GtkWidget *combo_country_entry;
GtkWidget *vseparator17;
GtkWidget *button_select_country_file;
GtkWidget *alignment14;
GtkWidget *hbox45;
GtkWidget *image45;
GtkWidget *label70;
GtkWidget *hseparator11;
GtkWidget *label4;
GtkWidget *eventbox1;
@ -140,49 +133,17 @@ create_window_startup (void)
gtk_widget_show (label69);
gtk_box_pack_start (GTK_BOX (vbox34), label69, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label69), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (label69), 0.05, 0.5);
gtk_misc_set_padding (GTK_MISC (label69), 0, 5);
hbox44 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox44);
gtk_box_pack_start (GTK_BOX (vbox34), hbox44, TRUE, TRUE, 0);
combo_country = gtk_combo_new ();
g_object_set_data (G_OBJECT (GTK_COMBO (combo_country)->popwin),
"GladeParentKey", combo_country);
gtk_widget_show (combo_country);
gtk_box_pack_start (GTK_BOX (hbox44), combo_country, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox34), combo_country, FALSE, FALSE, 0);
combo_country_entry = GTK_COMBO (combo_country)->entry;
gtk_widget_show (combo_country_entry);
vseparator17 = gtk_vseparator_new ();
gtk_widget_show (vseparator17);
gtk_box_pack_start (GTK_BOX (hbox44), vseparator17, FALSE, FALSE, 0);
gtk_widget_set_size_request (vseparator17, 15, 1);
button_select_country_file = gtk_button_new ();
gtk_widget_show (button_select_country_file);
gtk_box_pack_start (GTK_BOX (hbox44), button_select_country_file, TRUE, TRUE, 2);
gtk_tooltips_set_tip (tooltips, button_select_country_file, _("Choose a custom country file (see Help)"), NULL);
alignment14 = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_widget_show (alignment14);
gtk_container_add (GTK_CONTAINER (button_select_country_file), alignment14);
hbox45 = gtk_hbox_new (FALSE, 2);
gtk_widget_show (hbox45);
gtk_container_add (GTK_CONTAINER (alignment14), hbox45);
image45 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
gtk_widget_show (image45);
gtk_box_pack_start (GTK_BOX (hbox45), image45, FALSE, FALSE, 0);
label70 = gtk_label_new_with_mnemonic (_("Select a country file"));
gtk_widget_show (label70);
gtk_box_pack_start (GTK_BOX (hbox45), label70, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (label70), GTK_JUSTIFY_LEFT);
hseparator11 = gtk_hseparator_new ();
gtk_widget_show (hseparator11);
gtk_box_pack_start (GTK_BOX (vbox2), hseparator11, FALSE, FALSE, 0);
@ -366,9 +327,6 @@ create_window_startup (void)
g_signal_connect ((gpointer) combo_country_entry, "changed",
G_CALLBACK (on_combo_country_entry_changed),
NULL);
g_signal_connect ((gpointer) button_select_country_file, "clicked",
G_CALLBACK (on_button_select_country_file_clicked),
NULL);
g_signal_connect ((gpointer) entry_player_name, "activate",
G_CALLBACK (on_entry_player_name_activate),
NULL);
@ -396,15 +354,8 @@ create_window_startup (void)
GLADE_HOOKUP_OBJECT (window_startup, hseparator10, "hseparator10");
GLADE_HOOKUP_OBJECT (window_startup, vbox34, "vbox34");
GLADE_HOOKUP_OBJECT (window_startup, label69, "label69");
GLADE_HOOKUP_OBJECT (window_startup, hbox44, "hbox44");
GLADE_HOOKUP_OBJECT (window_startup, combo_country, "combo_country");
GLADE_HOOKUP_OBJECT (window_startup, combo_country_entry, "combo_country_entry");
GLADE_HOOKUP_OBJECT (window_startup, vseparator17, "vseparator17");
GLADE_HOOKUP_OBJECT (window_startup, button_select_country_file, "button_select_country_file");
GLADE_HOOKUP_OBJECT (window_startup, alignment14, "alignment14");
GLADE_HOOKUP_OBJECT (window_startup, hbox45, "hbox45");
GLADE_HOOKUP_OBJECT (window_startup, image45, "image45");
GLADE_HOOKUP_OBJECT (window_startup, label70, "label70");
GLADE_HOOKUP_OBJECT (window_startup, hseparator11, "hseparator11");
GLADE_HOOKUP_OBJECT (window_startup, label4, "label4");
GLADE_HOOKUP_OBJECT (window_startup, eventbox1, "eventbox1");

View File

@ -85,7 +85,7 @@ player_new_id(const GArray *players)
break;
if(j == players->len)
return j;
return i;
}
return -1;

View File

@ -8,6 +8,7 @@
#include "live_game.h"
#include "main.h"
#include "maths.h"
#include "option.h"
#include "start_end.h"
#include "table.h"
#include "team.h"
@ -43,11 +44,11 @@ WeekFunc end_week_funcs[] = {NULL};
void
start_new_game(void)
{
xml_name_read(PLAYER_NAMES_FILE, -1);
xml_name_read(opt_str("string_opt_player_names_file"), -1);
start_write_variables();
start_generate_league_teams();
start_new_season();
xml_name_read(PLAYER_NAMES_FILE, 1000);
xml_name_read(opt_str("string_opt_player_names_file"), 1000);
}
/** Make new fixtures, nullify things etc. */
@ -56,7 +57,7 @@ start_new_season(void)
{
gint i;
xml_name_read(PLAYER_NAMES_FILE, 1000);
xml_name_read(opt_str("string_opt_player_names_file"), 1000);
start_load_cup_teams();
for(i=0;i<ligs->len;i++)

View File

@ -205,6 +205,9 @@ transfer_evaluate_offers(void)
player_of(transoff(i, idx).tm, transoff(i, idx).tm->players->len - 1)->contract =
(gfloat)math_rndi(const_int("int_transfer_contract_lower"),
const_int("int_transfer_contract_upper"));
player_of(transoff(i, idx).tm, transoff(i, idx).tm->players->len - 1)->id = -1;
player_of(transoff(i, idx).tm, transoff(i, idx).tm->players->len - 1)->id =
player_new_id(transoff(i, idx).tm->players);
user_from_team(transoff(i, idx).tm)->money -= transoff(i, idx).fee;
user_from_team(transoff(i, idx).tm)->money_out[1][MON_OUT_TRANSFERS] -=
transoff(i, idx).fee;

View File

@ -44,11 +44,7 @@ enum CounterValue
COUNT_USER_INC_SAF, /**< How often the stadium safety was increased (in a week). */
COUNT_USER_STADIUM_CAPACITY, /**< Counter for building stadium seats. */
COUNT_USER_STADIUM_SAFETY, /**< Counter for increasing stadium safety. */
COUNT_USER_OLD_WAGE1,
COUNT_USER_OLD_WAGE2,
COUNT_USER_OLD_WAGE3,
COUNT_USER_OLD_WAGE4,
COUNT_USER_OLD_WAGE5,
COUNT_USER_SHOW_RES, /**< Whether the latest result is shown when the main window gets refreshed. */
COUNT_USER_END
};

View File

@ -25,7 +25,7 @@ int_opt_debug 0
string_opt_player_names_file player_names.xml
string_opt_constants_file bygfoot_constants
string_opt_default_user_conf_file bygfoot_user.conf
string_opt_player_names_file player_names.xml
# font name; if empty, the default system font's used
string_opt_font_name

View File

@ -31,7 +31,7 @@
<choose_team_sid>league1</choose_team_sid>
<number_of_teams>3</number_of_teams>
<start_idx>2</start_idx>
<end_idx>7</end_idx>
<end_idx>5</end_idx>
</choose_team_user>
<choose_teams>