Job exchange bugfixes.

This commit is contained in:
gyboth 2005-12-10 12:21:19 +00:00
parent c02147d9f3
commit 651f25fa37
12 changed files with 40 additions and 50 deletions

View File

@ -35,10 +35,15 @@
#include "user.h"
#include "variables.h"
/** Take some debug action depending on the text and the value. */
/** Take some debug action depending on the text. Text is a prefix and a number. */
void
debug_action(const gchar *text, gint value)
debug_action(const gchar *text)
{
gchar buf[SMALL];
gint value = -1;
sscanf(text, "%[^-0-9]%d", buf, &value);
if(g_str_has_prefix(text, "deb"))
{
option_set_int("int_debug", &constants, value);

View File

@ -29,7 +29,7 @@
#include "bygfoot.h"
void
debug_action(const gchar *text, gint value);
debug_action(const gchar *text);
gboolean
debug_reset_counter(gpointer data);

View File

@ -29,6 +29,7 @@
#include "free.h"
#include "job.h"
#include "league.h"
#include "live_game.h"
#include "main.h"
#include "maths.h"
#include "option.h"
@ -369,13 +370,11 @@ job_change_country(Job *job)
Team tm = *(job_get_team(job));
gint season_temp = season + 1;
/* printf("1\n"); */
for(i=transfer_list->len - 1;i>=0;i--)
transfer_remove_player(i);
free_bets(TRUE);
/* printf("2\n"); */
/* There's only one user (otherwise
international job offers are disabled). */
for(i=0;i<2;i++)
@ -384,12 +383,12 @@ job_change_country(Job *job)
usr(0).bets[i] = g_array_new(FALSE, FALSE, sizeof(BetUser));
}
/* printf("3\n"); */
live_game_reset(&usr(0).live_game, NULL, FALSE);
free_country(&country, TRUE);
xml_country_read(job->country_file, &country);
/* printf("4\n"); */
stat5 = STATUS_GENERATE_TEAMS;
for(i=0;i<ligs->len;i++)
for(j=0;j<lig(i).teams->len;j++)
@ -411,22 +410,9 @@ job_change_country(Job *job)
}
stat5 = -1;
/* printf("5\n"); */
/* Set season to 1 so that some special things
in the start_new_season function don't get applied. */
season = 1;
start_new_season();
season = season_temp;
/* printf("6\n"); */
}
/** Remove all national job offers from the jobs list (when changing country). */
void
job_remove_national(void)
{
gint i;
for(i=jobs->len - 1; i >= 0; i--)
if(g_array_index(jobs, Job, i).type == JOB_TYPE_NATIONAL)
job_remove(&g_array_index(jobs, Job, i), TRUE);
}

View File

@ -67,7 +67,4 @@ job_team_is_in_cup(const gchar *team_name);
void
job_change_country(Job *job);
void
job_remove_national(void);
#endif

View File

