diff --git a/bygfoot.glade b/bygfoot.glade index 01069a79..21de3828 100644 --- a/bygfoot.glade +++ b/bygfoot.glade @@ -68,7 +68,7 @@ - + True gtk-revert-to-saved 1 @@ -136,7 +136,7 @@ - + True gtk-preferences 1 @@ -200,7 +200,7 @@ - + True menu_save_geometry.png 0.5 @@ -234,7 +234,7 @@ - + True menu_fixtures.png 0.5 @@ -255,7 +255,7 @@ - + True menu_fixtures_comp.png 0.5 @@ -276,7 +276,7 @@ - + True menu_table.png 0.5 @@ -297,7 +297,7 @@ - + True menu_league_results.png 0.5 @@ -318,7 +318,7 @@ - + True menu_season_res.png 0.5 @@ -345,7 +345,7 @@ - + True menu_league_stats.png 0.5 @@ -366,7 +366,7 @@ - + True menu_history.png 0.5 @@ -398,7 +398,7 @@ True - + True menu_style.png 0.5 @@ -416,7 +416,7 @@ True All Out Defend True - True + False @@ -426,7 +426,7 @@ True Defend True - True + False menu_all_out_defend @@ -437,7 +437,7 @@ True Balanced True - True + False menu_all_out_defend @@ -448,7 +448,7 @@ True Attack True - True + False menu_all_out_defend @@ -476,7 +476,7 @@ True - + True menu_scout.png 0.5 @@ -494,7 +494,7 @@ True Best True - True + False @@ -504,7 +504,7 @@ True Good True - True + False menu_scout_best @@ -515,7 +515,7 @@ True Average True - True + False menu_scout_best @@ -543,7 +543,7 @@ True - + True menu_physio.png 0.5 @@ -561,7 +561,7 @@ True Best True - True + False @@ -571,7 +571,7 @@ True Good True - True + False menu_physio_best @@ -582,7 +582,7 @@ True Average True - True + False menu_physio_best @@ -610,7 +610,7 @@ True - + True menu_youth_academy.png 0.5 @@ -647,7 +647,7 @@ True Best True - True + False @@ -657,7 +657,7 @@ True Good True - True + False menu_yc_best @@ -668,7 +668,7 @@ True Average True - True + False menu_yc_best @@ -703,7 +703,7 @@ True Goalies True - True + False @@ -713,7 +713,7 @@ True Defenders True - True + False menu_recruit0 @@ -724,7 +724,7 @@ True Midfielders True - True + False menu_recruit0 @@ -735,7 +735,7 @@ True Forwards True - True + False menu_recruit0 @@ -777,7 +777,7 @@ True - + True menu_boost.png 0.5 @@ -795,7 +795,7 @@ True On True - True + False @@ -805,7 +805,7 @@ True Off True - True + False menu_boost_on @@ -840,7 +840,7 @@ - + True gtk-undo 1 @@ -861,7 +861,7 @@ - + True menu_structure.png 0.5 @@ -883,7 +883,7 @@ - + True menu_rearrange.png 0.5 @@ -909,7 +909,7 @@ - + True menu_browse_tms.png 0.5 @@ -920,6 +920,23 @@ + + + + True + + + + + + True + Show the list of available manager jobs + Show job exchange + True + + + + @@ -942,7 +959,7 @@ - + True menu_player_info.png 0.5 @@ -962,7 +979,7 @@ - + True menu_player_put_transfer.png 0.5 @@ -982,7 +999,7 @@ - + True menu_player_remove_transfer.png 0.5 @@ -1002,7 +1019,7 @@ - + True menu_player_contract.png 0.5 @@ -1022,7 +1039,7 @@ - + True menu_player_fire.png 0.5 @@ -1042,7 +1059,7 @@ - + True menu_player_shoots.png 0.5 @@ -1062,7 +1079,7 @@ - + True menu_player_move_to_ya.png 0.5 @@ -1088,7 +1105,7 @@ - + True menu_player_browse.png 0.5 @@ -1122,7 +1139,7 @@ - + True menu_last_match.png 0.5 @@ -1143,7 +1160,7 @@ - + True menu_match_stats.png 0.5 @@ -1164,7 +1181,7 @@ - + True gtk-jump-to 1 @@ -1184,7 +1201,7 @@ True - + True menu_mmatches.png 0.5 @@ -1207,7 +1224,7 @@ - + True gtk-add 1 @@ -1230,7 +1247,7 @@ - + True gtk-preferences 1 @@ -1262,7 +1279,7 @@ - + True menu_history.png 0.5 @@ -1289,7 +1306,7 @@ - + True gtk-media-forward 1 @@ -1311,7 +1328,7 @@ - + True gtk-go-back 1 @@ -1333,7 +1350,7 @@ - + True gtk-justify-fill 1 @@ -1368,7 +1385,7 @@ - + True menu_finances.png 0.5 @@ -1389,7 +1406,7 @@ - + True menu_stadium.png 0.5 @@ -1439,7 +1456,7 @@ - + True gtk-dialog-info 1 @@ -1460,7 +1477,7 @@ - + True gtk-add 1 @@ -1481,7 +1498,7 @@ - + True gtk-help 1 @@ -2266,6 +2283,7 @@ True True 470 + diff --git a/bygfoot_misc2.glade b/bygfoot_misc2.glade index b88e6711..c548fe8a 100644 --- a/bygfoot_misc2.glade +++ b/bygfoot_misc2.glade @@ -9,7 +9,8 @@ Job offer GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER - False + True + 500 600 True False diff --git a/locale/bg/LC_MESSAGES/bygfoot.mo b/locale/bg/LC_MESSAGES/bygfoot.mo index d0daddc2..94ddc8bc 100644 Binary files a/locale/bg/LC_MESSAGES/bygfoot.mo and b/locale/bg/LC_MESSAGES/bygfoot.mo differ diff --git a/locale/da/LC_MESSAGES/bygfoot.mo b/locale/da/LC_MESSAGES/bygfoot.mo index b0141d0b..3b9e70ff 100644 Binary files a/locale/da/LC_MESSAGES/bygfoot.mo and b/locale/da/LC_MESSAGES/bygfoot.mo differ diff --git a/locale/de/LC_MESSAGES/bygfoot.mo b/locale/de/LC_MESSAGES/bygfoot.mo index dbc53087..4bd9e895 100644 Binary files a/locale/de/LC_MESSAGES/bygfoot.mo and b/locale/de/LC_MESSAGES/bygfoot.mo differ diff --git a/locale/es/LC_MESSAGES/bygfoot.mo b/locale/es/LC_MESSAGES/bygfoot.mo index d6582f31..c33c93be 100644 Binary files a/locale/es/LC_MESSAGES/bygfoot.mo and b/locale/es/LC_MESSAGES/bygfoot.mo differ diff --git a/locale/fr/LC_MESSAGES/bygfoot.mo b/locale/fr/LC_MESSAGES/bygfoot.mo index 40f71154..6051feaa 100644 Binary files a/locale/fr/LC_MESSAGES/bygfoot.mo and b/locale/fr/LC_MESSAGES/bygfoot.mo differ diff --git a/locale/nl/LC_MESSAGES/bygfoot.mo b/locale/nl/LC_MESSAGES/bygfoot.mo index 666696a9..849d3adc 100644 Binary files a/locale/nl/LC_MESSAGES/bygfoot.mo and b/locale/nl/LC_MESSAGES/bygfoot.mo differ diff --git a/locale/pl/LC_MESSAGES/bygfoot.mo b/locale/pl/LC_MESSAGES/bygfoot.mo index c2267ab1..9e81f0cd 100644 Binary files a/locale/pl/LC_MESSAGES/bygfoot.mo and b/locale/pl/LC_MESSAGES/bygfoot.mo differ diff --git a/locale/ro/LC_MESSAGES/bygfoot.mo b/locale/ro/LC_MESSAGES/bygfoot.mo index fa051871..133a327a 100644 Binary files a/locale/ro/LC_MESSAGES/bygfoot.mo and b/locale/ro/LC_MESSAGES/bygfoot.mo differ diff --git a/locale/zh/LC_MESSAGES/bygfoot.mo b/locale/zh/LC_MESSAGES/bygfoot.mo index 8fdc904c..6eeabb01 100644 Binary files a/locale/zh/LC_MESSAGES/bygfoot.mo and b/locale/zh/LC_MESSAGES/bygfoot.mo differ diff --git a/src/Makefile.am b/src/Makefile.am index 45733804..34c6973b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,7 +9,6 @@ INCLUDES = \ bin_PROGRAMS = bygfoot bygfoot_SOURCES = \ - mediaplayer.c mediaplayer.h \ bet.c bet.h bet_struct.h \ callback_func.c callback_func.h callbacks.h cup.h finance.h fixture.h game_gui.h gui.h league.h live_game.h maths.h misc.h option.h player.h start_end.h team.h transfer.h treeview.h treeview_helper.h user.h window.h \ callbacks.c callback_func.h callbacks.h debug.h free.h game_gui.h game.h gui.h league.h load_save.h main.h option.h player.h table.h team.h transfer.h treeview2.h treeview.h treeview_helper.h user.h window.h \ @@ -23,6 +22,7 @@ bygfoot_SOURCES = \ game_gui.c callbacks.h file.h game_gui.h gui.h league.h live_game.h maths.h misc.h option.h support.h team.h treeview.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 \ + job.c job.h \ language.c callbacks.h free.h language.h lg_commentary.h misc.h option.h variables.h window.h \ lg_commentary.c cup.h file.h fixture.h free.h league.h lg_commentary.h live_game.h main.h maths.h misc.h option.h player.h team.h variables.h xml_lg_commentary.h \ league.c cup.h free.h league.h main.h maths.h misc.h option.h player.h stat.h table.h team.h user.h variables.h \ @@ -60,6 +60,7 @@ bygfoot_SOURCES = \ xml.c cup.h file.h free.h gui.h league.h misc.h option.h support.h table.h transfer_struct.h user.h variables.h xml.h xml_loadsave_cup.h xml_loadsave_fixtures.h xml_loadsave_league.h xml_loadsave_league_stat.h xml_loadsave_live_game.h xml_loadsave_table.h xml_loadsave_teams.h xml_loadsave_transfers.h xml_loadsave_users.h \ xml_loadsave_cup.c cup.h file.h misc.h table.h team.h xml.h xml_loadsave_cup.h xml_loadsave_fixtures.h xml_loadsave_table.h xml_loadsave_teams.h \ xml_loadsave_fixtures.c file.h fixture.h misc.h team.h xml.h xml_loadsave_fixtures.h \ + xml_loadsave_jobs.c xml_loadsave_jobs.h \ xml_loadsave_league.c file.h league.h misc.h xml.h xml_loadsave_cup.h xml_loadsave_fixtures.h xml_loadsave_league.h xml_loadsave_league_stat.h xml_loadsave_table.h xml_loadsave_teams.h \ xml_loadsave_leagues_cups.c cup.h file.h free.h league_struct.h misc.h xml.h xml_loadsave_cup.h xml_loadsave_league.h xml_loadsave_leagues_cups.h \ xml_loadsave_league_stat.c file.h misc.h stat.h team.h xml.h xml_loadsave_league_stat.h \ diff --git a/src/bygfoot.h b/src/bygfoot.h index 1d71f0b3..10a6a01d 100644 --- a/src/bygfoot.h +++ b/src/bygfoot.h @@ -127,6 +127,11 @@ typedef struct *symbol, /**< Symbol of the country, eg a flag pixmap. */ *sid; /**< Id of the country, eg 'england'. */ + /** A rating point from 0-10 telling us + how good the first league of the country is. + Spain, for instance, has rating 10, whereas Ireland has only 5. */ + gint rating; + /** Leagues and cups arrays. */ GArray *leagues, *cups; @@ -160,5 +165,8 @@ typedef struct *sponsors, *mmatches, *bets; + + /** The position of the horizontal divider is stored here. */ + gint paned_pos; } Windows; #endif diff --git a/src/callback_func.c b/src/callback_func.c index 9ad522a0..33809a5f 100644 --- a/src/callback_func.c +++ b/src/callback_func.c @@ -101,14 +101,6 @@ callback_player_clicked(gint idx, GdkEventButton *event) if(event->type != GDK_BUTTON_PRESS) return; - /*d*/ - gint i; - for(i=0;ilen;i++) - printf("%d %s %d\n", i, g_array_index(lig(1).teams, - Team, i).name, - g_array_index(lig(1).teams, - Team, i).id); - if(event->button == 1) { if(selected_row == -1) @@ -704,6 +696,9 @@ callback_show_league_stats(gint type) void callback_show_season_history(gint type) { + const SeasonStat *stat = NULL; + gint len = season_stats->len; + switch(type) { default: @@ -712,29 +707,31 @@ callback_show_season_history(gint type) break; case SHOW_CURRENT: stat1 = -1; - stat2 = season - 2; + stat2 = len - 1; break; case SHOW_NEXT_LEAGUE: + stat = &g_array_index(season_stats, SeasonStat, stat2); if(stat1 == -1) stat1 = 0; - else if(stat1 == ligs->len - 1) + else if(stat1 == stat->league_champs->len - 1) stat1 = -1; else stat1++; break; case SHOW_PREVIOUS_LEAGUE: + stat = &g_array_index(season_stats, SeasonStat, stat2); if(stat1 == -1) - stat1 = ligs->len - 1; + stat1 = stat->league_champs->len - 1; else if(stat1 == 0) stat1 = -1; else stat1--; break; case SHOW_NEXT: - stat2 = (stat2 + 1) % (season - 1); + stat2 = (stat2 + 1) % len; break; case SHOW_PREVIOUS: - stat2 = (stat2 == 0) ? season - 2 : stat2 - 1; + stat2 = (stat2 == 0) ? len - 1 : stat2 - 1; break; } diff --git a/src/callbacks.c b/src/callbacks.c index 28ad6a23..b5941410 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -30,6 +30,7 @@ #include "game.h" #include "game_gui.h" #include "gui.h" +#include "job.h" #include "league.h" #include "load_save.h" #include "main.h" @@ -419,9 +420,10 @@ void on_menu_season_history_activate (GtkMenuItem *menuitem, gpointer user_data) { - if(season == 1) + if(season_stats->len == 0) { - game_gui_print_message(_("This is your first season.")); + game_gui_print_message( + _("There are no season history elements stored yet.")); return; } @@ -641,6 +643,12 @@ on_treeview_right_button_press_event (GtkWidget *widget, else window_show_menu_youth((GdkEvent*)event); break; + case STATUS_SHOW_JOB_EXCHANGE: + if(event->button == 1) + game_gui_show_job_offer(NULL, + &g_array_index(jobs, Job, idx - 1), + STATUS_JOB_EXCHANGE_SHOW_TEAM); + break; } gui_set_arrows(); @@ -1185,3 +1193,30 @@ on_menu_betting_activate (GtkMenuItem *menuitem, window_show_bets(); } +void +on_menu_show_job_exchange_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + stat0 = STATUS_SHOW_JOB_EXCHANGE; + + gui_set_arrows(); + + treeview2_show_job_exchange(); + + game_gui_print_message( + _("Right click to apply for job at once, left click to see team info.")); + game_gui_print_message_with_delay( + _("The job exchange update interval is %d weeks."), + const_int("int_job_update_interval")); +} + +gboolean +on_hpaned2_button_release_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data) +{ + window.paned_pos = + gtk_paned_get_position(GTK_PANED(widget)); + + return FALSE; +} diff --git a/src/callbacks.h b/src/callbacks.h index a5c153ae..f0f098d6 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -333,8 +333,14 @@ on_menu_save_window_geometry_activate (GtkMenuItem *menuitem, void on_menu_season_results_activate (GtkMenuItem *menuitem, gpointer user_data); -#endif - void on_menu_betting_activate (GtkMenuItem *menuitem, gpointer user_data); +void +on_menu_show_job_exchange_activate (GtkMenuItem *menuitem, + gpointer user_data); +gboolean +on_hpaned2_button_release_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data); +#endif diff --git a/src/cup.c b/src/cup.c index 159365ec..fcd1d2dc 100644 --- a/src/cup.c +++ b/src/cup.c @@ -257,7 +257,7 @@ cup_get_team_pointers(Cup *cup, gint round) for(i=0;iteams->len;i++) { - team_generate_players_stadium(&g_array_index(cup_round->teams, Team, i)); + team_generate_players_stadium(&g_array_index(cup_round->teams, Team, i), 0); g_ptr_array_add(cup->teams, &g_array_index(cup_round->teams, Team, i)); g_ptr_array_add(teams, &g_array_index(cup_round->teams, Team, i)); } @@ -992,9 +992,10 @@ query_cup_begins(const Cup *cup) g_array_index(league->fixtures, Fixture, league->fixtures->len - 1).attendance == -1)) || (league == NULL && - cup_temp->fixtures->len > 0 && - g_array_index(cup_temp->fixtures, Fixture, - cup_temp->fixtures->len - 1).attendance == -1)) + ((cup_temp->fixtures->len > 0 && + g_array_index(cup_temp->fixtures, Fixture, + cup_temp->fixtures->len - 1).attendance == -1) || + cup_temp->fixtures->len == 0))) return FALSE; } } diff --git a/src/enums.h b/src/enums.h index cbc9c794..1ed6e6b1 100644 --- a/src/enums.h +++ b/src/enums.h @@ -137,6 +137,8 @@ enum Status0Value STATUS_SELECT_MM_FILE_IMPORT, STATUS_SELECT_MM_FILE_EXPORT, STATUS_PLACE_BET, + STATUS_SHOW_JOB_EXCHANGE, + STATUS_JOB_EXCHANGE_SHOW_TEAM, STATUS_END }; diff --git a/src/finance.c b/src/finance.c index f8d98c05..02c5e959 100644 --- a/src/finance.c +++ b/src/finance.c @@ -26,6 +26,7 @@ #include "callbacks.h" #include "finance.h" #include "game_gui.h" +#include "league.h" #include "maths.h" #include "option.h" #include "player.h" @@ -147,8 +148,6 @@ finance_update_user_weekly(User *user) { new_team = team_get_new(tm, TRUE); user_event_add(user, EVENT_TYPE_FIRE_FINANCE, -1, -1, new_team, NULL); - user_history_add(user, USER_HISTORY_FIRE_FINANCES, tm->id, - new_team->id, new_team->clid, ""); } } diff --git a/src/fixture.c b/src/fixture.c index d9dcf089..e2ff5565 100644 --- a/src/fixture.c +++ b/src/fixture.c @@ -67,17 +67,23 @@ fixture_write_cup_fixtures(Cup *cup) { gint i; + printf("fwc 1\n"); + for(i=0;irounds->len;i++) cup_get_team_pointers(cup, i); + printf("fwc 2 %d\n", + g_array_index(cup->rounds, CupRound, 0).round_robin_number_of_groups); if(g_array_index(cup->rounds, CupRound, 0).round_robin_number_of_groups > 0) - fixture_write_cup_round_robin(cup, 0, - misc_copy_ptr_array( - g_array_index(cup->rounds, CupRound, 0).team_ptrs)); + fixture_write_cup_round_robin( + cup, 0, misc_copy_ptr_array( + g_array_index(cup->rounds, CupRound, 0).team_ptrs)); else - fixture_write_knockout_round(cup, 0, - misc_copy_ptr_array( - g_array_index(cup->rounds, CupRound, 0).team_ptrs)); + fixture_write_knockout_round( + cup, 0, misc_copy_ptr_array( + g_array_index(cup->rounds, CupRound, 0).team_ptrs)); + printf("fwc 3\n"); + } /** Update the fixtures for the given cup. @@ -1346,8 +1352,9 @@ fixture_get_goals_to_win(const Fixture *fix, const Team *tm) return return_value; } -gint -fixture_get_goals_to_draw(const Fixture *fix, const Team *tm) -{ +/*todo*/ +/* gint */ +/* fixture_get_goals_to_draw(const Fixture *fix, const Team *tm) */ +/* { */ -} +/* } */ diff --git a/src/free.c b/src/free.c index a4d08837..1dced217 100644 --- a/src/free.c +++ b/src/free.c @@ -42,12 +42,13 @@ free_memory(void) free_names(FALSE); free_transfer_list(); free_strategies(); - free_country(FALSE); + free_country(&country, FALSE); free_users(FALSE); free_bets(FALSE); free_live_game(&live_game_temp); free_lg_commentary(FALSE); free_support_dirs(); + free_jobs(FALSE); } /** Free the transfer list. */ @@ -86,20 +87,24 @@ free_season_stats(gboolean reset) { free_gchar_ptr( g_array_index( - g_array_index(season_stats, SeasonStat, i).league_champs, ChampStat, j).cl_name); + g_array_index(season_stats, SeasonStat, i).league_champs, + ChampStat, j).cl_name); free_gchar_ptr( g_array_index( - g_array_index(season_stats, SeasonStat, i).league_champs, ChampStat, j).team_name); + g_array_index(season_stats, SeasonStat, i).league_champs, + ChampStat, j).team_name); } for(j=0;jlen;j++) { free_gchar_ptr( g_array_index( - g_array_index(season_stats, SeasonStat, i).cup_champs, ChampStat, j).cl_name); + g_array_index(season_stats, SeasonStat, i).cup_champs, + ChampStat, j).cl_name); free_gchar_ptr( g_array_index( - g_array_index(season_stats, SeasonStat, i).cup_champs, ChampStat, j).team_name); + g_array_index(season_stats, SeasonStat, i).cup_champs, + ChampStat, j).team_name); } g_array_free(g_array_index(season_stats, SeasonStat, i).cup_champs, TRUE); @@ -139,7 +144,7 @@ free_users(gboolean reset) void free_user(User *user) { - gint i; + gint i, j; free_gchar_ptr(user->name); free_g_string(&user->sponsor.name); @@ -152,8 +157,14 @@ free_user(User *user) free_g_array(&user->events); for(i=0;ihistory->len;i++) + { free_gchar_ptr(g_array_index(user->history, - UserHistory, i).value_string); + UserHistory, i).team_name); + for(j=0;j<3;j++) + free_gchar_ptr(g_array_index(user->history, + UserHistory, i).string[j]); + } + free_g_array(&user->history); free_mmatches(&user->mmatches, FALSE); @@ -261,23 +272,22 @@ free_live_game(LiveGame *match) free_g_array(&match->units); } - /** - Free the main variable of the game, #country. + Free a country variable. */ void -free_country(gboolean reset) +free_country(Country *cntry, gboolean reset) { - free_gchar_ptr(country.name); - free_gchar_ptr(country.symbol); - free_gchar_ptr(country.sid); + free_gchar_ptr(cntry->name); + free_gchar_ptr(cntry->symbol); + free_gchar_ptr(cntry->sid); - free_leagues_array(&ligs, reset); - free_cups_array(&cps, reset); - free_g_ptr_array(&acps); + free_leagues_array(&cntry->leagues, reset); + free_cups_array(&cntry->cups, reset); + free_g_ptr_array(&cntry->allcups); if(reset) - acps = g_ptr_array_new(); + cntry->allcups = g_ptr_array_new(); } /** @@ -338,12 +348,21 @@ free_league_stats(LeagueStat *stats) { gint i; + free_gchar_ptr(stats->league_name); + free_gchar_ptr(stats->league_symbol); + for(i=0;iteams_off->len;i++) + { + free_gchar_ptr(g_array_index(stats->teams_off, Stat, i).team_name); free_gchar_ptr(g_array_index(stats->teams_off, Stat, i).value_string); + } free_g_array(&stats->teams_off); for(i=0;iteams_def->len;i++) + { + free_gchar_ptr(g_array_index(stats->teams_def, Stat, i).team_name); free_gchar_ptr(g_array_index(stats->teams_def, Stat, i).value_string); + } free_g_array(&stats->teams_def); for(i=0;iplayer_scorers->len;i++) @@ -733,3 +752,57 @@ free_bets(gboolean reset) bets[1] = g_array_new(FALSE, FALSE, sizeof(BetMatch)); } } + +/** Free a job struct. + @param free_team Whether to free the team associated + with the job if it's an international offer. */ +void +free_job(Job *job, gboolean free_tm) +{ + gint i; + + if(job->type == JOB_TYPE_INTERNATIONAL) + { + free_gchar_ptr(job->country_file); + free_gchar_ptr(job->country_name); + free_gchar_ptr(job->league_name); + + for(i=0;ilen;i++) + if(g_array_index(job_teams, Team, i).id == job->team_id) + { + if(free_tm) + free_team(&g_array_index(job_teams, Team, i)); + g_array_remove_index(job_teams, i); + } + } +} + +/** Free the jobs and job_teams arrays. */ +void +free_jobs(gboolean reset) +{ + gint i; + + if(jobs == NULL) + { + if(reset) + { + jobs = g_array_new(FALSE, FALSE, sizeof(Job)); + job_teams = g_array_new(FALSE, FALSE, sizeof(Team)); + } + + return; + } + + for(i=0;ilen;i++) + free_job(&g_array_index(jobs, Job, i), TRUE); + + free_g_array(&jobs); + free_g_array(&job_teams); + + if(reset) + { + jobs = g_array_new(FALSE, FALSE, sizeof(Job)); + job_teams = g_array_new(FALSE, FALSE, sizeof(Team)); + } +} diff --git a/src/free.h b/src/free.h index b2d3b956..8ee28d95 100644 --- a/src/free.h +++ b/src/free.h @@ -28,6 +28,7 @@ #include "bygfoot.h" #include "cup_struct.h" +#include "job_struct.h" #include "league_struct.h" #include "live_game_struct.h" #include "name_struct.h" @@ -56,7 +57,7 @@ void free_user(User *user); void -free_country(gboolean reset); +free_country(Country *cntry, gboolean reset); void free_leagues_array(GArray **leagues, gboolean reset); @@ -133,4 +134,10 @@ free_strategies(void); void free_bets(gboolean reset); +void +free_job(Job *job, gboolean free_tm); + +void +free_jobs(gboolean reset); + #endif diff --git a/src/game.c b/src/game.c index 50883d24..0b5da201 100644 --- a/src/game.c +++ b/src/game.c @@ -1009,6 +1009,7 @@ game_post_match(Fixture *fix) gint i; GPtrArray *teams = NULL; Cup *cup = NULL; + gchar buf[SMALL], buf2[SMALL]; if((debug > 100 && fixture_user_team_involved(fix) != -1) || debug > 130) @@ -1020,13 +1021,7 @@ game_post_match(Fixture *fix) table_update(fix); for(i=0;i<2;i++) -/* { */ -/* if(team_is_user(fix->teams[i]) == -1) */ -/* team_update_cpu_team(fix->teams[i], */ -/* (fixture_user_team_involved(fix) != -1)); */ -/* else */ - team_update_post_match(fix->teams[i], fix); -/* } */ + team_update_post_match(fix->teams[i], fix); if(fix->clid < ID_CUP_START) return; @@ -1039,19 +1034,40 @@ game_post_match(Fixture *fix) teams = cup_get_teams_sorted(cup); if(team_is_user((Team*)g_ptr_array_index(teams, 0)) != -1) + { user_history_add(&usr(team_is_user((Team*)g_ptr_array_index(teams, 0))), - USER_HISTORY_WIN_FINAL, ((Team*)g_ptr_array_index(teams, 0))->id, - fix->clid, fix->round,((Team*)g_ptr_array_index(teams, 1))->name); + USER_HISTORY_WIN_FINAL, + ((Team*)g_ptr_array_index(teams, 0))->name, + league_cup_get_name_string(fix->clid), + ((Team*)g_ptr_array_index(teams, 1))->name, NULL); + user_add_cup_success(&usr(team_is_user((Team*)g_ptr_array_index(teams, 0))), + cup, fix->round, USER_HISTORY_WIN_FINAL); + } else if(team_is_user((Team*)g_ptr_array_index(teams, 1)) != -1) + { user_history_add(&usr(team_is_user((Team*)g_ptr_array_index(teams, 1))), - USER_HISTORY_LOSE_FINAL, ((Team*)g_ptr_array_index(teams, 1))->id, - fix->clid, fix->round,((Team*)g_ptr_array_index(teams, 0))->name); + USER_HISTORY_LOSE_FINAL, + ((Team*)g_ptr_array_index(teams, 1))->name, + league_cup_get_name_string(fix->clid), + ((Team*)g_ptr_array_index(teams, 0))->name, NULL); + user_add_cup_success(&usr(team_is_user((Team*)g_ptr_array_index(teams, 1))), + cup, fix->round, USER_HISTORY_LOSE_FINAL); + } g_ptr_array_free(teams, TRUE); } else if(fixture_user_team_involved(fix) != -1) - user_history_add(&usr(fixture_user_team_involved(fix)), USER_HISTORY_REACH_CUP_ROUND, - usr(fixture_user_team_involved(fix)).team_id, - fix->clid, fix->round, ""); + { + cup_get_round_name(cup_from_clid(fix->clid), fix->round, buf); + sprintf(buf2, "%d", fix->round + 1); + + user_history_add(&usr(fixture_user_team_involved(fix)), + USER_HISTORY_REACH_CUP_ROUND, + usr(fixture_user_team_involved(fix)).name, + league_cup_get_name_string(fix->clid), + buf, buf2); + user_add_cup_success(&usr(fixture_user_team_involved(fix)), + cup, fix->round, USER_HISTORY_REACH_CUP_ROUND); + } } /** Reduce stadium capacity and safety after a stadium event. diff --git a/src/game_gui.c b/src/game_gui.c index e4eb0bbc..2edfba24 100644 --- a/src/game_gui.c +++ b/src/game_gui.c @@ -27,6 +27,7 @@ #include "file.h" #include "game_gui.h" #include "gui.h" +#include "job.h" #include "league.h" #include "live_game.h" #include "maths.h" @@ -680,15 +681,31 @@ game_gui_show_warning(const gchar *format, ...) } /** Show the job offer window. - @param team The team offering the job. - @param type The offer type (whether the user's been fired). */ + @param team The team offering the job or NULL if we're looking + at a job offer from the job exchange. + @param job The job pointer or NULL (depends on whether we're looking + at a job offer from the job exchange). + @param type The offer type (eg. whether the user's been fired). */ void -game_gui_show_job_offer(Team *team, gint type) +game_gui_show_job_offer(Team *team, Job *job, gint type) { gchar buf[SMALL], buf2[SMALL]; GtkLabel *label_text, *label_text2, *label_name, *label_league, *label_rank, *label_money, *label_cap, *label_saf, *label_average_skill; + Team *tm = (type != STATUS_JOB_EXCHANGE_SHOW_TEAM) ? + team : job_get_team(job); + + statp = (type != STATUS_JOB_EXCHANGE_SHOW_TEAM) ? + (gpointer)team : (gpointer)job; + stat2 = type; + + if(type == STATUS_JOB_OFFER_FIRE_FINANCE || + type == STATUS_JOB_OFFER_FIRE_FAILURE) + user_history_add(¤t_user, (type == STATUS_JOB_OFFER_FIRE_FINANCE) ? + USER_HISTORY_FIRE_FINANCE : USER_HISTORY_FIRE_FAILURE, + current_user.tm->name, team->name, + league_cup_get_name_string(team->clid), NULL); window_create(WINDOW_JOB_OFFER); @@ -705,38 +722,55 @@ game_gui_show_job_offer(Team *team, gint type) if(type == STATUS_JOB_OFFER_FIRE_FINANCE) sprintf(buf, _("The team owners have fired you because of financial mismanagement. Luckily, the owners of %s have heard of your dismissal and offer you a job. Here's some information on %s:"), - team->name, team->name); + tm->name, tm->name); else if(type == STATUS_JOB_OFFER_FIRE_FAILURE) sprintf(buf, _("The team owners have fired you because of unsuccessfulness. Luckily, the owners of %s have heard of your dismissal and offer you a job. Here's some information on %s:"), - team->name, team->name); + tm->name, tm->name); else if(type == STATUS_JOB_OFFER_SUCCESS) sprintf(buf, _("The owners of %s are deeply impressed by your success with %s and would like to hire you. Here's some information on %s:"), - team->name, current_user.tm->name, team->name); + tm->name, current_user.tm->name, tm->name); + else if(type == STATUS_JOB_EXCHANGE_SHOW_TEAM) + strcpy(buf, _("Click on OK to apply for the job. Click on CANCEL to close the window.")); - strcpy(buf2, _("Accept?")); - if(type != STATUS_JOB_OFFER_SUCCESS) + strcpy(buf2, (type != STATUS_JOB_EXCHANGE_SHOW_TEAM) ? + _("Accept?") : _("Apply for the job?")); + + if(type != STATUS_JOB_OFFER_SUCCESS && + type != STATUS_JOB_EXCHANGE_SHOW_TEAM) strcat(buf2, _(" (NOTE: If you don't, the game is over for you.)")); gtk_label_set_text(label_text, buf); gtk_label_set_text(label_text2, buf2); - gtk_label_set_text(label_name, team->name); - gtk_label_set_text(label_league, league_cup_get_name_string(team->clid)); - gui_label_set_text_from_int(label_rank, team_get_league_rank(team), FALSE); - misc_print_grouped_int(math_round_integer(team->stadium.capacity * - math_rndi(const_int("int_initial_money_lower"), - const_int("int_initial_money_upper")), 2), - buf); - gtk_label_set_text(label_money, buf); - misc_print_grouped_int(team->stadium.capacity, buf); - gtk_label_set_text(label_cap, buf); - gui_label_set_text_from_int(label_saf, (gint)rint(team->stadium.safety * 100), FALSE); + gtk_label_set_text(label_name, tm->name); + gtk_label_set_text(label_league, + (type != STATUS_JOB_EXCHANGE_SHOW_TEAM) ? + league_cup_get_name_string(tm->clid) : job->league_name); - sprintf(buf, "%.1f", team_get_average_skill(team, FALSE)); + if(job == NULL || + job->type == JOB_TYPE_NATIONAL) + gui_label_set_text_from_int(label_rank, + team_get_league_rank(tm), FALSE); + + misc_print_grouped_int( + math_round_integer(tm->stadium.capacity * + math_rndi(const_int("int_initial_money_lower"), + const_int("int_initial_money_upper")), 2), + buf); + + gtk_label_set_text(label_money, buf); + misc_print_grouped_int(tm->stadium.capacity, buf); + gtk_label_set_text(label_cap, buf); + gui_label_set_text_from_int(label_saf, + (gint)rint(tm->stadium.safety * 100), FALSE); + + sprintf(buf, "%.1f", team_get_average_skill(tm, FALSE)); gtk_label_set_text(label_average_skill, buf); - treeview_show_player_list_team(GTK_TREE_VIEW(lookup_widget(window.job_offer, "treeview_players")), - team, - (type != STATUS_JOB_OFFER_SUCCESS) ? 2 : current_user.scout); + treeview_show_player_list_team( + GTK_TREE_VIEW(lookup_widget(window.job_offer, "treeview_players")), + tm, + (type != STATUS_JOB_OFFER_SUCCESS && type != STATUS_JOB_EXCHANGE_SHOW_TEAM) ? + 2 : current_user.scout); } /** Write the checkbuttons in the menus. */ diff --git a/src/game_gui.h b/src/game_gui.h index 0a2ec850..577db4d3 100644 --- a/src/game_gui.h +++ b/src/game_gui.h @@ -30,6 +30,7 @@ #include #include "bygfoot.h" +#include "job_struct.h" #include "live_game_struct.h" #include "option_struct.h" @@ -95,7 +96,7 @@ void game_gui_write_meters(const Team *tm); void -game_gui_show_job_offer(Team *team, gint type); +game_gui_show_job_offer(Team *team, Job *job, gint type); void game_gui_write_check_items(void); diff --git a/src/gui.c b/src/gui.c index 15a12708..fe61d302 100644 --- a/src/gui.c +++ b/src/gui.c @@ -25,6 +25,7 @@ #include "gui.h" #include "misc.h" +#include "option.h" #include "support.h" #include "variables.h" #include "window.h" diff --git a/src/interface.c b/src/interface.c index 77b3c914..aa617afa 100644 --- a/src/interface.c +++ b/src/interface.c @@ -38,7 +38,7 @@ create_main_window (void) GtkWidget *menu_new; GtkWidget *menu_open; GtkWidget *menu_load_last_save; - GtkWidget *image2192; + GtkWidget *image2274; GtkWidget *menu_save; GtkWidget *menu_save_as; GtkWidget *trennlinie1; @@ -46,35 +46,35 @@ create_main_window (void) GtkWidget *menu_options; GtkWidget *menu_options_menu; GtkWidget *menu_preferences; - GtkWidget *image2193; + GtkWidget *image2275; GtkWidget *trennlinie7; GtkWidget *menu_job_offers; GtkWidget *menu_live_game; GtkWidget *menu_overwrite; GtkWidget *trennlinie14; GtkWidget *menu_save_window_geometry; - GtkWidget *image2194; + GtkWidget *image2276; GtkWidget *menu_figures; GtkWidget *menu_figures_menu; GtkWidget *menu_fixtures_week; - GtkWidget *image2195; + GtkWidget *image2277; GtkWidget *menu_fixtures; - GtkWidget *image2196; + GtkWidget *image2278; GtkWidget *menu_tables; - GtkWidget *image2197; + GtkWidget *image2279; GtkWidget *menu_my_league_results; - GtkWidget *image2198; + GtkWidget *image2280; GtkWidget *menu_season_results; - GtkWidget *image2199; + GtkWidget *image2281; GtkWidget *trennlinie13; GtkWidget *menu_league_stats; - GtkWidget *image2200; + GtkWidget *image2282; GtkWidget *menu_season_history; - GtkWidget *image2201; + GtkWidget *image2283; GtkWidget *menu_team; GtkWidget *menu_team_menu; GtkWidget *menu_playing_style; - GtkWidget *image2202; + GtkWidget *image2284; GtkWidget *menu_playing_style_menu; GSList *menu_all_out_defend_group = NULL; GtkWidget *menu_all_out_defend; @@ -83,7 +83,7 @@ create_main_window (void) GtkWidget *menu_attack; GtkWidget *menu_all_out_attack; GtkWidget *menu_scout; - GtkWidget *image2203; + GtkWidget *image2285; GtkWidget *menu_scout_menu; GSList *menu_scout_best_group = NULL; GtkWidget *menu_scout_best; @@ -91,7 +91,7 @@ create_main_window (void) GtkWidget *menu_scout_average; GtkWidget *menu_scout_bad; GtkWidget *menu_physio; - GtkWidget *image2204; + GtkWidget *image2286; GtkWidget *menu_physio_menu; GSList *menu_physio_best_group = NULL; GtkWidget *menu_physio_best; @@ -99,7 +99,7 @@ create_main_window (void) GtkWidget *menu_physio_average; GtkWidget *menu_physio_bad; GtkWidget *menu_youth_academy; - GtkWidget *image2205; + GtkWidget *image2287; GtkWidget *menu_youth_academy_menu; GtkWidget *menu_show_youth_academy; GtkWidget *youth_coach1; @@ -119,7 +119,7 @@ create_main_window (void) GtkWidget *menu_recruit4; GtkWidget *menu_set_investment; GtkWidget *menu_boost; - GtkWidget *image2206; + GtkWidget *image2288; GtkWidget *menu_boost_menu; GSList *menu_boost_on_group = NULL; GtkWidget *menu_boost_on; @@ -127,74 +127,76 @@ create_main_window (void) GtkWidget *menu_boost_anti; GtkWidget *trennlinie11; GtkWidget *menu_reset_players; - GtkWidget *image2207; + GtkWidget *image2289; GtkWidget *menu_custom_structure; - GtkWidget *image2208; + GtkWidget *image2290; GtkWidget *menu_rearrange_team; - GtkWidget *image2209; + GtkWidget *image2291; GtkWidget *trennlinie8; GtkWidget *menu_browse_teams; - GtkWidget *image2210; + GtkWidget *image2292; + GtkWidget *trennlinie16; + GtkWidget *menu_show_job_exchange; GtkWidget *menu_player; GtkWidget *menu_player_menu; GtkWidget *menu_show_info; - GtkWidget *image2211; + GtkWidget *image2293; GtkWidget *menu_put_on_transfer_list; - GtkWidget *image2212; + GtkWidget *image2294; GtkWidget *menu_remove_from_transfer_list; - GtkWidget *image2213; + GtkWidget *image2295; GtkWidget *menu_offer_new_contract; - GtkWidget *image2214; + GtkWidget *image2296; GtkWidget *menu_fire; - GtkWidget *image2215; + GtkWidget *image2297; GtkWidget *menu_shoots_penalties; - GtkWidget *image2216; + GtkWidget *image2298; GtkWidget *menu_move_to_youth_academy; - GtkWidget *image2217; + GtkWidget *image2299; GtkWidget *trennlinie10; GtkWidget *menu_browse_players; - GtkWidget *image2218; + GtkWidget *image2300; GtkWidget *menu_user; GtkWidget *menu_user_menu; GtkWidget *menu_user_show_last_match; - GtkWidget *image2219; + GtkWidget *image2301; GtkWidget *menu_user_show_last_stats; - GtkWidget *image2220; + GtkWidget *image2302; GtkWidget *menu_user_show_coming_matches; - GtkWidget *image2221; + GtkWidget *image2303; GtkWidget *memorable_matches; - GtkWidget *image2222; + GtkWidget *image2304; GtkWidget *memorable_matches_menu; GtkWidget *mm_add_last_match; - GtkWidget *image2223; + GtkWidget *image2305; GtkWidget *mm_manage_matches; - GtkWidget *image2224; + GtkWidget *image2306; GtkWidget *trennlinie12; GtkWidget *menu_user_show_history; - GtkWidget *image2225; + GtkWidget *image2307; GtkWidget *trennlinie9; GtkWidget *menu_next_user; - GtkWidget *image2226; + GtkWidget *image2308; GtkWidget *menu_previous_user; - GtkWidget *image2227; + GtkWidget *image2309; GtkWidget *menu_manage_users; - GtkWidget *image2228; + GtkWidget *image2310; GtkWidget *menu_finances_stadium; GtkWidget *menu_finances_stadium_menu; GtkWidget *menu_show_finances; - GtkWidget *image2229; + GtkWidget *image2311; GtkWidget *menu_show_stadium; - GtkWidget *image2230; + GtkWidget *image2312; GtkWidget *trennlinie15; GtkWidget *menu_betting; GtkWidget *menu_help1; GtkWidget *menu_help1_menu; GtkWidget *menu_about; - GtkWidget *image2231; + GtkWidget *image2313; GtkWidget *menu_contributors; - GtkWidget *image2232; + GtkWidget *image2314; GtkWidget *menu_help; - GtkWidget *image2233; + GtkWidget *image2315; GtkWidget *hbox1; GtkWidget *button_load; GtkWidget *image11; @@ -315,9 +317,9 @@ create_main_window (void) GDK_l, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); - image2192 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2192); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_load_last_save), image2192); + image2274 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2274); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_load_last_save), image2274); menu_save = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); gtk_widget_show (menu_save); @@ -350,9 +352,9 @@ create_main_window (void) GDK_p, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - image2193 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2193); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image2193); + image2275 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2275); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_preferences), image2275); trennlinie7 = gtk_separator_menu_item_new (); gtk_widget_show (trennlinie7); @@ -383,9 +385,9 @@ create_main_window (void) gtk_container_add (GTK_CONTAINER (menu_options_menu), menu_save_window_geometry); gtk_tooltips_set_tip (tooltips, menu_save_window_geometry, _("Save window size, position and vertical divider"), NULL); - image2194 = create_pixmap (main_window, "menu_save_geometry.png"); - gtk_widget_show (image2194); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_window_geometry), image2194); + image2276 = create_pixmap (main_window, "menu_save_geometry.png"); + gtk_widget_show (image2276); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_window_geometry), image2276); menu_figures = gtk_menu_item_new_with_mnemonic (_("F_igures")); gtk_widget_show (menu_figures); @@ -401,9 +403,9 @@ create_main_window (void) GDK_F3, 0, GTK_ACCEL_VISIBLE); - image2195 = create_pixmap (main_window, "menu_fixtures.png"); - gtk_widget_show (image2195); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fixtures_week), image2195); + image2277 = create_pixmap (main_window, "menu_fixtures.png"); + gtk_widget_show (image2277); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fixtures_week), image2277); menu_fixtures = gtk_image_menu_item_new_with_mnemonic (_("Fixtures (competitions)")); gtk_widget_show (menu_fixtures); @@ -412,9 +414,9 @@ create_main_window (void) GDK_F4, 0, GTK_ACCEL_VISIBLE); - image2196 = create_pixmap (main_window, "menu_fixtures_comp.png"); - gtk_widget_show (image2196); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fixtures), image2196); + image2278 = create_pixmap (main_window, "menu_fixtures_comp.png"); + gtk_widget_show (image2278); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fixtures), image2278); menu_tables = gtk_image_menu_item_new_with_mnemonic (_("Tables")); gtk_widget_show (menu_tables); @@ -423,9 +425,9 @@ create_main_window (void) GDK_F5, 0, GTK_ACCEL_VISIBLE); - image2197 = create_pixmap (main_window, "menu_table.png"); - gtk_widget_show (image2197); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_tables), image2197); + image2279 = create_pixmap (main_window, "menu_table.png"); + gtk_widget_show (image2279); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_tables), image2279); menu_my_league_results = gtk_image_menu_item_new_with_mnemonic (_("My league results")); gtk_widget_show (menu_my_league_results); @@ -434,9 +436,9 @@ create_main_window (void) GDK_F6, 0, GTK_ACCEL_VISIBLE); - image2198 = create_pixmap (main_window, "menu_league_results.png"); - gtk_widget_show (image2198); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_my_league_results), image2198); + image2280 = create_pixmap (main_window, "menu_league_results.png"); + gtk_widget_show (image2280); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_my_league_results), image2280); menu_season_results = gtk_image_menu_item_new_with_mnemonic (_("Season results")); gtk_widget_show (menu_season_results); @@ -445,9 +447,9 @@ create_main_window (void) GDK_s, GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE); - image2199 = create_pixmap (main_window, "menu_season_res.png"); - gtk_widget_show (image2199); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_season_results), image2199); + image2281 = create_pixmap (main_window, "menu_season_res.png"); + gtk_widget_show (image2281); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_season_results), image2281); trennlinie13 = gtk_separator_menu_item_new (); gtk_widget_show (trennlinie13); @@ -461,9 +463,9 @@ create_main_window (void) GDK_s, 0, GTK_ACCEL_VISIBLE); - image2200 = create_pixmap (main_window, "menu_league_stats.png"); - gtk_widget_show (image2200); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_league_stats), image2200); + image2282 = create_pixmap (main_window, "menu_league_stats.png"); + gtk_widget_show (image2282); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_league_stats), image2282); menu_season_history = gtk_image_menu_item_new_with_mnemonic (_("Season history")); gtk_widget_show (menu_season_history); @@ -472,9 +474,9 @@ create_main_window (void) GDK_h, 0, GTK_ACCEL_VISIBLE); - image2201 = create_pixmap (main_window, "menu_history.png"); - gtk_widget_show (image2201); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_season_history), image2201); + image2283 = create_pixmap (main_window, "menu_history.png"); + gtk_widget_show (image2283); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_season_history), image2283); menu_team = gtk_menu_item_new_with_mnemonic (_("_Team")); gtk_widget_show (menu_team); @@ -487,9 +489,9 @@ create_main_window (void) gtk_widget_show (menu_playing_style); gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_playing_style); - image2202 = create_pixmap (main_window, "menu_style.png"); - gtk_widget_show (image2202); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_playing_style), image2202); + image2284 = create_pixmap (main_window, "menu_style.png"); + gtk_widget_show (image2284); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_playing_style), image2284); menu_playing_style_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_playing_style), menu_playing_style_menu); @@ -498,25 +500,21 @@ create_main_window (void) menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_all_out_defend)); gtk_widget_show (menu_all_out_defend); gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_all_out_defend); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_all_out_defend), TRUE); menu_defend = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Defend")); menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_defend)); gtk_widget_show (menu_defend); gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_defend); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_defend), TRUE); menu_balanced = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Balanced")); menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_balanced)); gtk_widget_show (menu_balanced); gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_balanced); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_balanced), TRUE); menu_attack = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("Attack")); menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_attack)); gtk_widget_show (menu_attack); gtk_container_add (GTK_CONTAINER (menu_playing_style_menu), menu_attack); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_attack), TRUE); menu_all_out_attack = gtk_radio_menu_item_new_with_mnemonic (menu_all_out_defend_group, _("All Out Attack")); menu_all_out_defend_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_all_out_attack)); @@ -528,9 +526,9 @@ create_main_window (void) gtk_widget_show (menu_scout); gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_scout); - image2203 = create_pixmap (main_window, "menu_scout.png"); - gtk_widget_show (image2203); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_scout), image2203); + image2285 = create_pixmap (main_window, "menu_scout.png"); + gtk_widget_show (image2285); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_scout), image2285); menu_scout_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_scout), menu_scout_menu); @@ -539,19 +537,16 @@ create_main_window (void) menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_best)); gtk_widget_show (menu_scout_best); gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_best); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_scout_best), TRUE); menu_scout_good = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Good")); menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_good)); gtk_widget_show (menu_scout_good); gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_good); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_scout_good), TRUE); menu_scout_average = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Average")); menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_average)); gtk_widget_show (menu_scout_average); gtk_container_add (GTK_CONTAINER (menu_scout_menu), menu_scout_average); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_scout_average), TRUE); menu_scout_bad = gtk_radio_menu_item_new_with_mnemonic (menu_scout_best_group, _("Bad")); menu_scout_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_scout_bad)); @@ -563,9 +558,9 @@ create_main_window (void) gtk_widget_show (menu_physio); gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_physio); - image2204 = create_pixmap (main_window, "menu_physio.png"); - gtk_widget_show (image2204); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_physio), image2204); + image2286 = create_pixmap (main_window, "menu_physio.png"); + gtk_widget_show (image2286); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_physio), image2286); menu_physio_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_physio), menu_physio_menu); @@ -574,19 +569,16 @@ create_main_window (void) menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_best)); gtk_widget_show (menu_physio_best); gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_best); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_physio_best), TRUE); menu_physio_good = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Good")); menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_good)); gtk_widget_show (menu_physio_good); gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_good); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_physio_good), TRUE); menu_physio_average = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Average")); menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_average)); gtk_widget_show (menu_physio_average); gtk_container_add (GTK_CONTAINER (menu_physio_menu), menu_physio_average); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_physio_average), TRUE); menu_physio_bad = gtk_radio_menu_item_new_with_mnemonic (menu_physio_best_group, _("Bad")); menu_physio_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_physio_bad)); @@ -598,9 +590,9 @@ create_main_window (void) gtk_widget_show (menu_youth_academy); gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_youth_academy); - image2205 = create_pixmap (main_window, "menu_youth_academy.png"); - gtk_widget_show (image2205); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_youth_academy), image2205); + image2287 = create_pixmap (main_window, "menu_youth_academy.png"); + gtk_widget_show (image2287); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_youth_academy), image2287); menu_youth_academy_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_youth_academy), menu_youth_academy_menu); @@ -623,19 +615,16 @@ create_main_window (void) menu_yc_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_yc_best)); gtk_widget_show (menu_yc_best); gtk_container_add (GTK_CONTAINER (youth_coach1_menu), menu_yc_best); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_yc_best), TRUE); menu_yc_good = gtk_radio_menu_item_new_with_mnemonic (menu_yc_best_group, _("Good")); menu_yc_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_yc_good)); gtk_widget_show (menu_yc_good); gtk_container_add (GTK_CONTAINER (youth_coach1_menu), menu_yc_good); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_yc_good), TRUE); menu_yc_average = gtk_radio_menu_item_new_with_mnemonic (menu_yc_best_group, _("Average")); menu_yc_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_yc_average)); gtk_widget_show (menu_yc_average); gtk_container_add (GTK_CONTAINER (youth_coach1_menu), menu_yc_average); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_yc_average), TRUE); menu_yc_bad = gtk_radio_menu_item_new_with_mnemonic (menu_yc_best_group, _("Bad")); menu_yc_best_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_yc_bad)); @@ -654,25 +643,21 @@ create_main_window (void) menu_recruit0_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_recruit0)); gtk_widget_show (menu_recruit0); gtk_container_add (GTK_CONTAINER (recruiting_preference1_menu), menu_recruit0); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_recruit0), TRUE); menu_recruit1 = gtk_radio_menu_item_new_with_mnemonic (menu_recruit0_group, _("Defenders")); menu_recruit0_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_recruit1)); gtk_widget_show (menu_recruit1); gtk_container_add (GTK_CONTAINER (recruiting_preference1_menu), menu_recruit1); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_recruit1), TRUE); menu_recruit2 = gtk_radio_menu_item_new_with_mnemonic (menu_recruit0_group, _("Midfielders")); menu_recruit0_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_recruit2)); gtk_widget_show (menu_recruit2); gtk_container_add (GTK_CONTAINER (recruiting_preference1_menu), menu_recruit2); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_recruit2), TRUE); menu_recruit3 = gtk_radio_menu_item_new_with_mnemonic (menu_recruit0_group, _("Forwards")); menu_recruit0_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_recruit3)); gtk_widget_show (menu_recruit3); gtk_container_add (GTK_CONTAINER (recruiting_preference1_menu), menu_recruit3); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_recruit3), TRUE); menu_recruit4 = gtk_radio_menu_item_new_with_mnemonic (menu_recruit0_group, _("Any")); menu_recruit0_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_recruit4)); @@ -689,9 +674,9 @@ create_main_window (void) gtk_widget_show (menu_boost); gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_boost); - image2206 = create_pixmap (main_window, "menu_boost.png"); - gtk_widget_show (image2206); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_boost), image2206); + image2288 = create_pixmap (main_window, "menu_boost.png"); + gtk_widget_show (image2288); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_boost), image2288); menu_boost_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_boost), menu_boost_menu); @@ -700,13 +685,11 @@ create_main_window (void) menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_on)); gtk_widget_show (menu_boost_on); gtk_container_add (GTK_CONTAINER (menu_boost_menu), menu_boost_on); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_boost_on), TRUE); menu_boost_off = gtk_radio_menu_item_new_with_mnemonic (menu_boost_on_group, _("Off")); menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_off)); gtk_widget_show (menu_boost_off); gtk_container_add (GTK_CONTAINER (menu_boost_menu), menu_boost_off); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_boost_off), TRUE); menu_boost_anti = gtk_radio_menu_item_new_with_mnemonic (menu_boost_on_group, _("Anti")); menu_boost_on_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_boost_anti)); @@ -723,17 +706,17 @@ create_main_window (void) gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_reset_players); gtk_tooltips_set_tip (tooltips, menu_reset_players, _("Reset player list to the formation at the beginning of the live game pause (right click on player list)"), NULL); - image2207 = gtk_image_new_from_stock ("gtk-undo", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2207); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reset_players), image2207); + image2289 = gtk_image_new_from_stock ("gtk-undo", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2289); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reset_players), image2289); menu_custom_structure = gtk_image_menu_item_new_with_mnemonic (_("Enter custom structure")); gtk_widget_show (menu_custom_structure); gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_custom_structure); - image2208 = create_pixmap (main_window, "menu_structure.png"); - gtk_widget_show (image2208); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_custom_structure), image2208); + image2290 = create_pixmap (main_window, "menu_structure.png"); + gtk_widget_show (image2290); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_custom_structure), image2290); menu_rearrange_team = gtk_image_menu_item_new_with_mnemonic (_("Rearrange team")); gtk_widget_show (menu_rearrange_team); @@ -743,9 +726,9 @@ create_main_window (void) GDK_r, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - image2209 = create_pixmap (main_window, "menu_rearrange.png"); - gtk_widget_show (image2209); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_rearrange_team), image2209); + image2291 = create_pixmap (main_window, "menu_rearrange.png"); + gtk_widget_show (image2291); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_rearrange_team), image2291); trennlinie8 = gtk_separator_menu_item_new (); gtk_widget_show (trennlinie8); @@ -756,9 +739,22 @@ create_main_window (void) gtk_widget_show (menu_browse_teams); gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_browse_teams); - image2210 = create_pixmap (main_window, "menu_browse_tms.png"); - gtk_widget_show (image2210); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_browse_teams), image2210); + image2292 = create_pixmap (main_window, "menu_browse_tms.png"); + gtk_widget_show (image2292); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_browse_teams), image2292); + + trennlinie16 = gtk_separator_menu_item_new (); + gtk_widget_show (trennlinie16); + gtk_container_add (GTK_CONTAINER (menu_team_menu), trennlinie16); + gtk_widget_set_sensitive (trennlinie16, FALSE); + + menu_show_job_exchange = gtk_menu_item_new_with_mnemonic (_("Show job exchange")); + gtk_widget_show (menu_show_job_exchange); + gtk_container_add (GTK_CONTAINER (menu_team_menu), menu_show_job_exchange); + gtk_tooltips_set_tip (tooltips, menu_show_job_exchange, _("Show the list of available manager jobs"), NULL); + gtk_widget_add_accelerator (menu_show_job_exchange, "activate", accel_group, + GDK_j, 0, + GTK_ACCEL_VISIBLE); menu_player = gtk_menu_item_new_with_mnemonic (_("_Player")); gtk_widget_show (menu_player); @@ -771,57 +767,57 @@ create_main_window (void) gtk_widget_show (menu_show_info); gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_show_info); - image2211 = create_pixmap (main_window, "menu_player_info.png"); - gtk_widget_show (image2211); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_info), image2211); + image2293 = create_pixmap (main_window, "menu_player_info.png"); + gtk_widget_show (image2293); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_info), image2293); menu_put_on_transfer_list = gtk_image_menu_item_new_with_mnemonic (_("Put on transfer list")); gtk_widget_show (menu_put_on_transfer_list); gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_put_on_transfer_list); - image2212 = create_pixmap (main_window, "menu_player_put_transfer.png"); - gtk_widget_show (image2212); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_put_on_transfer_list), image2212); + image2294 = create_pixmap (main_window, "menu_player_put_transfer.png"); + gtk_widget_show (image2294); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_put_on_transfer_list), image2294); menu_remove_from_transfer_list = gtk_image_menu_item_new_with_mnemonic (_("Remove from transfer list")); gtk_widget_show (menu_remove_from_transfer_list); gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_remove_from_transfer_list); - image2213 = create_pixmap (main_window, "menu_player_remove_transfer.png"); - gtk_widget_show (image2213); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_remove_from_transfer_list), image2213); + image2295 = create_pixmap (main_window, "menu_player_remove_transfer.png"); + gtk_widget_show (image2295); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_remove_from_transfer_list), image2295); menu_offer_new_contract = gtk_image_menu_item_new_with_mnemonic (_("Offer new contract")); gtk_widget_show (menu_offer_new_contract); gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_offer_new_contract); - image2214 = create_pixmap (main_window, "menu_player_contract.png"); - gtk_widget_show (image2214); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_offer_new_contract), image2214); + image2296 = create_pixmap (main_window, "menu_player_contract.png"); + gtk_widget_show (image2296); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_offer_new_contract), image2296); menu_fire = gtk_image_menu_item_new_with_mnemonic (_("Fire")); gtk_widget_show (menu_fire); gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_fire); - image2215 = create_pixmap (main_window, "menu_player_fire.png"); - gtk_widget_show (image2215); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fire), image2215); + image2297 = create_pixmap (main_window, "menu_player_fire.png"); + gtk_widget_show (image2297); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_fire), image2297); menu_shoots_penalties = gtk_image_menu_item_new_with_mnemonic (_("Shoots penalties")); gtk_widget_show (menu_shoots_penalties); gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_shoots_penalties); - image2216 = create_pixmap (main_window, "menu_player_shoots.png"); - gtk_widget_show (image2216); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_shoots_penalties), image2216); + image2298 = create_pixmap (main_window, "menu_player_shoots.png"); + gtk_widget_show (image2298); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_shoots_penalties), image2298); menu_move_to_youth_academy = gtk_image_menu_item_new_with_mnemonic (_("Move to youth academy")); gtk_widget_show (menu_move_to_youth_academy); gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_move_to_youth_academy); - image2217 = create_pixmap (main_window, "menu_player_move_to_ya.png"); - gtk_widget_show (image2217); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_move_to_youth_academy), image2217); + image2299 = create_pixmap (main_window, "menu_player_move_to_ya.png"); + gtk_widget_show (image2299); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_move_to_youth_academy), image2299); trennlinie10 = gtk_separator_menu_item_new (); gtk_widget_show (trennlinie10); @@ -832,9 +828,9 @@ create_main_window (void) gtk_widget_show (menu_browse_players); gtk_container_add (GTK_CONTAINER (menu_player_menu), menu_browse_players); - image2218 = create_pixmap (main_window, "menu_player_browse.png"); - gtk_widget_show (image2218); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_browse_players), image2218); + image2300 = create_pixmap (main_window, "menu_player_browse.png"); + gtk_widget_show (image2300); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_browse_players), image2300); menu_user = gtk_menu_item_new_with_mnemonic (_("_User")); gtk_widget_show (menu_user); @@ -850,9 +846,9 @@ create_main_window (void) GDK_v, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - image2219 = create_pixmap (main_window, "menu_last_match.png"); - gtk_widget_show (image2219); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_last_match), image2219); + image2301 = create_pixmap (main_window, "menu_last_match.png"); + gtk_widget_show (image2301); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_last_match), image2301); menu_user_show_last_stats = gtk_image_menu_item_new_with_mnemonic (_("Show last match stats")); gtk_widget_show (menu_user_show_last_stats); @@ -861,9 +857,9 @@ create_main_window (void) GDK_F2, 0, GTK_ACCEL_VISIBLE); - image2220 = create_pixmap (main_window, "menu_match_stats.png"); - gtk_widget_show (image2220); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_last_stats), image2220); + image2302 = create_pixmap (main_window, "menu_match_stats.png"); + gtk_widget_show (image2302); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_last_stats), image2302); menu_user_show_coming_matches = gtk_image_menu_item_new_with_mnemonic (_("Show coming matches")); gtk_widget_show (menu_user_show_coming_matches); @@ -872,17 +868,17 @@ create_main_window (void) GDK_F1, 0, GTK_ACCEL_VISIBLE); - image2221 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2221); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_coming_matches), image2221); + image2303 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2303); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_coming_matches), image2303); memorable_matches = gtk_image_menu_item_new_with_mnemonic (_("Memorable matches")); gtk_widget_show (memorable_matches); gtk_container_add (GTK_CONTAINER (menu_user_menu), memorable_matches); - image2222 = create_pixmap (main_window, "menu_mmatches.png"); - gtk_widget_show (image2222); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (memorable_matches), image2222); + image2304 = create_pixmap (main_window, "menu_mmatches.png"); + gtk_widget_show (image2304); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (memorable_matches), image2304); memorable_matches_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (memorable_matches), memorable_matches_menu); @@ -895,9 +891,9 @@ create_main_window (void) GDK_a, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - image2223 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2223); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mm_add_last_match), image2223); + image2305 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2305); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mm_add_last_match), image2305); mm_manage_matches = gtk_image_menu_item_new_with_mnemonic (_("Manage matches")); gtk_widget_show (mm_manage_matches); @@ -907,9 +903,9 @@ create_main_window (void) GDK_m, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - image2224 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2224); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mm_manage_matches), image2224); + image2306 = gtk_image_new_from_stock ("gtk-preferences", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2306); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mm_manage_matches), image2306); trennlinie12 = gtk_separator_menu_item_new (); gtk_widget_show (trennlinie12); @@ -923,9 +919,9 @@ create_main_window (void) GDK_h, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - image2225 = create_pixmap (main_window, "menu_history.png"); - gtk_widget_show (image2225); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_history), image2225); + image2307 = create_pixmap (main_window, "menu_history.png"); + gtk_widget_show (image2307); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_user_show_history), image2307); trennlinie9 = gtk_separator_menu_item_new (); gtk_widget_show (trennlinie9); @@ -939,9 +935,9 @@ create_main_window (void) GDK_F9, 0, GTK_ACCEL_VISIBLE); - image2226 = gtk_image_new_from_stock ("gtk-media-forward", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2226); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image2226); + image2308 = gtk_image_new_from_stock ("gtk-media-forward", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2308); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_next_user), image2308); menu_previous_user = gtk_image_menu_item_new_with_mnemonic (_("Previous user")); gtk_widget_show (menu_previous_user); @@ -950,9 +946,9 @@ create_main_window (void) GDK_F8, 0, GTK_ACCEL_VISIBLE); - image2227 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2227); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image2227); + image2309 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2309); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_previous_user), image2309); menu_manage_users = gtk_image_menu_item_new_with_mnemonic (_("Manage users")); gtk_widget_show (menu_manage_users); @@ -961,9 +957,9 @@ create_main_window (void) GDK_F12, 0, GTK_ACCEL_VISIBLE); - image2228 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2228); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image2228); + image2310 = gtk_image_new_from_stock ("gtk-justify-fill", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2310); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_manage_users), image2310); menu_finances_stadium = gtk_menu_item_new_with_mnemonic (_("Fin_Stad")); gtk_widget_show (menu_finances_stadium); @@ -979,9 +975,9 @@ create_main_window (void) GDK_f, 0, GTK_ACCEL_VISIBLE); - image2229 = create_pixmap (main_window, "menu_finances.png"); - gtk_widget_show (image2229); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_finances), image2229); + image2311 = create_pixmap (main_window, "menu_finances.png"); + gtk_widget_show (image2311); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_finances), image2311); menu_show_stadium = gtk_image_menu_item_new_with_mnemonic (_("Show stadium")); gtk_widget_show (menu_show_stadium); @@ -990,9 +986,9 @@ create_main_window (void) GDK_f, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - image2230 = create_pixmap (main_window, "menu_stadium.png"); - gtk_widget_show (image2230); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_stadium), image2230); + image2312 = create_pixmap (main_window, "menu_stadium.png"); + gtk_widget_show (image2312); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_show_stadium), image2312); trennlinie15 = gtk_separator_menu_item_new (); gtk_widget_show (trennlinie15); @@ -1018,25 +1014,25 @@ create_main_window (void) gtk_widget_show (menu_about); gtk_container_add (GTK_CONTAINER (menu_help1_menu), menu_about); - image2231 = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2231); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_about), image2231); + image2313 = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2313); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_about), image2313); menu_contributors = gtk_image_menu_item_new_with_mnemonic (_("Contributors")); gtk_widget_show (menu_contributors); gtk_container_add (GTK_CONTAINER (menu_help1_menu), menu_contributors); - image2232 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2232); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_contributors), image2232); + image2314 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2314); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_contributors), image2314); menu_help = gtk_image_menu_item_new_with_mnemonic (_("Help")); gtk_widget_show (menu_help); gtk_container_add (GTK_CONTAINER (menu_help1_menu), menu_help); - image2233 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU); - gtk_widget_show (image2233); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_help), image2233); + image2315 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU); + gtk_widget_show (image2315); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_help), image2315); hbox1 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox1); @@ -1553,6 +1549,9 @@ create_main_window (void) g_signal_connect ((gpointer) menu_browse_teams, "activate", G_CALLBACK (on_menu_browse_teams_activate), NULL); + g_signal_connect ((gpointer) menu_show_job_exchange, "activate", + G_CALLBACK (on_menu_show_job_exchange_activate), + NULL); g_signal_connect ((gpointer) menu_show_info, "activate", G_CALLBACK (on_menu_show_info_activate), NULL); @@ -1649,6 +1648,9 @@ create_main_window (void) g_signal_connect ((gpointer) eventbox_boost, "button_press_event", G_CALLBACK (on_eventbox_boost_button_press_event), NULL); + g_signal_connect ((gpointer) hpaned2, "button_release_event", + G_CALLBACK (on_hpaned2_button_release_event), + NULL); g_signal_connect ((gpointer) player_list1, "button_press_event", G_CALLBACK (on_player_list1_button_press_event), NULL); @@ -1683,7 +1685,7 @@ create_main_window (void) GLADE_HOOKUP_OBJECT (main_window, menu_new, "menu_new"); GLADE_HOOKUP_OBJECT (main_window, menu_open, "menu_open"); GLADE_HOOKUP_OBJECT (main_window, menu_load_last_save, "menu_load_last_save"); - GLADE_HOOKUP_OBJECT (main_window, image2192, "image2192"); + GLADE_HOOKUP_OBJECT (main_window, image2274, "image2274"); GLADE_HOOKUP_OBJECT (main_window, menu_save, "menu_save"); GLADE_HOOKUP_OBJECT (main_window, menu_save_as, "menu_save_as"); GLADE_HOOKUP_OBJECT (main_window, trennlinie1, "trennlinie1"); @@ -1691,35 +1693,35 @@ create_main_window (void) GLADE_HOOKUP_OBJECT (main_window, menu_options, "menu_options"); GLADE_HOOKUP_OBJECT (main_window, menu_options_menu, "menu_options_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_preferences, "menu_preferences"); - GLADE_HOOKUP_OBJECT (main_window, image2193, "image2193"); + GLADE_HOOKUP_OBJECT (main_window, image2275, "image2275"); GLADE_HOOKUP_OBJECT (main_window, trennlinie7, "trennlinie7"); GLADE_HOOKUP_OBJECT (main_window, menu_job_offers, "menu_job_offers"); GLADE_HOOKUP_OBJECT (main_window, menu_live_game, "menu_live_game"); GLADE_HOOKUP_OBJECT (main_window, menu_overwrite, "menu_overwrite"); GLADE_HOOKUP_OBJECT (main_window, trennlinie14, "trennlinie14"); GLADE_HOOKUP_OBJECT (main_window, menu_save_window_geometry, "menu_save_window_geometry"); - GLADE_HOOKUP_OBJECT (main_window, image2194, "image2194"); + GLADE_HOOKUP_OBJECT (main_window, image2276, "image2276"); GLADE_HOOKUP_OBJECT (main_window, menu_figures, "menu_figures"); GLADE_HOOKUP_OBJECT (main_window, menu_figures_menu, "menu_figures_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_fixtures_week, "menu_fixtures_week"); - GLADE_HOOKUP_OBJECT (main_window, image2195, "image2195"); + GLADE_HOOKUP_OBJECT (main_window, image2277, "image2277"); GLADE_HOOKUP_OBJECT (main_window, menu_fixtures, "menu_fixtures"); - GLADE_HOOKUP_OBJECT (main_window, image2196, "image2196"); + GLADE_HOOKUP_OBJECT (main_window, image2278, "image2278"); GLADE_HOOKUP_OBJECT (main_window, menu_tables, "menu_tables"); - GLADE_HOOKUP_OBJECT (main_window, image2197, "image2197"); + GLADE_HOOKUP_OBJECT (main_window, image2279, "image2279"); GLADE_HOOKUP_OBJECT (main_window, menu_my_league_results, "menu_my_league_results"); - GLADE_HOOKUP_OBJECT (main_window, image2198, "image2198"); + GLADE_HOOKUP_OBJECT (main_window, image2280, "image2280"); GLADE_HOOKUP_OBJECT (main_window, menu_season_results, "menu_season_results"); - GLADE_HOOKUP_OBJECT (main_window, image2199, "image2199"); + GLADE_HOOKUP_OBJECT (main_window, image2281, "image2281"); GLADE_HOOKUP_OBJECT (main_window, trennlinie13, "trennlinie13"); GLADE_HOOKUP_OBJECT (main_window, menu_league_stats, "menu_league_stats"); - GLADE_HOOKUP_OBJECT (main_window, image2200, "image2200"); + GLADE_HOOKUP_OBJECT (main_window, image2282, "image2282"); GLADE_HOOKUP_OBJECT (main_window, menu_season_history, "menu_season_history"); - GLADE_HOOKUP_OBJECT (main_window, image2201, "image2201"); + GLADE_HOOKUP_OBJECT (main_window, image2283, "image2283"); GLADE_HOOKUP_OBJECT (main_window, menu_team, "menu_team"); GLADE_HOOKUP_OBJECT (main_window, menu_team_menu, "menu_team_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_playing_style, "menu_playing_style"); - GLADE_HOOKUP_OBJECT (main_window, image2202, "image2202"); + GLADE_HOOKUP_OBJECT (main_window, image2284, "image2284"); GLADE_HOOKUP_OBJECT (main_window, menu_playing_style_menu, "menu_playing_style_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_all_out_defend, "menu_all_out_defend"); GLADE_HOOKUP_OBJECT (main_window, menu_defend, "menu_defend"); @@ -1727,21 +1729,21 @@ create_main_window (void) GLADE_HOOKUP_OBJECT (main_window, menu_attack, "menu_attack"); GLADE_HOOKUP_OBJECT (main_window, menu_all_out_attack, "menu_all_out_attack"); GLADE_HOOKUP_OBJECT (main_window, menu_scout, "menu_scout"); - GLADE_HOOKUP_OBJECT (main_window, image2203, "image2203"); + GLADE_HOOKUP_OBJECT (main_window, image2285, "image2285"); GLADE_HOOKUP_OBJECT (main_window, menu_scout_menu, "menu_scout_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_scout_best, "menu_scout_best"); GLADE_HOOKUP_OBJECT (main_window, menu_scout_good, "menu_scout_good"); GLADE_HOOKUP_OBJECT (main_window, menu_scout_average, "menu_scout_average"); GLADE_HOOKUP_OBJECT (main_window, menu_scout_bad, "menu_scout_bad"); GLADE_HOOKUP_OBJECT (main_window, menu_physio, "menu_physio"); - GLADE_HOOKUP_OBJECT (main_window, image2204, "image2204"); + GLADE_HOOKUP_OBJECT (main_window, image2286, "image2286"); GLADE_HOOKUP_OBJECT (main_window, menu_physio_menu, "menu_physio_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_physio_best, "menu_physio_best"); GLADE_HOOKUP_OBJECT (main_window, menu_physio_good, "menu_physio_good"); GLADE_HOOKUP_OBJECT (main_window, menu_physio_average, "menu_physio_average"); GLADE_HOOKUP_OBJECT (main_window, menu_physio_bad, "menu_physio_bad"); GLADE_HOOKUP_OBJECT (main_window, menu_youth_academy, "menu_youth_academy"); - GLADE_HOOKUP_OBJECT (main_window, image2205, "image2205"); + GLADE_HOOKUP_OBJECT (main_window, image2287, "image2287"); GLADE_HOOKUP_OBJECT (main_window, menu_youth_academy_menu, "menu_youth_academy_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_show_youth_academy, "menu_show_youth_academy"); GLADE_HOOKUP_OBJECT (main_window, youth_coach1, "youth_coach1"); @@ -1759,81 +1761,83 @@ create_main_window (void) GLADE_HOOKUP_OBJECT (main_window, menu_recruit4, "menu_recruit4"); GLADE_HOOKUP_OBJECT (main_window, menu_set_investment, "menu_set_investment"); GLADE_HOOKUP_OBJECT (main_window, menu_boost, "menu_boost"); - GLADE_HOOKUP_OBJECT (main_window, image2206, "image2206"); + GLADE_HOOKUP_OBJECT (main_window, image2288, "image2288"); GLADE_HOOKUP_OBJECT (main_window, menu_boost_menu, "menu_boost_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_boost_on, "menu_boost_on"); GLADE_HOOKUP_OBJECT (main_window, menu_boost_off, "menu_boost_off"); GLADE_HOOKUP_OBJECT (main_window, menu_boost_anti, "menu_boost_anti"); GLADE_HOOKUP_OBJECT (main_window, trennlinie11, "trennlinie11"); GLADE_HOOKUP_OBJECT (main_window, menu_reset_players, "menu_reset_players"); - GLADE_HOOKUP_OBJECT (main_window, image2207, "image2207"); + GLADE_HOOKUP_OBJECT (main_window, image2289, "image2289"); GLADE_HOOKUP_OBJECT (main_window, menu_custom_structure, "menu_custom_structure"); - GLADE_HOOKUP_OBJECT (main_window, image2208, "image2208"); + GLADE_HOOKUP_OBJECT (main_window, image2290, "image2290"); GLADE_HOOKUP_OBJECT (main_window, menu_rearrange_team, "menu_rearrange_team"); - GLADE_HOOKUP_OBJECT (main_window, image2209, "image2209"); + GLADE_HOOKUP_OBJECT (main_window, image2291, "image2291"); GLADE_HOOKUP_OBJECT (main_window, trennlinie8, "trennlinie8"); GLADE_HOOKUP_OBJECT (main_window, menu_browse_teams, "menu_browse_teams"); - GLADE_HOOKUP_OBJECT (main_window, image2210, "image2210"); + GLADE_HOOKUP_OBJECT (main_window, image2292, "image2292"); + GLADE_HOOKUP_OBJECT (main_window, trennlinie16, "trennlinie16"); + GLADE_HOOKUP_OBJECT (main_window, menu_show_job_exchange, "menu_show_job_exchange"); GLADE_HOOKUP_OBJECT (main_window, menu_player, "menu_player"); GLADE_HOOKUP_OBJECT (main_window, menu_player_menu, "menu_player_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_show_info, "menu_show_info"); - GLADE_HOOKUP_OBJECT (main_window, image2211, "image2211"); + GLADE_HOOKUP_OBJECT (main_window, image2293, "image2293"); GLADE_HOOKUP_OBJECT (main_window, menu_put_on_transfer_list, "menu_put_on_transfer_list"); - GLADE_HOOKUP_OBJECT (main_window, image2212, "image2212"); + GLADE_HOOKUP_OBJECT (main_window, image2294, "image2294"); GLADE_HOOKUP_OBJECT (main_window, menu_remove_from_transfer_list, "menu_remove_from_transfer_list"); - GLADE_HOOKUP_OBJECT (main_window, image2213, "image2213"); + GLADE_HOOKUP_OBJECT (main_window, image2295, "image2295"); GLADE_HOOKUP_OBJECT (main_window, menu_offer_new_contract, "menu_offer_new_contract"); - GLADE_HOOKUP_OBJECT (main_window, image2214, "image2214"); + GLADE_HOOKUP_OBJECT (main_window, image2296, "image2296"); GLADE_HOOKUP_OBJECT (main_window, menu_fire, "menu_fire"); - GLADE_HOOKUP_OBJECT (main_window, image2215, "image2215"); + GLADE_HOOKUP_OBJECT (main_window, image2297, "image2297"); GLADE_HOOKUP_OBJECT (main_window, menu_shoots_penalties, "menu_shoots_penalties"); - GLADE_HOOKUP_OBJECT (main_window, image2216, "image2216"); + GLADE_HOOKUP_OBJECT (main_window, image2298, "image2298"); GLADE_HOOKUP_OBJECT (main_window, menu_move_to_youth_academy, "menu_move_to_youth_academy"); - GLADE_HOOKUP_OBJECT (main_window, image2217, "image2217"); + GLADE_HOOKUP_OBJECT (main_window, image2299, "image2299"); GLADE_HOOKUP_OBJECT (main_window, trennlinie10, "trennlinie10"); GLADE_HOOKUP_OBJECT (main_window, menu_browse_players, "menu_browse_players"); - GLADE_HOOKUP_OBJECT (main_window, image2218, "image2218"); + GLADE_HOOKUP_OBJECT (main_window, image2300, "image2300"); GLADE_HOOKUP_OBJECT (main_window, menu_user, "menu_user"); GLADE_HOOKUP_OBJECT (main_window, menu_user_menu, "menu_user_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_user_show_last_match, "menu_user_show_last_match"); - GLADE_HOOKUP_OBJECT (main_window, image2219, "image2219"); + GLADE_HOOKUP_OBJECT (main_window, image2301, "image2301"); GLADE_HOOKUP_OBJECT (main_window, menu_user_show_last_stats, "menu_user_show_last_stats"); - GLADE_HOOKUP_OBJECT (main_window, image2220, "image2220"); + GLADE_HOOKUP_OBJECT (main_window, image2302, "image2302"); GLADE_HOOKUP_OBJECT (main_window, menu_user_show_coming_matches, "menu_user_show_coming_matches"); - GLADE_HOOKUP_OBJECT (main_window, image2221, "image2221"); + GLADE_HOOKUP_OBJECT (main_window, image2303, "image2303"); GLADE_HOOKUP_OBJECT (main_window, memorable_matches, "memorable_matches"); - GLADE_HOOKUP_OBJECT (main_window, image2222, "image2222"); + GLADE_HOOKUP_OBJECT (main_window, image2304, "image2304"); GLADE_HOOKUP_OBJECT (main_window, memorable_matches_menu, "memorable_matches_menu"); GLADE_HOOKUP_OBJECT (main_window, mm_add_last_match, "mm_add_last_match"); - GLADE_HOOKUP_OBJECT (main_window, image2223, "image2223"); + GLADE_HOOKUP_OBJECT (main_window, image2305, "image2305"); GLADE_HOOKUP_OBJECT (main_window, mm_manage_matches, "mm_manage_matches"); - GLADE_HOOKUP_OBJECT (main_window, image2224, "image2224"); + GLADE_HOOKUP_OBJECT (main_window, image2306, "image2306"); GLADE_HOOKUP_OBJECT (main_window, trennlinie12, "trennlinie12"); GLADE_HOOKUP_OBJECT (main_window, menu_user_show_history, "menu_user_show_history"); - GLADE_HOOKUP_OBJECT (main_window, image2225, "image2225"); + GLADE_HOOKUP_OBJECT (main_window, image2307, "image2307"); GLADE_HOOKUP_OBJECT (main_window, trennlinie9, "trennlinie9"); GLADE_HOOKUP_OBJECT (main_window, menu_next_user, "menu_next_user"); - GLADE_HOOKUP_OBJECT (main_window, image2226, "image2226"); + GLADE_HOOKUP_OBJECT (main_window, image2308, "image2308"); GLADE_HOOKUP_OBJECT (main_window, menu_previous_user, "menu_previous_user"); - GLADE_HOOKUP_OBJECT (main_window, image2227, "image2227"); + GLADE_HOOKUP_OBJECT (main_window, image2309, "image2309"); GLADE_HOOKUP_OBJECT (main_window, menu_manage_users, "menu_manage_users"); - GLADE_HOOKUP_OBJECT (main_window, image2228, "image2228"); + GLADE_HOOKUP_OBJECT (main_window, image2310, "image2310"); GLADE_HOOKUP_OBJECT (main_window, menu_finances_stadium, "menu_finances_stadium"); GLADE_HOOKUP_OBJECT (main_window, menu_finances_stadium_menu, "menu_finances_stadium_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_show_finances, "menu_show_finances"); - GLADE_HOOKUP_OBJECT (main_window, image2229, "image2229"); + GLADE_HOOKUP_OBJECT (main_window, image2311, "image2311"); GLADE_HOOKUP_OBJECT (main_window, menu_show_stadium, "menu_show_stadium"); - GLADE_HOOKUP_OBJECT (main_window, image2230, "image2230"); + GLADE_HOOKUP_OBJECT (main_window, image2312, "image2312"); GLADE_HOOKUP_OBJECT (main_window, trennlinie15, "trennlinie15"); GLADE_HOOKUP_OBJECT (main_window, menu_betting, "menu_betting"); GLADE_HOOKUP_OBJECT (main_window, menu_help1, "menu_help1"); GLADE_HOOKUP_OBJECT (main_window, menu_help1_menu, "menu_help1_menu"); GLADE_HOOKUP_OBJECT (main_window, menu_about, "menu_about"); - GLADE_HOOKUP_OBJECT (main_window, image2231, "image2231"); + GLADE_HOOKUP_OBJECT (main_window, image2313, "image2313"); GLADE_HOOKUP_OBJECT (main_window, menu_contributors, "menu_contributors"); - GLADE_HOOKUP_OBJECT (main_window, image2232, "image2232"); + GLADE_HOOKUP_OBJECT (main_window, image2314, "image2314"); GLADE_HOOKUP_OBJECT (main_window, menu_help, "menu_help"); - GLADE_HOOKUP_OBJECT (main_window, image2233, "image2233"); + GLADE_HOOKUP_OBJECT (main_window, image2315, "image2315"); GLADE_HOOKUP_OBJECT (main_window, hbox1, "hbox1"); GLADE_HOOKUP_OBJECT (main_window, button_load, "button_load"); GLADE_HOOKUP_OBJECT (main_window, image11, "image11"); diff --git a/src/league.c b/src/league.c index 0ba987bc..72b1e19f 100644 --- a/src/league.c +++ b/src/league.c @@ -76,7 +76,7 @@ league_new(gboolean new_id) new.round_robins = 2; new.yellow_red = 1000; - new.stats = stat_league_new(new.id); + new.stats = stat_league_new("", ""); new.active = TRUE; @@ -731,12 +731,14 @@ league_team_movements_assign_dest(GArray *team_movements, gint idx, { if(tmove->prom_rel_type == PROM_REL_PROMOTION) user_history_add(&usr(team_is_user(&tmove->tm)), - USER_HISTORY_PROMOTED, tmove->tm.id, - lig(g_array_index(tmove->dest_idcs, gint, 0)).id, -1, ""); + USER_HISTORY_PROMOTED, tmove->tm.name, + lig(g_array_index(tmove->dest_idcs, gint, 0)).name, + NULL, NULL); else user_history_add(&usr(team_is_user(&tmove->tm)), - USER_HISTORY_RELEGATED, tmove->tm.id, - lig(g_array_index(tmove->dest_idcs, gint, 0)).id, -1, ""); + USER_HISTORY_RELEGATED, tmove->tm.name, + lig(g_array_index(tmove->dest_idcs, gint, 0)).name, + NULL, NULL); } } diff --git a/src/load_save.c b/src/load_save.c index dfa2ee45..237ee138 100644 --- a/src/load_save.c +++ b/src/load_save.c @@ -35,16 +35,17 @@ #include "user.h" #include "variables.h" #include "window.h" -#include "xml_loadsave_misc.h" #include "xml_loadsave_cup.h" +#include "xml_loadsave_jobs.h" #include "xml_loadsave_league.h" #include "xml_loadsave_leagues_cups.h" +#include "xml_loadsave_misc.h" #include "xml_loadsave_season_stats.h" #include "xml_loadsave_transfers.h" #include "xml_loadsave_users.h" #include "xml.h" -#define PROGRESS_MAX 7 +#define PROGRESS_MAX 8 /** Save the game to the specified file. */ void @@ -119,6 +120,18 @@ load_save_save_game(const gchar *filename) xml_loadsave_season_stats_write(prefix); + if(debug > 60) + printf("load_save_save jobs \n"); + + gui_show_progress( + ((PROGRESS_MAX * gtk_progress_bar_get_fraction( + GTK_PROGRESS_BAR( + lookup_widget(window.progress, "progressbar")))) + 1) / PROGRESS_MAX, + _("Saving job exchange..."), + PIC_TYPE_SAVE); + + xml_loadsave_jobs_write(prefix); + if(debug > 60) printf("load_save_save misc \n"); @@ -259,6 +272,18 @@ load_save_load_game(const gchar* filename, gboolean create_main_window) xml_loadsave_season_stats_read(dirname, prefix); + if(debug > 60) + printf("load_save_load jobs \n"); + + gui_show_progress( + ((PROGRESS_MAX * gtk_progress_bar_get_fraction( + GTK_PROGRESS_BAR( + lookup_widget(window.progress, "progressbar")))) + 1) / PROGRESS_MAX, + _("Loading job exchange..."), + PIC_TYPE_LOAD); + + xml_loadsave_jobs_read(dirname, prefix); + if(debug > 60) printf("load_save_load misc \n"); diff --git a/src/main.c b/src/main.c index 23900f27..5fbd4118 100644 --- a/src/main.c +++ b/src/main.c @@ -35,12 +35,13 @@ #include "debug.h" #include "file.h" #include "free.h" +#include "job_struct.h" #include "language.h" #include "lg_commentary.h" #include "live_game.h" #include "load_save.h" #include "main.h" -#include "mediaplayer.h" +/* #include "mediaplayer.h" */ #include "misc.h" #include "misc_callbacks.h" #include "name_struct.h" @@ -183,6 +184,8 @@ main_init_variables(void) strategies = g_array_new(FALSE, FALSE, sizeof(Strategy)); bets[0] = g_array_new(FALSE, FALSE, sizeof(BetMatch)); bets[1] = g_array_new(FALSE, FALSE, sizeof(BetMatch)); + jobs = g_array_new(FALSE, FALSE, sizeof(Job)); + job_teams = g_array_new(FALSE, FALSE, sizeof(Team)); save_file = NULL; @@ -279,7 +282,7 @@ main (gint argc, gchar *argv[]) gtk_set_locale (); gtk_init (&argc, &argv); - mediaplayer_init(&argc, &argv); + /* mediaplayer_init(&argc, &argv); */ main_init(&argc, &argv); diff --git a/src/misc.c b/src/misc.c index 09abfdf8..877ff3b3 100644 --- a/src/misc.c +++ b/src/misc.c @@ -458,6 +458,9 @@ misc_parse(const gchar *s, gint *result) void misc_string_assign(gchar **string, const gchar *contents) { + if(contents == NULL) + return; + if(*string != NULL) g_free(*string); diff --git a/src/misc2_callback_func.c b/src/misc2_callback_func.c index ba2bb34c..1a8b0e60 100644 --- a/src/misc2_callback_func.c +++ b/src/misc2_callback_func.c @@ -29,6 +29,7 @@ #include "finance.h" #include "free.h" #include "game_gui.h" +#include "league.h" #include "maths.h" #include "misc.h" #include "misc2_callback_func.h" @@ -231,7 +232,9 @@ misc2_callback_add_user(void) new_user.tm = tm; new_user.team_id = tm->id; - user_history_add(&new_user, USER_HISTORY_START_GAME, tm->id, tm->clid, -1, ""); + user_history_add(&new_user, USER_HISTORY_START_GAME, + tm->name, league_cup_get_name_string(tm->clid), + NULL, NULL); g_array_append_val(users, new_user); diff --git a/src/misc2_callbacks.c b/src/misc2_callbacks.c index cba2bae4..f9262ae5 100644 --- a/src/misc2_callbacks.c +++ b/src/misc2_callbacks.c @@ -30,6 +30,8 @@ #include "finance.h" #include "free.h" #include "game_gui.h" +#include "league.h" +#include "job.h" #include "load_save.h" #include "main.h" #include "misc2_callbacks.h" @@ -37,6 +39,7 @@ #include "misc2_interface.h" #include "player.h" #include "support.h" +#include "team.h" #include "transfer.h" #include "treeview.h" #include "treeview2.h" @@ -44,38 +47,72 @@ #include "user.h" #include "window.h" -gboolean -on_button_cancel_clicked (GtkWidget *widget, - GdkEvent *event, - gpointer user_data) -{ - - return FALSE; -} - - -void -on_button_ok_clicked (GtkButton *button, - gpointer user_data) -{ - -} - - void on_button_offer_ok_clicked (GtkButton *button, gpointer user_data) { - if(stat2 == STATUS_JOB_OFFER_SUCCESS) - user_history_add(¤t_user, USER_HISTORY_JOB_OFFER_ACCEPTED, - current_user.tm->id, ((Team*)statp)->id, ((Team*)statp)->clid, ""); + gboolean changed = TRUE; + gchar *team_name = g_strdup(current_user.tm->name); - user_change_team(¤t_user, (Team*)statp); + if(stat2 == STATUS_JOB_EXCHANGE_SHOW_TEAM) + { + if(query_job_application_successful((Job*)statp, ¤t_user)) + { + if(((Job*)statp)->type != JOB_TYPE_NATIONAL) + { + game_gui_show_warning( + _("The owners of %s accept your application. Since %s don't want to get stuck with a lame duck, you get fired instantly and spend the rest of the current season tending your garden."), + job_get_team((Job*)statp)->name, current_user.tm->name); + job_change_country((Job*)statp); + } + else + game_gui_show_warning( + _("The owners of %s accept your application."), + current_user.tm->name); - stat0 = STATUS_MAIN; - game_gui_show_main(); + printf("misc2 1\n"); + user_change_team(¤t_user, team_of_id(((Job*)statp)->team_id)); - window_destroy(&window.job_offer, TRUE); + printf("misc2 2\n"); + if(((Job*)statp)->type == JOB_TYPE_NATIONAL) + job_remove((Job*)statp, TRUE); + else + { + job_remove((Job*)statp, FALSE); + job_remove_national(); + } + printf("misc2 3\n"); + + } + else + { + game_gui_show_warning( + _("The owners of %s politely reject your application. You're not successful enough in their eyes."), + job_get_team((Job*)statp)->name); + changed = FALSE; + } + } + else + user_change_team(¤t_user, (Team*)statp); + + printf("misc2 4\n"); + if(changed) + { + if(stat2 == STATUS_JOB_OFFER_SUCCESS || + stat2 == STATUS_JOB_EXCHANGE_SHOW_TEAM) + user_history_add(¤t_user, USER_HISTORY_JOB_OFFER_ACCEPTED, + team_name, + current_user.tm->name, + league_cup_get_name_string(current_user.tm->clid), + NULL); + + stat0 = STATUS_MAIN; + game_gui_show_main(); + } + + g_free(team_name); + + window_destroy(&window.job_offer, FALSE); setsav0; } @@ -85,7 +122,8 @@ void on_button_offer_cancel_clicked (GtkButton *button, gpointer user_data) { - if(stat2 != STATUS_JOB_OFFER_SUCCESS) + if(stat2 != STATUS_JOB_OFFER_SUCCESS && + stat2 != STATUS_JOB_EXCHANGE_SHOW_TEAM) { if(users->len == 1) main_exit_program(EXIT_USER_FIRED, NULL); @@ -96,9 +134,13 @@ on_button_offer_cancel_clicked (GtkButton *button, } } - window_destroy(&window.job_offer, TRUE); - stat0 = STATUS_MAIN; - game_gui_show_main(); + window_destroy(&window.job_offer, FALSE); + + if(stat0 != STATUS_SHOW_JOB_EXCHANGE) + { + stat0 = STATUS_MAIN; + game_gui_show_main(); + } } diff --git a/src/misc2_callbacks.h b/src/misc2_callbacks.h index 524d581e..5babb3bc 100644 --- a/src/misc2_callbacks.h +++ b/src/misc2_callbacks.h @@ -29,15 +29,6 @@ #include -gboolean -on_button_cancel_clicked (GtkWidget *widget, - GdkEvent *event, - gpointer user_data); - -void -on_button_ok_clicked (GtkButton *button, - gpointer user_data); - void on_button_offer_ok_clicked (GtkButton *button, gpointer user_data); diff --git a/src/misc2_interface.c b/src/misc2_interface.c index 8c2d2403..7745113a 100644 --- a/src/misc2_interface.c +++ b/src/misc2_interface.c @@ -70,7 +70,8 @@ create_window_job_offer (void) gtk_container_set_border_width (GTK_CONTAINER (window_job_offer), 6); gtk_window_set_title (GTK_WINDOW (window_job_offer), _("Job offer")); gtk_window_set_position (GTK_WINDOW (window_job_offer), GTK_WIN_POS_CENTER); - gtk_window_set_default_size (GTK_WINDOW (window_job_offer), -1, 600); + gtk_window_set_modal (GTK_WINDOW (window_job_offer), TRUE); + gtk_window_set_default_size (GTK_WINDOW (window_job_offer), 500, 600); vbox5 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox5); diff --git a/src/misc_callback_func.c b/src/misc_callback_func.c index 410d7a7f..338a3148 100644 --- a/src/misc_callback_func.c +++ b/src/misc_callback_func.c @@ -54,7 +54,7 @@ misc_callback_show_team_list(GtkWidget *widget, const gchar *country_file) GtkWidget *treeview_startup = lookup_widget(widget, "treeview_startup"); - xml_country_read(country_file); + xml_country_read(country_file, NULL); treeview_show_team_list(GTK_TREE_VIEW(treeview_startup), FALSE, FALSE); diff --git a/src/start_end.c b/src/start_end.c index ed0de3d3..12a96b05 100644 --- a/src/start_end.c +++ b/src/start_end.c @@ -31,6 +31,7 @@ #include "free.h" #include "game_gui.h" #include "gui.h" +#include "job.h" #include "league.h" #include "live_game.h" #include "load_save.h" @@ -69,7 +70,7 @@ WeekFunc start_week_round_funcs[] = WeekFunc start_week_funcs[] = {start_week_add_cups, start_week_update_users, start_week_update_teams, start_week_update_user_finances, - youth_academy_update_weekly, transfer_update, NULL}; + youth_academy_update_weekly, transfer_update, job_update, NULL}; WeekFunc end_week_funcs[] = {stat_update_leagues, end_week_hide_cups, NULL}; @@ -88,6 +89,7 @@ void start_new_season(void) { gint i, j; + gchar buf[SMALL]; week = week_round = 1; free_names(TRUE); @@ -102,6 +104,7 @@ start_new_season(void) g_ptr_array_remove_index(acps, i); } + printf("s1\n"); for(i=cps->len - 1; i >= 0; i--) if(cp(i).add_week == -1) { @@ -109,12 +112,17 @@ start_new_season(void) fixture_write_cup_fixtures(&cp(i)); } + printf("s2\n"); if(season > 1) { for(i=0;ilen;i++) + { + sprintf(buf, "%d", team_get_league_rank(usr(i).tm)); user_history_add(&usr(i), USER_HISTORY_END_SEASON, - usr(i).team_id, usr(i).tm->clid, - team_get_league_rank(usr(i).tm), ""); + usr(i).tm->name, + league_cup_get_name_string(usr(i).tm->clid), + buf, NULL); + } start_new_season_league_changes(); @@ -136,17 +144,25 @@ start_new_season(void) g_ptr_array_add(acps, &cp(i)); } + printf("s3\n"); for(i=0;ilen;i++) if(lig(i).active) fixture_write_league_fixtures(&lig(i)); + printf("s4\n"); for(i=cps->len - 1; i >= 0; i--) + { + printf("%d %s adw %d\n", i, cp(i).name, cp(i).add_week); + if(cp(i).add_week >= 0) { + printf("res\n"); cup_reset(&cp(i)); + printf("fix\n"); if(cp(i).add_week == 0) fixture_write_cup_fixtures(&cp(i)); + printf("done\n"); } else if(cp(i).add_week == -1) { @@ -158,7 +174,11 @@ start_new_season(void) team_of_id(g_array_index(cp(i).fixtures, Fixture, j).team_ids[1]); } } + + printf("#%d %s adw %d\n", i, cp(i).name, cp(i).add_week); + } + printf("s5\n"); stat5 = -1; for(i=0;ilen;i++) @@ -166,6 +186,8 @@ start_new_season(void) if(season == 1) bet_update(); + + printf("s6\n"); } /** Fill some global variables with default values at the @@ -196,7 +218,7 @@ start_generate_league_teams(void) for(i=0;ilen;i++) for(j=0;jlen;j++) - team_generate_players_stadium(&g_array_index(lig(i).teams, Team, j)); + team_generate_players_stadium(&g_array_index(lig(i).teams, Team, j), 0); stat5 = -1; } @@ -365,8 +387,11 @@ end_week_round_update_fixtures(void) 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, ""); + USER_HISTORY_CHAMPION, + g_array_index(lig(i).table.elements, + TableElement, 0).team->name, + league_cup_get_name_string(lig(i).id), + NULL, NULL); for(i=0;ilen;i++) { @@ -569,12 +594,6 @@ start_new_season_league_changes(void) for(i=0;ilen;i++) league_size[i] = lig(i).teams->len; - /*d*/ - for(i=0;ilen;i++) - printf("# %d %s %d\n", i, - g_array_index(lig(1).teams, Team, i).name, - g_array_index(lig(1).teams, Team, i).id); - for(i=0;ilen;i++) league_remove_team_with_id( league_from_clid(g_array_index(team_movements, TeamMove, i).tm.clid), @@ -583,17 +602,21 @@ start_new_season_league_changes(void) league_team_movements_destinations(team_movements, league_size); for(i = team_movements->len - 1; i >= 0; i--) - if(g_array_index(team_movements, TeamMove, i).prom_rel_type == PROM_REL_RELEGATION) + if(g_array_index(team_movements, TeamMove, i).prom_rel_type == + PROM_REL_RELEGATION) g_array_prepend_val( lig(g_array_index( - g_array_index(team_movements, TeamMove, i).dest_idcs, gint, 0)).teams, + g_array_index(team_movements, TeamMove, i).dest_idcs, + gint, 0)).teams, g_array_index(team_movements, TeamMove, i).tm); for(i=1;ilen;i++) - if(g_array_index(team_movements, TeamMove, i).prom_rel_type != PROM_REL_RELEGATION) + if(g_array_index(team_movements, TeamMove, i).prom_rel_type != + PROM_REL_RELEGATION) g_array_append_val( lig(g_array_index( - g_array_index(team_movements, TeamMove, i).dest_idcs, gint, 0)).teams, + g_array_index(team_movements, TeamMove, i).dest_idcs, + gint, 0)).teams, g_array_index(team_movements, TeamMove, i).tm); for(i=0;ilen;i++) @@ -606,7 +629,8 @@ start_new_season_league_changes(void) { g_array_index(lig(i).teams, Team, j).clid = lig(i).id; for(k=0;klen;k++) - g_array_index(g_array_index(lig(i).teams, Team, j).players, Player, k).team = + g_array_index(g_array_index(lig(i).teams, Team, j).players, + Player, k).team = &g_array_index(lig(i).teams, Team, j); } diff --git a/src/stat.c b/src/stat.c index d00d4a7b..cb34296f 100644 --- a/src/stat.c +++ b/src/stat.c @@ -33,13 +33,15 @@ #include "team.h" #include "variables.h" -/** Return a newly allocated league stat with given clid. */ +/** Return a newly allocated league stat with specified + league name and symbol. */ LeagueStat -stat_league_new(gint clid) +stat_league_new(const gchar *league_name, const gchar *league_symbol) { LeagueStat new; - - new.clid = clid; + + new.league_name = g_strdup(league_name); + new.league_symbol = g_strdup(league_symbol); new.teams_off = g_array_new(FALSE, FALSE, sizeof(Stat)); new.teams_def = g_array_new(FALSE, FALSE, sizeof(Stat)); new.player_scorers = g_array_new(FALSE, FALSE, sizeof(Stat)); @@ -60,8 +62,12 @@ stat_update_leagues(void) lig(i).fixtures, Fixture, lig(i).fixtures->len - 1).week_number >= week) { free_league_stats(&lig(i).stats); - lig(i).stats.teams_off = stat_update_league_teams(lig(i).teams, TEAM_COMPARE_OFFENSIVE); - lig(i).stats.teams_def = stat_update_league_teams(lig(i).teams, TEAM_COMPARE_DEFENSE); + lig(i).stats.league_name = g_strdup(lig(i).name); + lig(i).stats.league_symbol = g_strdup(lig(i).symbol); + lig(i).stats.teams_off = + stat_update_league_teams(lig(i).teams, TEAM_COMPARE_OFFENSIVE); + lig(i).stats.teams_def = + stat_update_league_teams(lig(i).teams, TEAM_COMPARE_DEFENSE); stat_update_league_players(&lig(i)); } } @@ -103,7 +109,7 @@ stat_update_league_players(League *league) for(j=0;jteam->id; + new_stat.team_name = g_strdup(pl->team->name); new_stat.value_string = g_strdup(pl->name); new_stat.value1 = player_games_goals_get(pl, pl->team->clid, PLAYER_VALUE_GOALS); @@ -138,9 +144,11 @@ stat_update_league_teams(const GArray *teams_array, gint compare_type) for(i=0;iid; - new_stat.value1 = team_get_table_value((Team*)g_ptr_array_index(teams, i), TABLE_GF); - new_stat.value2 = team_get_table_value((Team*)g_ptr_array_index(teams, i), TABLE_GA); + new_stat.team_name = g_strdup(((Team*)g_ptr_array_index(teams, i))->name); + new_stat.value1 = + team_get_table_value((Team*)g_ptr_array_index(teams, i), TABLE_GF); + new_stat.value2 = + team_get_table_value((Team*)g_ptr_array_index(teams, i), TABLE_GA); new_stat.value3 = -1; new_stat.value_string = NULL; @@ -182,7 +190,7 @@ stat_create_season_stat(void) g_array_append_val(new.league_champs, new_champ); g_array_append_val(new.league_stats, lig(i).stats); - lig(i).stats = stat_league_new(lig(i).id); + lig(i).stats = stat_league_new(lig(i).name, lig(i).symbol); } for(i=0;ilen;i++) diff --git a/src/stat.h b/src/stat.h index ff56da30..27614cd4 100644 --- a/src/stat.h +++ b/src/stat.h @@ -34,7 +34,7 @@ SeasonStat stat_season_stat_new(gint season_number); LeagueStat -stat_league_new(gint clid); +stat_league_new(const gchar *league_name, const gchar *league_symbol); GArray* stat_update_league_teams(const GArray *teams, gint compare_type); diff --git a/src/stat_struct.h b/src/stat_struct.h index 427db1ec..0aa5af83 100644 --- a/src/stat_struct.h +++ b/src/stat_struct.h @@ -30,16 +30,17 @@ string and integer values. */ typedef struct { - gint team_id; + gchar *team_name; gint value1, value2, value3; gchar *value_string; } Stat; /** A structure holding some stat arrays about a league. */ typedef struct -{ - /** The league id. */ - gint clid; +{ + gchar *league_symbol; + gchar *league_name; + /** Best offensive and defensive teams. */ GArray *teams_off, *teams_def; /** Best goal getters and goalies. */ diff --git a/src/strategy.h b/src/strategy.h index f023ca99..c169fdf1 100644 --- a/src/strategy.h +++ b/src/strategy.h @@ -27,8 +27,9 @@ #define STRATEGY_H #include "bygfoot.h" +#include "player_struct.h" #include "strategy_struct.h" -/* #include "team_struct.h" */ +#include "team_struct.h" #include "variables.h" void diff --git a/src/support.c b/src/support.c index c108b9da..00aff298 100644 --- a/src/support.c +++ b/src/support.c @@ -1,28 +1,3 @@ -/* - support.c - - Bygfoot Football Manager -- a small and simple GTK2-based - football management game. - - http://bygfoot.sourceforge.net - - Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com) - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - /* * DO NOT EDIT THIS FILE - it is generated by Glade. */ diff --git a/src/support.h b/src/support.h index e545646e..a32649e5 100644 --- a/src/support.h +++ b/src/support.h @@ -1,28 +1,3 @@ -/* - support.h - - Bygfoot Football Manager -- a small and simple GTK2-based - football management game. - - http://bygfoot.sourceforge.net - - Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com) - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - /* * DO NOT EDIT THIS FILE - it is generated by Glade. */ diff --git a/src/team.c b/src/team.c index 8d3f607f..2d5fd4b6 100644 --- a/src/team.c +++ b/src/team.c @@ -71,14 +71,14 @@ team_new(gboolean new_id) /* Fill the players array of the team and the stadium. @param tm The team that gets filled. */ void -team_generate_players_stadium(Team *tm) +team_generate_players_stadium(Team *tm, gfloat av_talent) { gint i; gfloat skill_factor = math_rnd(1 - const_float("float_team_skill_variance"), 1 + const_float("float_team_skill_variance")); Player new; - gfloat wages = 0, average_talent; - gchar *def_file = team_has_def_file(tm); + gfloat wages = 0, average_talent, league_av_talent; + gchar *def_file = team_has_def_file(tm); tm->strategy_sid = strategy_get_random(); @@ -89,9 +89,13 @@ team_generate_players_stadium(Team *tm) const_float("float_team_stadium_safety_upper")); if(tm->clid < ID_CUP_START) + { + league_av_talent = (av_talent > 0) ? + av_talent : league_from_clid(tm->clid)->average_talent; average_talent = (tm->average_talent == 0) ? - skill_factor * league_from_clid(tm->clid)->average_talent : + skill_factor * league_av_talent : tm->average_talent; + } else average_talent = skill_factor * team_get_average_talents(lig(0).teams) * @@ -321,6 +325,21 @@ team_is_user(const Team *tm) return -1; } +/** Check whether the team with given name is a user-managed team. + @param team_name The team name we examine. + @return The user's index in the #users array or -1.*/ +gint +team_name_is_user(const gchar *team_name) +{ + gint i; + + for(i=0;ilen;i++) + if(strcmp(team_name, usr(i).tm->name) == 0) + return i; + + return -1; +} + /** Return the overall average skill or the cskill of the first 11 players. @param tm The team we examine. diff --git a/src/team.h b/src/team.h index e6efc2ab..3e9132fc 100644 --- a/src/team.h +++ b/src/team.h @@ -50,7 +50,7 @@ gboolean query_is_my_team(const Team *tm); void -team_generate_players_stadium(Team *tm); +team_generate_players_stadium(Team *tm, gfloat av_talent); gboolean query_team_is_in_cups(const Team *tm, gint group); @@ -73,6 +73,9 @@ team_get_average_skill(const Team *tm, gboolean cskill); gfloat team_get_average_talent(const Team *tm); +gint +team_name_is_user(const gchar *team_name); + gint team_is_user(const Team *tm); diff --git a/src/treeview.c b/src/treeview.c index 1d4e9358..01ec7db4 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -936,14 +936,15 @@ treeview_create_fixture(const Fixture *fix, GtkListStore *ls) gchar *symbol[2] = {NULL, NULL}; gchar buf_result[SMALL], buf[3][SMALL]; gchar *colour_fg = NULL, *colour_bg = NULL; + gint user_idx = fixture_user_team_involved(fix); if(fix->clid >= ID_CUP_START && query_cup_is_international(fix->clid)) for(i=0;i<2;i++) symbol[i] = fix->teams[i]->symbol; - if(fixture_user_team_involved(fix) != -1) - treeview_helper_set_user_colours(usr(fixture_user_team_involved(fix)).tm, + if(user_idx != -1) + treeview_helper_set_user_colours(usr(user_idx).tm->name, &colour_bg, &colour_fg); else { @@ -2040,7 +2041,7 @@ treeview_create_user_history(void) gtk_list_store_set(ls, &iter, 0, g_array_index(current_user.history, UserHistory, i).season, 1, g_array_index(current_user.history, UserHistory, i).week, - 2, team_of_id(g_array_index(current_user.history, UserHistory, i).team_id)->name, + 2, g_array_index(current_user.history, UserHistory, i).team_name, 4, buf, -1); } @@ -2129,9 +2130,10 @@ treeview_create_league_stats(GtkListStore *ls, const LeagueStat *league_stat) gchar *colour_fg = NULL, *colour_bg = NULL; gtk_list_store_append(ls, &iter); - treeview_helper_insert_icon(ls, &iter, 0, league_from_clid(league_stat->clid)->symbol); + treeview_helper_insert_icon(ls, &iter, 0, + league_stat->league_symbol); gtk_list_store_set(ls, &iter, 1, const_int("int_treeview_helper_int_empty"), - 2, league_cup_get_name_string(league_stat->clid), 3, "", 4, "", 5, "", -1); + 2, league_stat->league_name, 3, "", 4, "", 5, "", -1); for(i=0;i<2;i++) { @@ -2151,11 +2153,13 @@ treeview_create_league_stats(GtkListStore *ls, const LeagueStat *league_stat) g_array_index(teams[i], Stat, j).value1, g_array_index(teams[i], Stat, j).value2); - treeview_helper_set_user_colours(team_of_id(g_array_index(teams[i], Stat, j).team_id), - &colour_bg, &colour_fg); + treeview_helper_set_user_colours( + g_array_index(teams[i], Stat, j).team_name, + &colour_bg, &colour_fg); sprintf(buf2, "%s", - colour_bg, colour_fg, team_of_id(g_array_index(teams[i], Stat, j).team_id)->name); + colour_bg, colour_fg, + g_array_index(teams[i], Stat, j).team_name); gtk_list_store_append(ls, &iter); gtk_list_store_set(ls, &iter, 0, NULL, 1, j + 1, @@ -2193,12 +2197,13 @@ treeview_create_league_stats(GtkListStore *ls, const LeagueStat *league_stat) 100 * (1 - (gfloat)g_array_index(players[i], Stat, j).value1 / (gfloat)g_array_index(players[i], Stat, j).value3) : 0); - treeview_helper_set_user_colours(team_of_id(g_array_index(players[i], Stat, j).team_id), - &colour_bg, &colour_fg); + treeview_helper_set_user_colours( + g_array_index(players[i], Stat, j).team_name, + &colour_bg, &colour_fg); sprintf(buf3, "%s (%s)", colour_bg, colour_fg, g_array_index(players[i], Stat, j).value_string, - team_of_id(g_array_index(players[i], Stat, j).team_id)->name); + g_array_index(players[i], Stat, j).team_name); sprintf(buf4, "%d", g_array_index(players[i], Stat, j).value1); gtk_list_store_append(ls, &iter); @@ -2300,11 +2305,12 @@ treeview_create_season_history_champions(GtkListStore *ls, const GArray* league_ } } -/** Show the season history of the specified season - and the specified page. Page is either a page of league stats +/** Show the season history with given index in the season_stats array + and the specified page. + @param page Either a page of league stats (if != -1) or -1 which means we show the champions. */ void -treeview_show_season_history(gint page, gint season_number) +treeview_show_season_history(gint page, gint idx) { gchar buf[SMALL]; GtkTreeView *treeview = GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")); @@ -2312,24 +2318,24 @@ treeview_show_season_history(gint page, gint season_number) gtk_list_store_new(6, GDK_TYPE_PIXBUF, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); GtkTreeIter iter; - SeasonStat *stat = &g_array_index(season_stats, SeasonStat, season_number); + SeasonStat *stat = &g_array_index(season_stats, SeasonStat, idx); treeview_helper_clear(treeview); treeview_set_up_league_stats(treeview); - sprintf(buf, _("Season %d"), season_number + 1); + sprintf(buf, _("Season %d"), stat->season_number); gtk_list_store_append(model, &iter); gtk_list_store_set(model, &iter, 0, NULL, 1, const_int("int_treeview_helper_int_empty"), 2, buf, -1); if(page != -1) - treeview_create_league_stats(model, - &g_array_index(stat->league_stats, LeagueStat, page)); + treeview_create_league_stats( + model, &g_array_index(stat->league_stats, LeagueStat, page)); else - treeview_create_season_history_champions(model, stat->league_champs, - stat->cup_champs); + treeview_create_season_history_champions( + model, stat->league_champs, stat->cup_champs); gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(model)); g_object_unref(model); diff --git a/src/treeview.h b/src/treeview.h index 88324933..1b8d167d 100644 --- a/src/treeview.h +++ b/src/treeview.h @@ -211,7 +211,7 @@ void treeview_create_league_stats(GtkListStore *ls, const LeagueStat *league_stat); void -treeview_show_season_history(gint page, gint season_number); +treeview_show_season_history(gint page, gint idx); void treeview_create_season_history_champions(GtkListStore *ls, const GArray* league_champs, diff --git a/src/treeview2.c b/src/treeview2.c index 39e67971..eb39a990 100644 --- a/src/treeview2.c +++ b/src/treeview2.c @@ -25,6 +25,7 @@ #include "bet.h" #include "fixture.h" +#include "job.h" #include "league.h" #include "live_game.h" #include "misc.h" @@ -427,3 +428,102 @@ treeview2_show_bets(void) gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(model)); g_object_unref(model); } + +void +treeview2_create_job_exchange(GtkListStore *ls) +{ + gint i; + GtkTreeIter iter; + gchar buf[SMALL]; + const Team *tm = NULL; + + for(i=0;ilen;i++) + { + tm = job_get_team(&g_array_index(jobs, Job, i)); + sprintf(buf, "%s (%d)", g_array_index(jobs, Job, i).league_name, + g_array_index(jobs, Job, i).league_layer); + + gtk_list_store_append(ls, &iter); + gtk_list_store_set(ls, &iter, 0, i + 1, + 1, tm->name, + 2, buf, + 3, &g_array_index(jobs, Job, i), + 4, &g_array_index(jobs, Job, i), + 5, &g_array_index(jobs, Job, i), + -1); + } +} + +void +treeview2_set_up_job_exchange(GtkTreeView *treeview) +{ + gint i; + GtkTreeViewColumn *col; + GtkCellRenderer *renderer; + gchar *titles[6] = + {"", + _("Team"), + _("League"), + _("Country"), + _("Av.skill"), + _("Talent %")}; + + gtk_tree_selection_set_mode(gtk_tree_view_get_selection(treeview), + GTK_SELECTION_SINGLE); + gtk_tree_view_set_headers_visible(treeview, TRUE); + + col = gtk_tree_view_column_new(); + gtk_tree_view_column_set_title(col, titles[0]); + gtk_tree_view_append_column(treeview, col); + renderer = treeview_helper_cell_renderer_text_new(); + gtk_tree_view_column_pack_start(col, renderer, TRUE); + gtk_tree_view_column_add_attribute(col, renderer, + "text", 0); + + for(i=1;i<3;i++) + { + col = gtk_tree_view_column_new(); + gtk_tree_view_column_set_title(col, titles[i]); + gtk_tree_view_append_column(treeview, col); + renderer = treeview_helper_cell_renderer_text_new(); + gtk_tree_view_column_pack_start(col, renderer, TRUE); + gtk_tree_view_column_add_attribute(col, renderer, + "text", i); + } + + for(i=3;i<6;i++) + { + col = gtk_tree_view_column_new(); + gtk_tree_view_column_set_title(col, titles[i]); + gtk_tree_view_append_column(treeview, col); + renderer = treeview_helper_cell_renderer_text_new(); + gtk_tree_view_column_pack_start(col, renderer, TRUE); + gtk_tree_view_column_set_cell_data_func(col, renderer, + treeview_helper_job_exchange, + NULL, NULL); + if(i > 3) + { + gtk_tree_view_column_set_alignment(col, 0.5); + g_object_set(renderer, "xalign", 0.5, NULL); + } + } +} + +/** Show the teams that offer a job. */ +void +treeview2_show_job_exchange(void) +{ + GtkTreeView *treeview = + GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")); + GtkListStore *model = + gtk_list_store_new(6, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER); + + treeview_helper_clear(treeview); + + treeview2_set_up_job_exchange(treeview); + + treeview2_create_job_exchange(model); + gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(model)); + g_object_unref(model); +} diff --git a/src/treeview2.h b/src/treeview2.h index e47b2508..e8c1c266 100644 --- a/src/treeview2.h +++ b/src/treeview2.h @@ -64,4 +64,13 @@ treeview2_set_up_bets(GtkTreeView *treeview); void treeview2_show_bets(void); +void +treeview2_create_job_exchange(GtkListStore *ls); + +void +treeview2_set_up_job_exchange(GtkTreeView *treeview); + +void +treeview2_show_job_exchange(void); + #endif diff --git a/src/treeview_helper.c b/src/treeview_helper.c index 1b065ebf..6529bcd2 100644 --- a/src/treeview_helper.c +++ b/src/treeview_helper.c @@ -28,6 +28,7 @@ #include "file.h" #include "fixture.h" #include "free.h" +#include "job.h" #include "league.h" #include "misc.h" #include "option.h" @@ -269,7 +270,7 @@ treeview_helper_get_user_history_icon(gint history_type) return NULL; case USER_HISTORY_START_GAME: return const_app("string_treeview_helper_user_history_symbol_start_game_icon"); - case USER_HISTORY_FIRE_FINANCES: + case USER_HISTORY_FIRE_FINANCE: return const_app("string_treeview_helper_user_history_symbol_fire_finances_icon"); case USER_HISTORY_FIRE_FAILURE: return const_app("string_treeview_helper_user_history_symbol_fire_failure_icon"); @@ -629,14 +630,15 @@ treeview_helper_get_table_element_colours(const Table *table, gint idx, /** Set the char pointers to the constant determining the background and foreground colours of user entries in treeviews if the team is a user team. */ void -treeview_helper_set_user_colours(const Team *tm, gchar **colour_bg, gchar **colour_fg) +treeview_helper_set_user_colours(const gchar *team_name, + gchar **colour_bg, gchar **colour_fg) { - if(tm == current_user.tm) + if(strcmp(team_name, current_user.tm->name) == 0) { *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) + else if(team_name_is_user(team_name) != -1) { *colour_fg = const_app("string_treeview_user_fg"); *colour_bg = const_app("string_treeview_user_bg"); @@ -993,7 +995,7 @@ treeview_helper_player_to_cell(GtkTreeViewColumn *col, gpointer user_data) { gint column = treeview_helper_get_col_number_column(col); - gint attribute = GPOINTER_TO_INT(user_data); + gint attribute = GPOINTER_TO_INT(user_data), idx = -1; gchar buf[SMALL]; const Player *pl; @@ -1072,7 +1074,10 @@ treeview_helper_player_to_cell(GtkTreeViewColumn *col, sprintf(buf, "%s (%s)", pl->team->name, pl->team->strategy_sid); break; case PLAYER_LIST_ATTRIBUTE_LEAGUE_CUP: - strcpy(buf, league_cup_get_name_string(pl->team->clid)); + idx = job_team_is_on_list(pl->team->id); + strcpy(buf, (idx == -1) ? + league_cup_get_name_string(pl->team->clid) : + g_array_index(jobs, Job, idx).league_name); break; } @@ -1660,3 +1665,43 @@ treeview_helper_search_equal(GtkTreeModel *model, return return_value; } + +void +treeview_helper_job_exchange(GtkTreeViewColumn *col, + GtkCellRenderer *renderer, + GtkTreeModel *model, + GtkTreeIter *iter, + gpointer user_data) +{ + gint column = treeview_helper_get_col_number_column(col); + gchar buf[SMALL]; + const Job *job = NULL; + + gtk_tree_model_get(model, iter, column, &job, -1); + + if(job == NULL) + return; + + g_object_set(renderer, "background", + const_app("string_treeview_helper_color_default_background"), + "foreground", + const_app("string_treeview_helper_color_default_foreground"), + NULL); + + if(column == 3) + { + strcpy(buf, job->country_name); + if(job->type != JOB_TYPE_NATIONAL) + g_object_set(renderer, "background", + const_app("string_treeview_helper_color_job_international_bg"), + "foreground", + const_app("string_treeview_helper_color_job_international_fg"), + NULL); + } + else if(column == 4) + sprintf(buf, "%.1f", team_get_average_skill(job_get_team(job), FALSE)); + else if(column == 5) + sprintf(buf, "%d", job->talent_percent); + + g_object_set(renderer, "text", buf, NULL); +} diff --git a/src/treeview_helper.h b/src/treeview_helper.h index 110c0523..afeab0b5 100644 --- a/src/treeview_helper.h +++ b/src/treeview_helper.h @@ -81,7 +81,8 @@ treeview_helper_get_table_element_colour_cups_cup(const Cup *cup, const Team *tm, gchar **colour_bg); void -treeview_helper_set_user_colours(const Team *tm, gchar **colour_bg, gchar **colour_fg); +treeview_helper_set_user_colours(const gchar *team_name, + gchar **colour_bg, gchar **colour_fg); PlayerListAttribute treeview_helper_get_attributes_from_scout(gint scout); @@ -220,4 +221,12 @@ treeview_helper_search_equal(GtkTreeModel *model, GtkTreeIter *iter, gpointer search_data); +void +treeview_helper_job_exchange(GtkTreeViewColumn *col, + GtkCellRenderer *renderer, + GtkTreeModel *model, + GtkTreeIter *iter, + gpointer user_data); + + #endif diff --git a/src/user.c b/src/user.c index 7c1070fb..c1625ebe 100644 --- a/src/user.c +++ b/src/user.c @@ -92,7 +92,9 @@ user_set_up_team_new_game(User *user) if(user->scout == -1) { user_set_up_team(user); - user_history_add(user, USER_HISTORY_START_GAME, user->tm->id, user->tm->clid, -1, ""); + user_history_add(user, USER_HISTORY_START_GAME, + user->tm->name, + league_cup_get_name_string(user->tm->clid), NULL, NULL); } else { @@ -108,7 +110,9 @@ user_set_up_team_new_game(User *user) user->tm = &g_array_index(lig(user->scout).teams, Team, rndom); user->team_id = g_array_index(lig(user->scout).teams, Team, rndom).id; - user_history_add(user, USER_HISTORY_START_GAME, user->tm->id, user->tm->clid, -1, ""); + user_history_add(user, USER_HISTORY_START_GAME, + user->tm->name, + league_cup_get_name_string(user->tm->clid), NULL, NULL); user_set_up_team(user); } @@ -199,7 +203,7 @@ user_remove(gint idx, gboolean regenerate_team) g_array_free(usr(idx).tm->players, TRUE); usr(idx).tm->players = g_array_new(FALSE, FALSE, sizeof(Player)); - team_generate_players_stadium(usr(idx).tm); + team_generate_players_stadium(usr(idx).tm, 0); for(i=0;iplayers->len;i++) g_array_index(usr(idx).tm->players, Player, i).team = usr(idx).tm; } @@ -293,10 +297,12 @@ user_job_offer(User *user) Team *new_team = NULL; if(math_rnd(0, 1) > const_float("float_user_success_counter_check") || - ABS(user->counters[COUNT_USER_SUCCESS]) < (gfloat)const_int("int_user_success_offer_limit") * 0.9) + ABS(user->counters[COUNT_USER_SUCCESS]) < + (gfloat)const_int("int_user_success_offer_limit") * 0.9) return; - if(user->counters[COUNT_USER_SUCCESS] < -(gfloat)const_int("int_user_success_offer_limit") * 0.9 && + if(user->counters[COUNT_USER_SUCCESS] < + -(gfloat)const_int("int_user_success_offer_limit") * 0.9 && !user->counters[COUNT_USER_WARNING]) { user_event_add(user, EVENT_TYPE_WARNING, -1, -1, NULL, @@ -313,8 +319,6 @@ user_job_offer(User *user) { new_team = team_get_new(user->tm, TRUE); user_event_add(user, EVENT_TYPE_FIRE_FAILURE, -1, -1, new_team, NULL); - user_history_add(user, USER_HISTORY_FIRE_FAILURE, user->tm->id, - new_team->id, new_team->clid, ""); } else if(option_int("int_opt_user_show_job_offers", &user->options)) { @@ -330,10 +334,11 @@ user_weekly_update_counters(User *user) { gint rank = team_get_league_rank(user->tm); gint teamslen = ((GArray*)(league_cup_get_teams(user->tm->clid)))->len; - gint rank_bounds[2] = {(gint)rint(const_float("float_user_success_table_bound_upper") * - (gfloat)teamslen), - (gint)rint(const_float("float_user_success_table_bound_lower") * - (gfloat)teamslen)}; + gint rank_bounds[2] = + {(gint)rint(const_float("float_user_success_table_bound_upper") * + (gfloat)teamslen), + (gint)rint(const_float("float_user_success_table_bound_lower") * + (gfloat)teamslen)}; gint *cnts = user->counters; gint increase_capacity; gfloat increase_safety; @@ -461,19 +466,16 @@ user_event_show_next(void) game_gui_show_warning(event->value_string); break; case EVENT_TYPE_FIRE_FINANCE: - stat2 = STATUS_JOB_OFFER_FIRE_FINANCE; - statp = event->value_pointer; - game_gui_show_job_offer((Team*)event->value_pointer, STATUS_JOB_OFFER_FIRE_FINANCE); + game_gui_show_job_offer((Team*)event->value_pointer, NULL, + STATUS_JOB_OFFER_FIRE_FINANCE); break; case EVENT_TYPE_FIRE_FAILURE: - stat2 = STATUS_JOB_OFFER_FIRE_FAILURE; - statp = event->value_pointer; - game_gui_show_job_offer((Team*)event->value_pointer, STATUS_JOB_OFFER_FIRE_FAILURE); + game_gui_show_job_offer((Team*)event->value_pointer, NULL, + STATUS_JOB_OFFER_FIRE_FAILURE); break; case EVENT_TYPE_JOB_OFFER: - stat2 = STATUS_JOB_OFFER_SUCCESS; - statp = event->value_pointer; - game_gui_show_job_offer((Team*)event->value_pointer, STATUS_JOB_OFFER_SUCCESS); + game_gui_show_job_offer((Team*)event->value_pointer, NULL, + STATUS_JOB_OFFER_SUCCESS); break; case EVENT_TYPE_OVERDRAW: if(event->value1 == 1) @@ -544,6 +546,7 @@ void user_change_team(User *user, Team *tm) { gint i; + gint success = user->counters[COUNT_USER_SUCCESS]; user->tm = tm; user->team_id = tm->id; @@ -551,6 +554,9 @@ user_change_team(User *user, Team *tm) user_set_up_team(user); user->counters[COUNT_USER_NEW_SPONSOR] = 0; + user->counters[COUNT_USER_SUCCESS] = (success < 0) ? + 0 : (gint)rint((gfloat)success / 2); + g_string_free(user->sponsor.name, TRUE); user->sponsor = user_get_sponsor(¤t_user); @@ -601,29 +607,38 @@ user_history_compare(gconstpointer a, gconstpointer b) /** Add an element to the user history filled with the given values. */ void -user_history_add(User *user, gint type, gint team_id, - gint value1, gint value2, gchar *string) +user_history_add(User *user, gint type, const gchar *team_name, + const gchar* string0, const gchar *string1, + const gchar *string2) { gint i; UserHistory new_history; UserHistory *his = &new_history; gboolean replace = FALSE; + his->team_name = his->string[0] = + his->string[1] = his->string[2] = NULL; if(type == USER_HISTORY_WIN_FINAL || type == USER_HISTORY_LOSE_FINAL || type == USER_HISTORY_REACH_CUP_ROUND) { for(i=0;ihistory->len;i++) - if((g_array_index(user->history, UserHistory, i).type == USER_HISTORY_WIN_FINAL || - g_array_index(user->history, UserHistory, i).type == USER_HISTORY_LOSE_FINAL || - g_array_index(user->history, UserHistory, i).type == USER_HISTORY_REACH_CUP_ROUND) && + if((g_array_index(user->history, UserHistory, i).type == + USER_HISTORY_WIN_FINAL || + g_array_index(user->history, UserHistory, i).type == + USER_HISTORY_LOSE_FINAL || + g_array_index(user->history, UserHistory, i).type == + USER_HISTORY_REACH_CUP_ROUND) && g_array_index(user->history, UserHistory, i).season == season && - g_array_index(user->history, UserHistory, i).team_id == team_id && - g_array_index(user->history, UserHistory, i).value1 == value1) + strcmp(g_array_index(user->history, UserHistory, i).team_name, + team_name) == 0 && + strcmp(g_array_index(user->history, UserHistory, i).string[1], + string1) == 0) { /** Same cup round. */ - if(g_array_index(user->history, UserHistory, i).value2 == value2 && + if(strcmp(g_array_index(user->history, UserHistory, i).string[2], + string2) == 0 && type == USER_HISTORY_REACH_CUP_ROUND) return; @@ -633,47 +648,7 @@ user_history_add(User *user, gint type, gint team_id, } } - if(type == USER_HISTORY_WIN_FINAL) - { - if(query_cup_is_international(value1)) - user->counters[COUNT_USER_SUCCESS] += - const_int("int_user_success_international_winner"); - 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(query_cup_is_international(value1)) - user->counters[COUNT_USER_SUCCESS] += - const_int("int_user_success_international_final"); - 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(query_cup_is_international(value1)) - user->counters[COUNT_USER_SUCCESS] += - const_int("int_user_success_international_semis"); - 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(query_cup_is_international(value1)) - user->counters[COUNT_USER_SUCCESS] += - const_int("int_user_success_international_quarter"); - else if(query_cup_is_national(value1)) - user->counters[COUNT_USER_SUCCESS] += - const_int("int_user_success_national_quarter"); - } - } - else if(type == USER_HISTORY_PROMOTED) + if(type == USER_HISTORY_PROMOTED) user->counters[COUNT_USER_SUCCESS] += const_int("int_user_success_promotion"); else if(type == USER_HISTORY_RELEGATED) @@ -682,20 +657,27 @@ user_history_add(User *user, gint type, gint team_id, his->season = season; his->week = week; - his->type = type; - his->team_id = team_id; - his->value1 = value1; - his->value2 = value2; if(replace) { - misc_string_assign(&his->value_string, string); + if(string0 != NULL) + misc_string_assign(&his->string[0], string0); + if(string2 != NULL) + misc_string_assign(&his->string[2], string2); g_array_sort(user->history, (GCompareFunc)user_history_compare); } else { - his->value_string = g_strdup(string); + his->team_name = g_strdup(team_name); + + if(string0 != NULL) + his->string[0] = g_strdup(string0); + if(string1 != NULL) + his->string[1] = g_strdup(string1); + if(string2 != NULL) + his->string[2] = g_strdup(string2); + g_array_prepend_val(user->history, *his); } } @@ -705,8 +687,6 @@ user_history_add(User *user, gint type, gint team_id, void user_history_to_string(const UserHistory *history, gchar *buf) { - gchar buf2[SMALL]; - switch(history->type) { default: @@ -715,73 +695,120 @@ user_history_to_string(const UserHistory *history, gchar *buf) case USER_HISTORY_START_GAME: /* Buy a team in a league. */ sprintf(buf, _("You start the game with %s in the %s."), - team_of_id(history->team_id)->name, - league_cup_get_name_string(history->value1)); + history->team_name, + history->string[0]); break; - case USER_HISTORY_FIRE_FINANCES: + case USER_HISTORY_FIRE_FINANCE: /* Team fires, team in a league. */ sprintf(buf, _("%s fires you because of financial mismanagement.\nYou find a new job with %s in the %s."), - team_of_id(history->team_id)->name, - team_of_id(history->value1)->name, - league_cup_get_name_string(history->value2)); + history->team_name, + history->string[0], + history->string[1]); break; case USER_HISTORY_FIRE_FAILURE: /* Team fires, team in a league. */ sprintf(buf, _("%s fires you because of unsuccessfulness.\nYou find a new job with %s in the %s."), - team_of_id(history->team_id)->name, - team_of_id(history->value1)->name, - league_cup_get_name_string(history->value2)); + history->team_name, + history->string[0], + history->string[1]); break; case USER_HISTORY_JOB_OFFER_ACCEPTED: /* Team in a league. Leave team. */ sprintf(buf, _("%s offer you a job in the %s.\nYou accept the challenge and leave %s."), - team_of_id(history->value1)->name, - league_cup_get_name_string(history->value2), - team_of_id(history->team_id)->name); + history->string[0], + history->string[1], + history->team_name); break; case USER_HISTORY_END_SEASON: /* League name. */ - sprintf(buf, _("You finish the season in the %s on rank %d."), - league_cup_get_name_string(history->value1), - history->value2); + sprintf(buf, _("You finish the season in the %s on rank %s."), + history->string[0], + history->string[1]); break; case USER_HISTORY_PROMOTED: /* League name. */ sprintf(buf, _("You get promoted to the %s."), - league_cup_get_name_string(history->value1)); + history->string[0]); break; case USER_HISTORY_RELEGATED: /* League name. */ sprintf(buf, _("You get relegated to the %s."), - league_cup_get_name_string(history->value1)); + history->string[0]); break; case USER_HISTORY_WIN_FINAL: /* Cup name, team name. */ sprintf(buf, _("You win the %s final against %s."), - league_cup_get_name_string(history->value1), - history->value_string); + history->string[0], + history->string[1]); break; case USER_HISTORY_LOSE_FINAL: /* Cup name, team name. */ sprintf(buf, _("You lose in the %s final against %s."), - league_cup_get_name_string(history->value1), - history->value_string); + history->string[0], + history->string[1]); break; case USER_HISTORY_REACH_CUP_ROUND: - cup_get_round_name(cup_from_clid(history->value1), history->value2, buf2); /* Cup round name (e.g. Last 32), number, cup name. */ - sprintf(buf, _("You reach the %s (round %d) of the %s."), buf2, - history->value2 + 1, - league_cup_get_name_string(history->value1)); + sprintf(buf, _("You reach the %s (round %s) of the %s."), + history->string[1], + history->string[2], + history->string[0]); break; case USER_HISTORY_CHAMPION: /* League name. */ sprintf(buf, _("You are champion of the %s!"), - league_cup_get_name_string(history->value1)); + history->string[0]); break; } } +/** Increase the user success counter when the user + is successful in a cup. */ +void +user_add_cup_success(User *user, const Cup *cup, gint round, gint type) +{ + if(type == USER_HISTORY_WIN_FINAL) + { + if(query_cup_is_international(cup->id)) + user->counters[COUNT_USER_SUCCESS] += + const_int("int_user_success_international_winner"); + else if(query_cup_is_national(cup->id)) + user->counters[COUNT_USER_SUCCESS] += + const_int("int_user_success_national_winner"); + } + else if(type == USER_HISTORY_LOSE_FINAL) + { + if(query_cup_is_international(cup->id)) + user->counters[COUNT_USER_SUCCESS] += + const_int("int_user_success_international_final"); + else if(query_cup_is_national(cup->id)) + 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(round == cup_from_clid(cup->id)->rounds->len - 2) + { + if(query_cup_is_international(cup->id)) + user->counters[COUNT_USER_SUCCESS] += + const_int("int_user_success_international_semis"); + else if(query_cup_is_national(cup->id)) + user->counters[COUNT_USER_SUCCESS] += + const_int("int_user_success_national_semis"); + } + else if(round == cup_from_clid(cup->id)->rounds->len - 3) + { + if(query_cup_is_international(cup->id)) + user->counters[COUNT_USER_SUCCESS] += + const_int("int_user_success_international_quarter"); + else if(query_cup_is_national(cup->id)) + user->counters[COUNT_USER_SUCCESS] += + const_int("int_user_success_national_quarter"); + } + } +} + /** Find out whether there's a user who didn't have his turn before a new week round begins. */ gboolean diff --git a/src/user.h b/src/user.h index 6ce109de..4c7f2682 100644 --- a/src/user.h +++ b/src/user.h @@ -27,6 +27,7 @@ #define USER_H #include "bygfoot.h" +#include "cup_struct.h" #include "user_struct.h" #include "variables.h" @@ -89,8 +90,9 @@ gboolean query_user_teams_have_unfit(void); void -user_history_add(User *user, gint type, gint team_id, - gint value1, gint value2, gchar *string); +user_history_add(User *user, gint type, const gchar *team_name, + const gchar* string0, const gchar *string1, + const gchar *string2); void user_history_to_string(const UserHistory *history, gchar *buf); @@ -98,6 +100,9 @@ user_history_to_string(const UserHistory *history, gchar *buf); gint user_history_compare(gconstpointer a, gconstpointer b); +void +user_add_cup_success(User *user, const Cup *cup, gint round, gint type); + void user_job_offer(User *user); diff --git a/src/user_struct.h b/src/user_struct.h index 1482a834..3a1edd0a 100644 --- a/src/user_struct.h +++ b/src/user_struct.h @@ -86,7 +86,7 @@ enum CounterValue enum UserHistoryType { USER_HISTORY_START_GAME = 0, - USER_HISTORY_FIRE_FINANCES, + USER_HISTORY_FIRE_FINANCE, USER_HISTORY_FIRE_FAILURE, USER_HISTORY_JOB_OFFER_ACCEPTED, USER_HISTORY_END_SEASON, @@ -123,14 +123,13 @@ typedef struct /** When the event happened. */ gint season, week; - /** The type (see #UserHistoryType) and team - of the user. */ - gint type, team_id, - /** These can hold various information like - team or league/cup ids. */ - value1, value2; - gchar *value_string; - + /** The type (see #UserHistoryType) of the history event. */ + gint type; + /** The team of the user at the time. */ + gchar *team_name; + /** These can hold various information like + team or league/cup ids. */ + gchar *string[3]; } UserHistory; /** A user sponsor. */ diff --git a/src/variables.h b/src/variables.h index ecd777ab..d61fde22 100644 --- a/src/variables.h +++ b/src/variables.h @@ -27,10 +27,6 @@ #include "enums.h" #include "live_game_struct.h" #include "option_struct.h" -#include "player_struct.h" -#include "stat_struct.h" -#include "team_struct.h" -#include "user_struct.h" /** * The main variable of the game. @@ -76,6 +72,10 @@ GArray *strategies; /** Array of current and recent bets. */ GArray *bets[2]; +/** Array of jobs in the job exchange and + teams going with the international jobs. */ +GArray *jobs, *job_teams; + /** Some counters we use. */ gint counters[COUNT_END]; diff --git a/src/window.c b/src/window.c index 6df57ad5..71575603 100644 --- a/src/window.c +++ b/src/window.c @@ -649,6 +649,9 @@ window_create(gint window_type) window.main = create_main_window(); wind = window.main; window_main_load_geometry(); + window.paned_pos = + gtk_paned_get_position( + GTK_PANED(lookup_widget(window.main, "hpaned2"))); game_gui_print_message(_("Welcome to Bygfoot %s"), VERS); sprintf(buf, "Bygfoot Football Manager %s", VERS); } @@ -719,10 +722,7 @@ window_create(gint window_type) if(window.job_offer != NULL) g_warning("window_create: called on already existing window\n"); else - { - popups_active++; window.job_offer = create_window_job_offer(); - } wind = window.job_offer; strcpy(buf, _("Job offer")); break; diff --git a/src/xml.h b/src/xml.h index ac4352a1..0e3f5afc 100644 --- a/src/xml.h +++ b/src/xml.h @@ -71,6 +71,7 @@ enum XmlTags #define TAG_START_SEASON_STATS 11000 #define TAG_START_LEAGUES_CUPS 12000 #define TAG_START_TRANSFERS 20000 +#define TAG_START_JOBS 21000 #define xml_write_g_string(fil, gstring, tag, indent) xml_write_string(fil, (gstring)->str, tag, indent) diff --git a/src/xml_country.c b/src/xml_country.c index 8c57d78e..188b23d0 100644 --- a/src/xml_country.c +++ b/src/xml_country.c @@ -37,6 +37,7 @@ */ #define TAG_COUNTRY "country" #define TAG_NAME "name" +#define TAG_RATING "rating" #define TAG_SYMBOL "symbol" #define TAG_SID "sid" #define TAG_SUPERNATIONAL "supernational" @@ -52,6 +53,7 @@ enum XmlCountryStates { STATE_COUNTRY = 0, STATE_NAME, + STATE_RATING, STATE_SYMBOL, STATE_SID, STATE_SUPERNATIONAL, @@ -66,6 +68,7 @@ enum XmlCountryStates * The state variable used in the XML parsing functions. */ gint state; +Country *cntry; /** * The function called by the parser when an opening tag is read. @@ -83,6 +86,8 @@ xml_country_read_start_element (GMarkupParseContext *context, { if(strcmp(element_name, TAG_NAME) == 0) state = STATE_NAME; + else if(strcmp(element_name, TAG_RATING) == 0) + state = STATE_RATING; else if(strcmp(element_name, TAG_SYMBOL) == 0) state = STATE_SYMBOL; else if(strcmp(element_name, TAG_SID) == 0) @@ -92,16 +97,16 @@ xml_country_read_start_element (GMarkupParseContext *context, else if(strcmp(element_name, TAG_LEAGUES) == 0) { state = STATE_LEAGUES; - if(ligs == NULL) - ligs = g_array_new(FALSE, FALSE, sizeof(League)); + if(cntry->leagues == NULL) + cntry->leagues = g_array_new(FALSE, FALSE, sizeof(League)); } else if(strcmp(element_name, TAG_LEAGUE) == 0) state = STATE_LEAGUE; else if(strcmp(element_name, TAG_CUPS) == 0) { state = STATE_CUPS; - if(cps == NULL) - cps = g_array_new(FALSE, FALSE, sizeof(Cup)); + if(cntry->cups == NULL) + cntry->cups = g_array_new(FALSE, FALSE, sizeof(Cup)); } else if(strcmp(element_name, TAG_CUP) == 0) state = STATE_CUP; @@ -122,6 +127,7 @@ xml_country_read_end_element (GMarkupParseContext *context, GError **error) { if(strcmp(element_name, TAG_NAME) == 0 || + strcmp(element_name, TAG_RATING) == 0 || strcmp(element_name, TAG_SYMBOL) == 0 || strcmp(element_name, TAG_SID) == 0 || strcmp(element_name, TAG_SUPERNATIONAL) == 0 || @@ -160,12 +166,14 @@ xml_country_read_text (GMarkupParseContext *context, int_value = (gint)g_ascii_strtod(buf, NULL); if(state == STATE_NAME) - misc_string_assign(&country.name, buf); + misc_string_assign(&cntry->name, buf); + else if(state == STATE_RATING) + cntry->rating = int_value; else if(state == STATE_SYMBOL) - misc_string_assign(&country.symbol, buf); + misc_string_assign(&cntry->symbol, buf); else if(state == STATE_SID) - misc_string_assign(&country.sid, buf); - else if(state == STATE_SUPERNATIONAL) + misc_string_assign(&cntry->sid, buf); + else if(state == STATE_SUPERNATIONAL && cntry == &country) { sett_set_int("int_opt_disable_finances", 1); sett_set_int("int_opt_disable_transfers", 1); @@ -175,22 +183,22 @@ xml_country_read_text (GMarkupParseContext *context, sett_set_int("int_opt_disable_ya", 1); } else if(state == STATE_LEAGUE) - xml_league_read(buf, ligs); + xml_league_read(buf, cntry->leagues); else if(state == STATE_CUP) - xml_cup_read(buf, cps); + xml_cup_read(buf, cntry->cups); } /** - * Function reading an XML file specifying a country. - * The variable #country gets freed and overwritten afterwards. - * @param country_name name of the xml file (e.g. 'country_england.xml') - * to be read. Full path is not necessary, if the file is located in - * one of the suppport directories; neither are the prefix 'country_' - * or the suffix '.xml'. + Function reading an XML file specifying a country. + @param country_name name of the xml file (e.g. 'country_england.xml') + to be read. Full path is not necessary, if the file is located in + one of the suppport directories; neither are the prefix 'country_' + or the suffix '.xml'. + @param cntry The country variable to write. */ void -xml_country_read(const gchar *country_name) +xml_country_read(const gchar *country_name, Country *cntry_arg) { gchar *file_name = file_find_support_file(country_name, FALSE); GMarkupParser parser = {xml_country_read_start_element, @@ -219,18 +227,23 @@ xml_country_read(const gchar *country_name) return; } + cntry = (cntry_arg == NULL) ? &country : cntry_arg; + state = STATE_COUNTRY; strcpy(buf, file_name); g_free(file_name); - free_country(TRUE); + free_country(cntry, TRUE); - sett_set_int("int_opt_disable_finances", 0); - sett_set_int("int_opt_disable_transfers", 0); - sett_set_int("int_opt_disable_stadium", 0); - sett_set_int("int_opt_disable_contracts", 0); - sett_set_int("int_opt_disable_boost_on", 0); - sett_set_int("int_opt_disable_ya", 0); + if(cntry_arg == NULL) + { + sett_set_int("int_opt_disable_finances", 0); + sett_set_int("int_opt_disable_transfers", 0); + sett_set_int("int_opt_disable_stadium", 0); + sett_set_int("int_opt_disable_contracts", 0); + sett_set_int("int_opt_disable_boost_on", 0); + sett_set_int("int_opt_disable_ya", 0); + } if(g_markup_parse_context_parse(context, file_contents, length, &error)) { @@ -244,7 +257,7 @@ xml_country_read(const gchar *country_name) misc_print_error(&error, TRUE); } - for(i=0;ilen;i++) - if(lig(i).layer == -1) - lig(i).layer = i + 1; + for(i=0;ileagues->len;i++) + if(g_array_index(cntry->leagues, League, i).layer == -1) + g_array_index(cntry->leagues, League, i).layer = i + 1; } diff --git a/src/xml_country.h b/src/xml_country.h index a0740219..54d51cbf 100644 --- a/src/xml_country.h +++ b/src/xml_country.h @@ -49,6 +49,6 @@ xml_country_read_text (GMarkupParseContext *context, void -xml_country_read(const gchar *country_name); +xml_country_read(const gchar *country_name, Country *cntry_arg); #endif diff --git a/src/xml_league.c b/src/xml_league.c index 5f41f578..898945a9 100644 --- a/src/xml_league.c +++ b/src/xml_league.c @@ -133,7 +133,7 @@ xml_league_read_start_element (GMarkupParseContext *context, { PromRelElement new_element; Team new_team; - + if(strcmp(element_name, TAG_LEAGUE) == 0) { new_league = league_new(TRUE); diff --git a/src/xml_loadsave_league_stat.c b/src/xml_loadsave_league_stat.c index f55e0d9e..bf7beb6d 100644 --- a/src/xml_loadsave_league_stat.c +++ b/src/xml_loadsave_league_stat.c @@ -33,11 +33,14 @@ enum { TAG_LEAGUE_STAT = TAG_START_LEAGUE_STAT, + TAG_STAT_LEAGUE_NAME, + TAG_STAT_LEAGUE_SYMBOL, TAG_STAT_TEAMS_OFF, TAG_STAT_TEAMS_DEF, TAG_STAT_PLAYER_SCORERS, TAG_STAT_PLAYER_GOALIES, TAG_STAT, + TAG_STAT_TEAM_NAME, TAG_STAT_VALUE, TAG_STAT_VALUE_STRING, TAG_END @@ -66,17 +69,11 @@ xml_loadsave_league_stat_start_element (GMarkupParseContext *context, valid_tag = TRUE; } - for(i=TAG_NAME;i<=TAG_ROUND;i++) - if(tag == i) - { - state = i; - valid_tag = TRUE; - } - if(tag == TAG_STAT) { valueidx = 0; - new_stat.value_string = NULL; + new_stat.value_string = + new_stat.team_name = NULL; } else if(tag == TAG_STAT_TEAMS_OFF || tag == TAG_STAT_TEAMS_DEF || @@ -85,8 +82,9 @@ xml_loadsave_league_stat_start_element (GMarkupParseContext *context, in_state = tag; if(!valid_tag) - g_warning("xml_loadsave_league_stat_start_element: unknown tag: %s; I'm in state %d\n", - element_name, state); + g_warning( + "xml_loadsave_league_stat_start_element: unknown tag: %s; I'm in state %d\n", + element_name, state); } void @@ -98,7 +96,8 @@ xml_loadsave_league_stat_end_element (GMarkupParseContext *context, GArray *stat_array = NULL; gint tag = xml_get_tag_from_name(element_name); - if(tag == TAG_ID || + if(tag == TAG_STAT_LEAGUE_NAME || + tag == TAG_STAT_LEAGUE_SYMBOL || tag == TAG_STAT_TEAMS_OFF || tag == TAG_STAT_TEAMS_DEF || tag == TAG_STAT_PLAYER_SCORERS || @@ -127,15 +126,16 @@ xml_loadsave_league_stat_end_element (GMarkupParseContext *context, else if(tag == TAG_STAT_VALUE_STRING || tag == TAG_STAT_VALUE || tag == TAG_STAT_VALUE_STRING || - tag == TAG_TEAM_ID) + tag == TAG_STAT_TEAM_NAME) { state = TAG_STAT; if(tag == TAG_STAT_VALUE) valueidx++; } else if(tag != TAG_LEAGUE_STAT) - g_warning("xml_loadsave_league_stat_end_element: unknown tag: %s; I'm in state %d\n", - element_name, state); + g_warning( + "xml_loadsave_league_stat_end_element: unknown tag: %s; I'm in state %d\n", + element_name, state); } void @@ -153,10 +153,12 @@ xml_loadsave_league_stat_text (GMarkupParseContext *context, int_value = (gint)g_ascii_strtod(buf, NULL); - if(state == TAG_ID) - lig_stat->clid = int_value; - else if(state == TAG_TEAM_ID) - new_stat.team_id = int_value; + if(state == TAG_STAT_LEAGUE_NAME) + lig_stat->league_name = g_strdup(buf); + else if(state == TAG_STAT_LEAGUE_SYMBOL) + lig_stat->league_symbol = g_strdup(buf); + else if(state == TAG_STAT_TEAM_NAME) + new_stat.team_name = g_strdup(buf); else if(state == TAG_STAT_VALUE) { if(valueidx == 0) @@ -215,7 +217,8 @@ xml_loadsave_league_stat_write(const gchar *filename, const LeagueStat *league_s fprintf(fil, "<_%d>\n", TAG_LEAGUE_STAT); - xml_write_int(fil, league_stat->clid, TAG_ID, I0); + xml_write_string(fil, league_stat->league_name, TAG_STAT_LEAGUE_NAME, I0); + xml_write_string(fil, league_stat->league_symbol, TAG_STAT_LEAGUE_SYMBOL, I0); fprintf(fil, "<_%d>\n", TAG_STAT_TEAMS_OFF); for(i=0;iteams_off->len;i++) @@ -251,7 +254,7 @@ xml_loadsave_league_stat_write_stat(FILE *fil, const Stat *stat) { fprintf(fil, "%s<_%d>\n", I1, TAG_STAT); - xml_write_int(fil, stat->team_id, TAG_TEAM_ID, I1); + xml_write_string(fil, stat->team_name, TAG_STAT_TEAM_NAME, I1); xml_write_int(fil, stat->value1, TAG_STAT_VALUE, I1); xml_write_int(fil, stat->value2, TAG_STAT_VALUE, I1); xml_write_int(fil, stat->value3, TAG_STAT_VALUE, I1); diff --git a/src/xml_loadsave_misc.c b/src/xml_loadsave_misc.c index 320adf97..e3ed5a0f 100644 --- a/src/xml_loadsave_misc.c +++ b/src/xml_loadsave_misc.c @@ -38,6 +38,7 @@ enum XmlLoadSaveCountryTags { TAG_MISC = TAG_START_MISC, + TAG_MISC_RATING, TAG_MISC_SEASON, TAG_MISC_WEEK, TAG_MISC_WEEK_ROUND, @@ -105,6 +106,7 @@ xml_loadsave_misc_end_element (GMarkupParseContext *context, if(tag == TAG_NAME || tag == TAG_SYMBOL || tag == TAG_SID || + tag == TAG_MISC_RATING || tag == TAG_MISC_ALLCUP || tag == TAG_MISC_COUNTER || tag == TAG_MISC_SEASON || @@ -151,6 +153,8 @@ xml_loadsave_misc_text (GMarkupParseContext *context, if(state == TAG_NAME) misc_string_assign(&country.name, buf); + else if(state == TAG_MISC_RATING) + country.rating = int_value; else if(state == TAG_SYMBOL) misc_string_assign(&country.symbol, buf); else if(state == TAG_SID) @@ -231,6 +235,7 @@ xml_loadsave_misc_write(const gchar *prefix) xml_write_string(fil, country.name, TAG_NAME, I0); xml_write_string(fil, country.symbol, TAG_SYMBOL, I0); xml_write_string(fil, country.sid, TAG_SID, I0); + xml_write_int(fil, country.rating, TAG_MISC_RATING, I0); xml_write_int(fil, season, TAG_MISC_SEASON, I0); xml_write_int(fil, week, TAG_MISC_WEEK, I0); xml_write_int(fil, week_round, TAG_MISC_WEEK_ROUND, I0); diff --git a/src/xml_loadsave_season_stats.c b/src/xml_loadsave_season_stats.c index 81acfad1..dd65fd05 100644 --- a/src/xml_loadsave_season_stats.c +++ b/src/xml_loadsave_season_stats.c @@ -149,7 +149,7 @@ xml_loadsave_season_stats_text (GMarkupParseContext *context, new_champ_stat.cl_name = g_strdup(buf); else if(state == TAG_LEAGUE_STAT_FILE) { - new_league_stat = stat_league_new(-1); + new_league_stat = stat_league_new("", ""); sprintf(buf2, "%s%s%s", dirname2, G_DIR_SEPARATOR_S, buf); xml_loadsave_league_stat_read(buf2, &new_league_stat); g_array_append_val(new_season_stat.league_stats, new_league_stat); diff --git a/src/xml_loadsave_users.c b/src/xml_loadsave_users.c index da62cfb3..7176a777 100644 --- a/src/xml_loadsave_users.c +++ b/src/xml_loadsave_users.c @@ -52,10 +52,8 @@ enum TAG_USER_HISTORY_SEASON, TAG_USER_HISTORY_WEEK, TAG_USER_HISTORY_TYPE, - TAG_USER_HISTORY_TEAM_ID, - TAG_USER_HISTORY_VALUE1, - TAG_USER_HISTORY_VALUE2, - TAG_USER_HISTORY_VALUE_STRING, + TAG_USER_HISTORY_TEAM_NAME, + TAG_USER_HISTORY_STRING, TAG_USER_EVENT, TAG_USER_EVENT_TYPE, TAG_USER_EVENT_VALUE1, @@ -114,8 +112,7 @@ xml_loadsave_users_start_element (GMarkupParseContext *context, new_user = user_new(); idx = idx_mon_out = idx_mon_in = 0; } - - if(tag >= TAG_START_PLAYERS && tag <= TAG_END_PLAYERS) + else if(tag >= TAG_START_PLAYERS && tag <= TAG_END_PLAYERS) { state = TAG_START_PLAYERS; valid_tag = TRUE; @@ -125,19 +122,22 @@ xml_loadsave_users_start_element (GMarkupParseContext *context, xml_loadsave_players_start_element(tag, new_user.tm); } - - if(state == TAG_USER_MONEY_OUTS || - state == TAG_USER_MONEY_INS) + else if(tag == TAG_USER_HISTORY) + { idx = 0; - - if(state == TAG_USER_BET0 || - state == TAG_USER_BET1) - idx_bet = (state == TAG_USER_BET1); - - if(tag == TAG_USER_HISTORY) - new_history.value_string = NULL; + new_history.team_name = + new_history.string[0] = + new_history.string[1] = + new_history.string[2] = NULL; + } else if(tag == TAG_USER_EVENT) new_event.value_string = NULL; + else if(tag == TAG_USER_MONEY_OUTS || + tag == TAG_USER_MONEY_INS) + idx = 0; + else if(tag == TAG_USER_BET0 || + tag == TAG_USER_BET1) + idx_bet = (tag == TAG_USER_BET1); if(!valid_tag) g_warning("xml_loadsave_users_start_element: unknown tag: %s; I'm in state %d\n", @@ -207,11 +207,14 @@ xml_loadsave_users_end_element (GMarkupParseContext *context, else if(tag == TAG_USER_HISTORY_SEASON || tag == TAG_USER_HISTORY_WEEK || tag == TAG_USER_HISTORY_TYPE || - tag == TAG_USER_HISTORY_TEAM_ID || - tag == TAG_USER_HISTORY_VALUE1 || - tag == TAG_USER_HISTORY_VALUE2 || - tag == TAG_USER_HISTORY_VALUE_STRING) + tag == TAG_USER_HISTORY_TEAM_NAME || + tag == TAG_USER_HISTORY_STRING) + { state = TAG_USER_HISTORY; + + if(tag == TAG_USER_HISTORY_STRING) + idx++; + } else if(tag == TAG_USER_EVENT_TYPE || tag == TAG_USER_EVENT_VALUE1 || tag == TAG_USER_EVENT_VALUE2 || @@ -286,14 +289,10 @@ xml_loadsave_users_text (GMarkupParseContext *context, new_history.week = int_value; else if(state == TAG_USER_HISTORY_TYPE) new_history.type = int_value; - else if(state == TAG_USER_HISTORY_TEAM_ID) - new_history.team_id = int_value; - else if(state == TAG_USER_HISTORY_VALUE1) - new_history.value1 = int_value; - else if(state == TAG_USER_HISTORY_VALUE2) - new_history.value2 = int_value; - else if(state == TAG_USER_HISTORY_VALUE_STRING) - misc_string_assign(&new_history.value_string, buf); + else if(state == TAG_USER_HISTORY_TEAM_NAME) + new_history.team_name = g_strdup(buf); + else if(state == TAG_USER_HISTORY_STRING) + new_history.string[idx] = (strlen(buf) == 0) ? NULL : g_strdup(buf); else if(state == TAG_USER_EVENT_TYPE) new_event.type = int_value; else if(state == TAG_USER_EVENT_VALUE1) @@ -301,7 +300,7 @@ xml_loadsave_users_text (GMarkupParseContext *context, else if(state == TAG_USER_EVENT_VALUE2) new_event.value2 = int_value; else if(state == TAG_USER_EVENT_VALUE_STRING) - misc_string_assign(&new_event.value_string, buf); + new_event.value_string = g_strdup(buf); else if(state == TAG_USER_YA_COACH) new_user.youth_academy.coach = int_value; else if(state == TAG_USER_YA_PERCENTAGE) @@ -439,7 +438,7 @@ xml_loadsave_users_write(const gchar *prefix) void xml_user_write_history(FILE *fil, const GArray *history) { - gint i; + gint i, j; for(i=0;ilen;i++) { @@ -451,14 +450,14 @@ xml_user_write_history(FILE *fil, const GArray *history) TAG_USER_HISTORY_WEEK, I2); xml_write_int(fil, g_array_index(history, UserHistory, i).type, TAG_USER_HISTORY_TYPE, I2); - xml_write_int(fil, g_array_index(history, UserHistory, i).team_id, - TAG_USER_HISTORY_TEAM_ID, I2); - xml_write_int(fil, g_array_index(history, UserHistory, i).value1, - TAG_USER_HISTORY_VALUE1, I2); - xml_write_int(fil, g_array_index(history, UserHistory, i).value2, - TAG_USER_HISTORY_VALUE2, I2); - xml_write_string(fil, g_array_index(history, UserHistory, i).value_string, - TAG_USER_HISTORY_VALUE_STRING, I2); + xml_write_string(fil, g_array_index(history, UserHistory, i).team_name, + TAG_USER_HISTORY_TEAM_NAME, I2); + for(j=0;j<3;j++) + if(g_array_index(history, UserHistory, i).string[j] != NULL) + xml_write_string(fil, g_array_index(history, UserHistory, i).string[j], + TAG_USER_HISTORY_STRING, I2); + else + xml_write_string(fil, "", TAG_USER_HISTORY_STRING, I2); fprintf(fil, "%s\n", I1, TAG_USER_HISTORY); } diff --git a/support_files/bygfoot_app b/support_files/bygfoot_app index 700ca8ac..877fab02 100644 --- a/support_files/bygfoot_app +++ b/support_files/bygfoot_app @@ -230,3 +230,7 @@ string_treeview_helper_player_status_yellow_danger player_status_yellow.png # betting cell string_treeview_helper_color_user_bet_fg black string_treeview_helper_color_user_bet_bg lightblue + +# colours for foreign countries in the job exchange list +string_treeview_helper_color_job_international_fg black +string_treeview_helper_color_job_international_bg lightblue diff --git a/support_files/bygfoot_constants b/support_files/bygfoot_constants index f350db39..bff5b236 100644 --- a/support_files/bygfoot_constants +++ b/support_files/bygfoot_constants @@ -895,3 +895,29 @@ float_bet_wager_limit_factor 50000 # how much the user may wager at most int_bet_wager_max 25000 + +# lower and upper bounds for the number +# of new job offers when the job exchange gets updated +int_job_new_offers_lower 3 +int_job_new_offers_upper 6 + +# how often (in weeks) an update occurs +int_job_update_interval 5 + +# percentage of international offers +float_job_international_perc 50000 + +# number of success points per average skill +# difference unit (needed when finding out whether +# a user's application for a job is successful) +int_job_application_points_per_av_skill 40 + +# how many points a league layer difference is worth +int_job_application_points_per_layer 30 + +# how many points more are needed for an international +# application +int_job_application_points_international 150 + +# how many points a country rating difference is worth +int_job_application_points_per_rating 80