@ -65,7 +65,7 @@ main_parse_cl_arguments(gint *argc, gchar ***argv)
gboolean testcom = FALSE, calodds = FALSE;
gchar *support_dir = NULL, *lang = NULL,
*testcom_file = NULL, *token_file = NULL,
*event_name = NULL;
*event_name = NULL, *debug_text = NULL;
gint deb_level = -1, number_of_passes = 1,
num_matches = 100, skilldiffmax = 20;
GError *error = NULL;
@ -106,6 +106,9 @@ main_parse_cl_arguments(gint *argc, gchar ***argv)
{ "num-skilldiff", 'S', 0, G_OPTION_ARG_INT, &skilldiffmax,
"[developer] How many skill diff steps to take", "N" },
{ "deb", 'D', 0, G_OPTION_ARG_STRING, &debug_text,
"A debug command like 'deb100 to set the debug level'; see the debug window and debug.c", "STRING" },
{NULL}};
if(argc == NULL || argv == NULL)
@ -145,6 +148,9 @@ main_parse_cl_arguments(gint *argc, gchar ***argv)
if(lang != NULL)
language_set(language_get_code_index(lang) + 1);
if(debug_text != NULL)
statp = debug_text;
}
/**

View File

@ -333,10 +333,7 @@ misc2_callback_evaluate_job_application(Job *job, User *user)
if(job->type == JOB_TYPE_NATIONAL)
job_remove(job, TRUE);
else
{
job_remove(job, FALSE);
job_remove_national();
}
free_jobs(TRUE);
return TRUE;
}

View File

@ -363,11 +363,8 @@ on_button_debug_apply_clicked (GtkButton *button,
GtkEntry *entry_debug =
GTK_ENTRY(lookup_widget(window.wdebug, "entry_debug"));
const gchar *entry_text = gtk_entry_get_text(entry_debug);
gchar buf[SMALL];
gint value = -1;
sscanf(entry_text, "%[^-0-9]%d", buf, &value);
debug_action(buf, value);
debug_action(entry_text);
gtk_entry_set_text(entry_debug, "");
}

View File

@ -99,6 +99,13 @@ misc_callback_start_game(void)
window_create(WINDOW_MAIN);
game_gui_show_main();
if(statp != NULL)
{
debug_action((gchar*)statp);
g_free(statp);
statp = NULL;
}
}
else
{

View File

@ -40,7 +40,6 @@ create_window_startup (void)
GtkWidget *treeview_users;
GtkWidget *scrolledwindow1;
GtkWidget *treeview_startup;
GtkWidget *hseparator10;
GtkWidget *hseparator11;
GtkWidget *label4;
GtkWidget *comboboxentry_start_league;
@ -97,12 +96,13 @@ create_window_startup (void)
vbox34 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox34);
gtk_box_pack_start (GTK_BOX (vbox2), vbox34, FALSE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (vbox2), vbox34, FALSE, TRUE, 0);
label69 = gtk_label_new (_("Choose country"));
gtk_widget_show (label69);
gtk_box_pack_start (GTK_BOX (vbox34), label69, FALSE, FALSE, 0);
gtk_misc_set_padding (GTK_MISC (label69), 0, 5);
gtk_label_set_justify (GTK_LABEL (label69), GTK_JUSTIFY_CENTER);
gtk_misc_set_padding (GTK_MISC (label69), 0, 1);
combo_country = gtk_combo_box_new_text ();
gtk_widget_show (combo_country);
@ -142,11 +142,6 @@ create_window_startup (void)
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview_startup), TRUE);
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview_startup), TRUE);
hseparator10 = gtk_hseparator_new ();
gtk_widget_show (hseparator10);
gtk_box_pack_start (GTK_BOX (vbox2), hseparator10, FALSE, FALSE, 0);
gtk_widget_set_size_request (hseparator10, 1, 5);
hseparator11 = gtk_hseparator_new ();
gtk_widget_show (hseparator11);
gtk_box_pack_start (GTK_BOX (vbox2), hseparator11, FALSE, FALSE, 0);
@ -369,7 +364,6 @@ create_window_startup (void)
GLADE_HOOKUP_OBJECT (window_startup, treeview_users, "treeview_users");
GLADE_HOOKUP_OBJECT (window_startup, scrolledwindow1, "scrolledwindow1");
GLADE_HOOKUP_OBJECT (window_startup, treeview_startup, "treeview_startup");
GLADE_HOOKUP_OBJECT (window_startup, hseparator10, "hseparator10");
GLADE_HOOKUP_OBJECT (window_startup, hseparator11, "hseparator11");
GLADE_HOOKUP_OBJECT (window_startup, label4, "label4");
GLADE_HOOKUP_OBJECT (window_startup, comboboxentry_start_league, "comboboxentry_start_league");

View File

@ -431,10 +431,13 @@ player_compare_func(gconstpointer a, gconstpointer b, gpointer data)
player_get_game_skill(pl2, FALSE, TRUE));
else if(type == PLAYER_COMPARE_ATTRIBUTE_POS)
{
if(MIN(player_id_index(pl1->team, pl1->id), player_id_index(pl2->team, pl2->id)) < 11 &&
MAX(player_id_index(pl1->team, pl1->id), player_id_index(pl2->team, pl2->id)) >= 11)
if(MIN(player_id_index(pl1->team, pl1->id),
player_id_index(pl2->team, pl2->id)) < 11 &&
MAX(player_id_index(pl1->team, pl1->id),
player_id_index(pl2->team, pl2->id)) >= 11)
return_value =
(player_id_index(pl1->team, pl1->id) > player_id_index(pl2->team, pl2->id)) ?
(player_id_index(pl1->team, pl1->id) >
player_id_index(pl2->team, pl2->id)) ?
1 : -1;
else if(pl1->cskill == 0)
return_value = (pl2->cskill == 0) ? 0 : 1;

View File

@ -276,9 +276,8 @@ xml_loadsave_live_game_write(const gchar *filename, const LiveGame *live_game)
if(live_game->fix->id > 10000000)
g_warning(
"xml_loadsave_live_game_write: suspicious fix id: %d. competition: %s",
live_game->fix->id,
league_cup_get_name_string(live_game->fix->id));
"xml_loadsave_live_game_write: suspicious fix id: %d.",
live_game->fix->id);
for(i=0;i<2;i++)
xml_write_string(fil, live_game->team_names[i],

View File

@ -14,11 +14,10 @@ string_contrib_title Patches and ideas
string_contrib_entry Mark Calderbank, Michal Rudolf
string_contrib_title Country definitions
string_contrib_entry Győző Both (Australia, Italy, Scotland, USA, WC2006)
string_contrib_entry Győző Both (Australia, Brazil, Italy, Scotland, USA, WC2006)
string_contrib_entry Mark Calderbank (Bulgaria, England, Ireland, Spain, Victoria, Wales)
string_contrib_entry Tobe &amp; Arne Deprez (Belgium)
string_contrib_entry Theodore Dimitriadis (Greece)
string_contrib_entry Celso Goya (Brazil)
string_contrib_entry Pechorin (Serbia &amp; Montenegro)
string_contrib_entry Koen Pijnenburg (Netherlands)
string_contrib_entry Arnaud Le Rouzic (France)