Added debug logging.

This commit is contained in:
gyboth 2009-04-29 17:18:54 +00:00
parent 8441cb596e
commit 078b70a1ea
52 changed files with 364 additions and 326 deletions

View File

@ -36,6 +36,7 @@
#include <gtk/gtk.h>
#include "gettext_macros.h"
#include "debug.h"
/**
* Program version number and year (copyright).
@ -90,7 +91,7 @@
#define stat4 status[4]
#define stat5 status[5]
#define debug const_int("int_debug")
#define debug debug_level
#define debug_writer const_int("int_debug_writer")
/* Uncommenting this will cause each function to print its name when it's entered.
Makes the whole program really slow, of course. */

View File

@ -267,7 +267,7 @@ callback_show_fixtures_week(gint type)
switch(type)
{
default:
g_warning("callback_show_fixtures_week: unknown type %d \n", type);
debug_print_message("callback_show_fixtures_week: unknown type %d \n", type);
return;
break;
case SHOW_CURRENT:
@ -338,7 +338,7 @@ callback_show_tables(gint type)
clid = league_cup_get_previous_clid(stat1, FALSE);
else
{
g_warning("callback_show_tables: unknown type %d \n", type);
debug_print_message("callback_show_tables: unknown type %d \n", type);
return;
}
@ -715,7 +715,7 @@ callback_show_player_list(gint type)
switch(type)
{
default:
g_warning("callback_show_player_list: unknown type %d \n", type);
debug_print_message("callback_show_player_list: unknown type %d \n", type);
return;
break;
case SHOW_CURRENT:
@ -770,7 +770,7 @@ callback_show_league_stats(gint type)
switch(type)
{
default:
g_warning("callback_show_league_stats: unknown type %d \n", type);
debug_print_message("callback_show_league_stats: unknown type %d \n", type);
return;
break;
case SHOW_CURRENT:
@ -808,7 +808,7 @@ callback_show_season_history(gint type)
switch(type)
{
default:
g_warning("callback_show_season_history: unknown type %d \n", type);
debug_print_message("callback_show_season_history: unknown type %d \n", type);
return;
break;
case SHOW_CURRENT:

View File

@ -837,19 +837,19 @@ cup_get_first_week_of_cup_round(Cup *cup, gint cup_round, gboolean with_delay)
if(week_number <= 0)
{
g_warning("cup_get_first_week_of_cup_round: First week of cup %s, cup round %d is not positive (%d). Please correct the cup definition file!!!\n",
debug_print_message("cup_get_first_week_of_cup_round: First week of cup %s, cup round %d is not positive (%d). Please correct the cup definition file!!!\n",
cup->name, cup_round, week_number);
if(cup->week_gap > 1)
{
cup->week_gap--;
g_warning("Lowering week gap to %d and trying again.\n",
debug_print_message("Lowering week gap to %d and trying again.\n",
cup->week_gap);
}
else
{
cup->last_week++;
g_warning("Increasing last week to %d and trying again.\n",
debug_print_message("Increasing last week to %d and trying again.\n",
cup->last_week);
}
@ -1251,7 +1251,7 @@ cup_check_fixtures(const Cup *cup)
g_array_index(cup->fixtures, Fixture, i).teams[1])
{
if(!query_league_cup_has_property(cup->id, "silent_on_fixture_error"))
g_warning("cup_check_fixture: bad fixture found in cup %s; cup will be disabled\n", cup->name);
debug_print_message("cup_check_fixture: bad fixture found in cup %s; cup will be disabled\n", cup->name);
return FALSE;
}

View File

@ -1,26 +1,26 @@
/*
debug.c
debug.c
Bygfoot Football Manager -- a small and simple GTK2-based
football management game.
Bygfoot Football Manager -- a small and simple GTK2-based
football management game.
http://bygfoot.sourceforge.net
http://bygfoot.sourceforge.net
Copyright (C) 2005 Gyözö Both (gyboth@bygfoot.com)
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 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.
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.
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.
*/
#include "callbacks.h"
@ -35,6 +35,59 @@
#include "user.h"
#include "variables.h"
void
debug_print_message(gchar *format, ...)
{
gchar text[SMALL];
va_list args;
gchar buf[SMALL];
const gchar *home;
FILE *fil = NULL;
GTimeVal logtime;
gchar *logtime_string;
if(format != NULL)
{
va_start (args, format);
g_vsprintf(buf, format, args);
va_end (args);
}
if(debug_output != DEBUG_OUT_LOGFILE)
g_warning("%s\n", buf);
if(debug_output != DEBUG_OUT_STDOUT)
{
g_get_current_time(&logtime);
logtime_string = g_time_val_to_iso8601(&logtime);
sprintf(text, "%s %s\n", logtime_string, buf);
g_free(logtime_string);
home = g_get_home_dir();
if(os_is_unix)
sprintf(buf, "%s%s%s%sbygfoot.log", home, G_DIR_SEPARATOR_S,
HOMEDIRNAME, G_DIR_SEPARATOR_S);
else
{
gchar *pwd = g_get_current_dir();
sprintf(buf, "%s%sbygfoot.log", pwd, G_DIR_SEPARATOR_S);
g_free(pwd);
}
fil = fopen(buf, "a");
if(fil == NULL)
{
g_warning("Couldn't open log file %s\n", buf);
return;
}
fprintf(fil, "%s\n", text);
fclose(fil);
}
}
/** Take some debug action depending on the text. Text is a prefix and a number. */
void
debug_action(const gchar *text)
@ -53,19 +106,14 @@ debug_action(const gchar *text)
if(g_str_has_prefix(text, "deb"))
{
option_set_int("int_debug", &constants, value);
debug_level = value;
game_gui_print_message("Debug value set to %d.", value);
}
else if(g_str_has_prefix(text, "writer"))
{
option_set_int("int_debug_writer", &constants, value);
game_gui_print_message("Debug writer value set to %d.", value);
}
else if(g_str_has_prefix(text, "cap"))
{
current_user.tm->stadium.capacity += value;
game_gui_print_message("Stadium capacity changed by %d. New: %d.", value,
current_user.tm->stadium.capacity);
current_user.tm->stadium.capacity);
}
else if(g_str_has_prefix(text, "saf"))
{
@ -73,19 +121,19 @@ debug_action(const gchar *text)
current_user.tm->stadium.safety =
CLAMP(current_user.tm->stadium.safety, 0, 1);
game_gui_print_message("Stadium safety changed by %d. New: %.2f", value,
current_user.tm->stadium.safety);
current_user.tm->stadium.safety);
}
else if(g_str_has_prefix(text, "mon"))
{
current_user.money += value;
game_gui_print_message("Money changed by %d. New: %d.", value,
current_user.money);
current_user.money);
}
else if(g_str_has_prefix(text, "suc"))
{
current_user.counters[COUNT_USER_SUCCESS] += value;
game_gui_print_message("Success counter changed by %d. New: %d.", value,
current_user.counters[COUNT_USER_SUCCESS]);
current_user.counters[COUNT_USER_SUCCESS]);
}
else if(g_str_has_prefix(text, "scout"))
{
@ -110,7 +158,7 @@ debug_action(const gchar *text)
else if(g_str_has_prefix(text, "goto"))
{
if(debug < 50)
option_set_int("int_debug", &constants, 50);
debug_level = 50;
if(option_int("int_opt_user_show_live_game", &current_user.options))
option_set_int("int_opt_user_show_live_game", &current_user.options, 0);
@ -157,24 +205,24 @@ debug_action(const gchar *text)
else if(g_str_has_prefix(text, "help"))
{
g_print("Debug options:\n"
"deb \t set debug value\n"
"writer \t set debug-writer value\n"
"cap \t change stadium capacity\n"
"saf \t change stadium safety\n"
"mon \t change money\n"
"suc \t change success counter\n"
"scout \t change scout\n"
"physio \t change physio\n"
"printweeks \t print the starting weeks of all cup rounds\n"
"youth coach \t change youth coach\n"
"pospref \t change recruiting pref\n"
"goto \t Press 'new week' automatically until\n"
" \t the appropriate week is reached\n"
" \t Supply 100+X to go to season X (e.g. 102)\n"
"testcom|tc \t Test a specific live game commentary.\n"
" \t Find the numbers in live_game_struct.h (LiveGameEventType)\n"
" \t Use 'goto' afterwards.\n"
"help \t display this help\n");
"deb \t set debug value\n"
"writer \t set debug-writer value\n"
"cap \t change stadium capacity\n"
"saf \t change stadium safety\n"
"mon \t change money\n"
"suc \t change success counter\n"
"scout \t change scout\n"
"physio \t change physio\n"
"printweeks \t print the starting weeks of all cup rounds\n"
"youth coach \t change youth coach\n"
"pospref \t change recruiting pref\n"
"goto \t Press 'new week' automatically until\n"
" \t the appropriate week is reached\n"
" \t Supply 100+X to go to season X (e.g. 102)\n"
"testcom|tc \t Test a specific live game commentary.\n"
" \t Find the numbers in live_game_struct.h (LiveGameEventType)\n"
" \t Use 'goto' afterwards.\n"
"help \t display this help\n");
}
setsav0;
@ -259,41 +307,3 @@ debug_egg_forwards_boost_style(void)
return (fwds > 3);
}
/**
* debug_writer writes debug-messages to an outpot
*
* *file_name = the name of the file where the debug-funtion is called
* *method_name = the name of the function where the debug-funtion is called
* *text = the text of the debug message
*
* debuglevel < int_debug -> print message to output
*/
void
debug_writer_out(const gchar *file_name,
const gchar *method_name,
const gchar *text,
gint debuglevel)
{
#ifdef DEBUG
printf("debug_writer_out\n");
#endif
gint writer = option_int("int_debug_writer", &constants);
gint debugging = option_int("int_debug", &constants);
if ((debuglevel < debugging) && (writer == 1))
{
printf("%s # %s # %s\n", file_name, method_name, text);
}
//Example
//gchar message[SMALL];
//sprintf(message, "Number of players in player list: %d", current_user.tm->players->len);
//debug_writer_out("misc2_callbacks2.c",
// "on_button_transfer_yes_clicked",
// message,
// 3);
}

View File

@ -26,7 +26,15 @@
#ifndef DEBUG_H
#define DEBUG_H
#include "bygfoot.h"
#include <gtk/gtk.h>
//#include "bygfoot.h"
enum DebugOutput
{
DEBUG_OUT_STDOUT = 0,
DEBUG_OUT_LOGFILE,
DEBUG_OUT_STDOUT_LOGFILE
};
void
debug_action(const gchar *text);
@ -46,5 +54,8 @@ debug_writer_out(const gchar *file_name,
const gchar *text,
gint debuglevel);
void
debug_print_message(gchar *format, ...);
#endif

View File

@ -127,10 +127,6 @@ file_add_support_directory_recursive (const gchar *directo
gchar*
file_find_support_file (const gchar *filename, gboolean warning)
{
#ifdef DEBUG
printf("file_find_support_file\n");
#endif
#ifdef DEBUG
printf("file_find_support_file\n");
#endif
@ -150,7 +146,7 @@ file_find_support_file (const gchar *filename, gboolea
}
if(warning)
g_warning("file_find_support_file: file '%s' not found.", filename);
debug_print_message("file_find_support_file: file '%s' not found.", filename);
return NULL;
}
@ -166,11 +162,11 @@ file_my_system(const GString *command)
if(system(command->str) != 0)
{
g_warning("file_my_system: system returned -1 when executing '%s'.", command->str);
debug_print_message("file_my_system: system returned -1 when executing '%s'.", command->str);
if(!os_is_unix)
{
g_warning("Press RETURN to try to continue.");
debug_print_message("Press RETURN to try to continue.");
getchar();
}
@ -209,7 +205,7 @@ file_my_fopen(const gchar *filename, gchar *bits, FILE **fil, gboolean abort_pro
return TRUE;
}
g_warning("Could not open file '%s' in mode '%s'.\n", filename, bits);
debug_print_message("Could not open file '%s' in mode '%s'.\n", filename, bits);
if(abort_program)
main_exit_program(EXIT_FILE_OPEN_FAILED, NULL);
@ -562,7 +558,7 @@ file_get_next_opt_line(FILE *fil, gchar *opt_name, gchar *opt_value)
if(buf[0] != '#' && strlen(buf) != 0)
{
if(strlen(buf) > 1000)
g_warning("\n the text file I'm reading contains a line longer than 1000 chars.\n\n");
debug_print_message("\n the text file I'm reading contains a line longer than 1000 chars.\n\n");
for(i=0;i<strlen(buf);i++)
if(buf[i] == '#')
@ -741,10 +737,6 @@ file_load_user_conf_file(User *user)
const gchar*
file_get_first_support_dir(void)
{
#ifdef DEBUG
printf("file_get_first_support_dir\n");
#endif
#ifdef DEBUG
printf("file_get_first_support_dir\n");
#endif
@ -770,10 +762,6 @@ file_get_first_support_dir(void)
const gchar*
file_get_first_support_dir_suffix(const gchar *suffix)
{
#ifdef DEBUG
printf("file_get_first_support_dir_suffix\n");
#endif
#ifdef DEBUG
printf("file_get_first_support_dir_suffix\n");
#endif
@ -788,7 +776,7 @@ file_get_first_support_dir_suffix(const gchar *suffix)
elem = elem->next;
}
g_warning("file_get_first_support_dir_suffix: no dir with suffix %s found.",
debug_print_message("file_get_first_support_dir_suffix: no dir with suffix %s found.",
suffix);
return NULL;
@ -973,7 +961,7 @@ file_store_text_in_saves(const gchar *filename, const gchar *text)
if(!file_my_fopen(buf, "w", &fil, FALSE))
{
g_warning("file_store_text_in_saves: failed to store '%s' in file '%s'\n", text, buf);
debug_print_message("file_store_text_in_saves: failed to store '%s' in file '%s'\n", text, buf);
return;
}

View File

@ -988,7 +988,7 @@ fixture_get_first_leg(const Fixture *fix, gboolean silent)
first_leg = &g_array_index(fixtures, Fixture, i);
if(first_leg == NULL && !silent)
g_warning("fixture_get_first_leg: didn't find first leg match; cup %s round %d\n",
debug_print_message("fixture_get_first_leg: didn't find first leg match; cup %s round %d\n",
cup_from_clid(fix->clid)->name, fix->round);
return first_leg;
@ -1208,7 +1208,7 @@ fixture_get(gint type, gint clid, gint week_number,
}
if(fix == NULL)
g_warning("fixture_get: no fixture found for type %d clid %d (%s) week %d round %d\n",
debug_print_message("fixture_get: no fixture found for type %d clid %d (%s) week %d round %d\n",
type, clid, league_cup_get_name_string(clid), week_number, week_round_number);
return fix;
@ -1233,7 +1233,7 @@ fixture_compare_func(gconstpointer a, gconstpointer b, gpointer data)
switch(type)
{
default:
g_warning("fixture_compare_func: unknown type %d.\n", type);
debug_print_message("fixture_compare_func: unknown type %d.\n", type);
break;
case FIXTURE_COMPARE_DATE:
if(query_fixture_is_earlier(fix1, fix2))
@ -1570,7 +1570,7 @@ fixture_get_goals_to_win(const Fixture *fix, const Team *tm)
if(!query_fixture_team_involved(fix, tm->id))
{
g_warning("fixture_get_goals_to_win: team %s doesn't participate in fixture given (%s)\n",
debug_print_message("fixture_get_goals_to_win: team %s doesn't participate in fixture given (%s)\n",
tm->name, league_cup_get_name_string(fix->clid));
return -100;
}

View File

@ -188,7 +188,7 @@ game_get_player(const Team *tm, gint player_type,
}
else
{
g_warning("game_get_player: All players injured or banned, apparently.\n");
debug_print_message("game_get_player: All players injured or banned, apparently.\n");
g_print("%s %s player list:\n", league_cup_get_name_string(tm->clid), tm->name);
for(i=0;i<tm->players->len;i++)
{
@ -724,7 +724,7 @@ game_substitute_player(Team *tm, gint player_number)
if(substitutes->len == 0)
{
g_ptr_array_free(substitutes, TRUE);
g_warning("game_substitute_player: no suitable substitutes found (all injured/banned?)");
debug_print_message("game_substitute_player: no suitable substitutes found (all injured/banned?)");
return -1;
}
@ -880,7 +880,7 @@ game_substitute_player_send_off(gint clid, Team *tm, gint player_number,
if(substitutes->len == 0)
{
g_ptr_array_free(substitutes, TRUE);
g_warning("game_substitute_player_send_off: no suitable substitutes found (all injured/banned?)");
debug_print_message("game_substitute_player_send_off: no suitable substitutes found (all injured/banned?)");
*to_substitute = -1;
return;
}

View File

@ -182,7 +182,7 @@ game_gui_live_game_set_hscale(const LiveGameUnit *unit, GtkHScale *hscale)
((unit->possession == 0) ? -1 : 1)));
}
else
g_warning("game_gui_live_game_set_hscale: don't know what to do!\n");
debug_print_message("game_gui_live_game_set_hscale: don't know what to do!\n");
gtk_widget_modify_bg(GTK_WIDGET(hscale), GTK_STATE_NORMAL, &color);
}
@ -919,7 +919,7 @@ game_gui_read_check_items(GtkWidget *widget)
opt_int("int_opt_save_will_overwrite")));
}
else
g_warning("game_gui_read_check_items: unknown widget.");
debug_print_message("game_gui_read_check_items: unknown widget.");
}
/** Set the appropriate text into the labels in the help window.

View File

@ -161,7 +161,7 @@ language_compare_country_files(gconstpointer a, gconstpointer b, gpointer data)
if(j == 26)
{
g_warning("language_compare_country_files: chars %c and %c not comparable",
debug_print_message("language_compare_country_files: chars %c and %c not comparable",
def1[i], def2[i]);
return_value = 0;
}

View File

@ -423,7 +423,7 @@ league_remove_team_with_id(League *league, gint id)
return;
}
g_warning("league_remove_team_with_id: team with id %d in league %s not found\n",
debug_print_message("league_remove_team_with_id: team with id %d in league %s not found\n",
id, league->name);
}

View File

@ -98,7 +98,7 @@ lg_commentary_generate(const LiveGame *live_game, LiveGameUnit *unit,
commentary_idx = lg_commentary_select(commentaries, buf);
if(commentary_idx == -1)
g_warning("lg_commentary_generate: didn't find fitting commentary for unit type %d \n",
debug_print_message("lg_commentary_generate: didn't find fitting commentary for unit type %d \n",
event_type);
if(live_game != NULL)

View File

@ -169,7 +169,7 @@ live_game_create_unit(void)
if(uni(unis->len - 1).event.type == LIVE_GAME_EVENT_END_MATCH)
{
g_warning("live_game_create_unit: called after end of match.\n");
debug_print_message("live_game_create_unit: called after end of match.\n");
return;
}
@ -347,7 +347,7 @@ live_game_evaluate_unit(LiveGameUnit *unit)
misc_callback_pause_live_game();
}
else if(type != LIVE_GAME_EVENT_END_MATCH)
g_warning("live_game_evaluate_unit: unknown event type %d\n",
debug_print_message("live_game_evaluate_unit: unknown event type %d\n",
type);
}
@ -1458,7 +1458,7 @@ live_game_unit_before(const LiveGameUnit* unit, gint gap)
if(i - gap > 0)
return &uni(i - gap);
else
g_warning("live_game_unit_before: no unit found for gap %d\n", gap);
debug_print_message("live_game_unit_before: no unit found for gap %d\n", gap);
}
}
else
@ -1469,7 +1469,7 @@ live_game_unit_before(const LiveGameUnit* unit, gint gap)
if(i + gap < unis->len - 1)
return &uni(i + gap);
else
g_warning("live_game_unit_before: no unit found for gap %d\n", gap);
debug_print_message("live_game_unit_before: no unit found for gap %d\n", gap);
}
}

View File

@ -461,7 +461,7 @@ load_game_from_command_line(const gchar *filename)
return FALSE;
}
g_warning("Could not find file %s.\n", fullname);
debug_print_message("Could not find file %s.\n", fullname);
g_free(fullname);
return FALSE;

View File

@ -76,10 +76,9 @@ 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, *debug_text = NULL,
*event_name = NULL,
*country_sid = NULL;
gint deb_level = -1, number_of_passes = 1,
deb_writer = -1,
gint number_of_passes = 1,
num_matches = 100, skilldiffmax = 20;
GError *error = NULL;
GOptionContext *context = NULL;
@ -93,10 +92,6 @@ main_parse_cl_arguments(gint *argc, gchar ***argv)
{ "lang", 'L', 0, G_OPTION_ARG_STRING, &lang, _("Language to use (a code like 'de')"), "CODE" },
{ "debug-level", 'd', 0, G_OPTION_ARG_INT, &deb_level, "[developer] Debug level to use", "N" },
{ "debug-writer", 'w', 0, G_OPTION_ARG_INT, &deb_writer, "[developer] Debug writer level to use", "N" },
{ "testcom", 't', 0, G_OPTION_ARG_NONE, &testcom, _("Test an XML commentary file"), NULL },
{ "commentary-file", 'C', 0, G_OPTION_ARG_STRING, &testcom_file,
@ -114,7 +109,7 @@ main_parse_cl_arguments(gint *argc, gchar ***argv)
{ "num-passes", 'n', 0, G_OPTION_ARG_INT, &number_of_passes,
_("How many commentaries to generate per event"), "N" },
{ "calodds", 'o', 0, G_OPTION_ARG_NONE, &calodds,
{ "calodds", 'O', 0, G_OPTION_ARG_NONE, &calodds,
"[developer] Calibrate the betting odds by simulating a lot of matches", NULL },
{ "num-matches", 'm', 0, G_OPTION_ARG_INT, &num_matches,
@ -123,9 +118,6 @@ 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,
"[developer] A debug command like 'deb100 to set the debug level'; see the debug window and debug.c", "STRING" },
{NULL}};
if(argc == NULL || argv == NULL)
@ -162,15 +154,6 @@ main_parse_cl_arguments(gint *argc, gchar ***argv)
g_free(support_dir);
}
if(deb_level != -1)
{
option_set_int("int_debug", &constants, deb_level);
window_create(WINDOW_DEBUG);
}
if(deb_writer != -1)
option_set_int("int_debug_writer", &constants, deb_writer);
if(lang != NULL)
{
language_set(language_get_code_index(lang) + 1);
@ -178,9 +161,6 @@ main_parse_cl_arguments(gint *argc, gchar ***argv)
g_free(lang);
}
if(debug_text != NULL)
statp = debug_text;
if(country_sid != NULL)
{
country.sid = g_strdup(country_sid);
@ -188,6 +168,58 @@ main_parse_cl_arguments(gint *argc, gchar ***argv)
}
}
/** Parse the command line arguments given by the user. */
void
main_parse_debug_cl_arguments(gint *argc, gchar ***argv)
{
#ifdef DEBUG
printf("main_parse_debug_cl_arguments\n");
#endif
gint deb_level = -1,
deb_output = -1;
gchar *debug_text = NULL;
GError *error = NULL;
GOptionContext *context = NULL;
GOptionEntry entries[] =
{{ "debug-level", 'd', 0, G_OPTION_ARG_INT, &deb_level, "[developer] Debug level to use", "N" },
{ "debug-output", 'o', 0, G_OPTION_ARG_INT, &deb_output, "[developer] Debug output to use", "0, 1 or 2" },
{ "deb", 'D', 0, G_OPTION_ARG_STRING, &debug_text,
"[developer] A debug command like 'deb100 to set the debug level'; see the debug window and debug.c", "STRING" },
{NULL}};
if(argc == NULL || argv == NULL)
return;
context = g_option_context_new(_("- a simple and addictive GTK2 football manager"));
g_option_context_set_ignore_unknown_options(context, TRUE);
g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
g_option_context_add_group(context, gtk_get_option_group (TRUE));
g_option_context_parse(context, argc, argv, &error);
g_option_context_free(context);
if(error != NULL)
{
debug_print_message("error message: %s\n", error->message);
g_error_free(error);
return;
}
debug_level = 0;
if(deb_level != -1)
{
debug_level = deb_level;
window_create(WINDOW_DEBUG);
}
debug_output = DEBUG_OUT_STDOUT;
if(deb_output != -1)
debug_output = deb_output;
if(debug_text != NULL)
statp = debug_text;
}
/**
Initialize some global variables. Most of them get nullified.
*/
@ -295,13 +327,17 @@ main_init(gint *argc, gchar ***argv)
gchar buf[SMALL];
gchar *pwd = g_get_current_dir();
support_directories = NULL;
rand_generator = g_rand_new();
main_parse_debug_cl_arguments(argc, argv);
#ifdef G_OS_WIN32
os_is_unix = FALSE;
#else
os_is_unix = TRUE;
#endif
support_directories = NULL;
#ifdef G_OS_UNIX
file_add_support_directory_recursive(PACKAGE_DATA_DIR "/" PACKAGE "/support_files");
sprintf(buf, "%s%s%s", g_get_home_dir(), G_DIR_SEPARATOR_S, HOMEDIRNAME);
@ -314,9 +350,6 @@ main_init(gint *argc, gchar ***argv)
file_add_support_directory_recursive(buf);
g_free(pwd);
/* initialize the random nr generator */
rand_generator = g_rand_new();
main_init_variables();
load_last_save = FALSE;
@ -397,7 +430,7 @@ main_exit_program(gint exit_code, gchar *format, ...)
va_start (args, format);
g_vsprintf(text, format, args);
va_end (args);
g_warning(text, NULL);
debug_print_message(text, NULL);
}
if(gtk_main_level() > 0)
@ -407,7 +440,7 @@ main_exit_program(gint exit_code, gchar *format, ...)
if(!os_is_unix && exit_code != EXIT_OK)
{
g_warning("Press RETURN. Program will exit.");
debug_print_message("Press RETURN. Program will exit.");
getchar();
}

View File

@ -48,7 +48,7 @@ misc_print_error(GError **error, gboolean abort_program)
if(*error == NULL)
return;
g_warning("error message: %s\n", (*error)->message);
debug_print_message("error message: %s\n", (*error)->message);
g_error_free(*error);
*error = NULL;
@ -112,7 +112,7 @@ misc_separate_strings(gchar *string)
if(start == strlen(string))
{
g_warning("misc_separate_strings: input string contains only white spaces\n");
debug_print_message("misc_separate_strings: input string contains only white spaces\n");
return string_array;
}
@ -596,7 +596,7 @@ misc_string_replace_expressions(gchar *string)
if(occurrence2 == NULL)
{
g_warning("misc_string_replace_expressions: no matching ] found.");
debug_print_message("misc_string_replace_expressions: no matching ] found.");
return;
}

View File

@ -245,7 +245,7 @@ on_button_yesno_yes_clicked (GtkButton *button,
switch(stat1)
{
default:
g_warning("on_button_yesno_yes_clicked: unknown status %d\n", stat1);
debug_print_message("on_button_yesno_yes_clicked: unknown status %d\n", stat1);
break;
case STATUS_PAY_LOAN:
on_automatic_loan_repayment_activate(NULL, NULL);
@ -691,7 +691,7 @@ on_treeview_mmatches_button_press_event (GtkWidget *widget,
if(col_num == -1 || mmidx == -1)
{
g_warning("on_treeview_mmatches_button_press_event: column or row not valid\n");
debug_print_message("on_treeview_mmatches_button_press_event: column or row not valid\n");
return TRUE;
}

View File

@ -63,7 +63,7 @@ name_get(const gchar *names_file)
if(new.sid == NULL)
{
g_warning("name_get_new: names file with sid '%s' not found, taking general names file.\n",
debug_print_message("name_get_new: names file with sid '%s' not found, taking general names file.\n",
names_file);
return name_get(opt_str("string_opt_player_names_file"));
}

View File

@ -145,7 +145,7 @@ option_set_string(const gchar *name, OptionList *optionlist, const gchar *new_va
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
if(element == NULL)
g_warning("option_set_string: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
debug_print_message("option_set_string: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
else
misc_string_assign(&((Option*)element)->string_value, new_value);
}
@ -164,7 +164,7 @@ option_set_int(const gchar *name, OptionList *optionlist, gint new_value)
gpointer element = g_datalist_get_data(&optionlist->datalist, name);
if(element == NULL)
g_warning("option_set_int: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
debug_print_message("option_set_int: option named %s not found\nMaybe you should delete the .bygfoot directory from your home dir", name);
else
((Option*)element)->value = new_value;
}
@ -189,7 +189,7 @@ option_add(OptionList *optionlist, const gchar *name,
if(element != NULL)
{
if(debug > 0)
g_warning("Option %s already in optionlist\n", name);
debug_print_message("Option %s already in optionlist\n", name);
((Option*)element)->value = int_value;
((Option*)element)->string_value = (string_value == NULL) ? NULL : g_strdup(string_value);
return;

View File

@ -933,7 +933,7 @@ player_card_set(Player *pl, gint clid, gint card_type, gint value, gboolean diff
if(*card_value < 0)
{
g_warning("player_card_set: negative card value; setting to 0\n");
debug_print_message("player_card_set: negative card value; setting to 0\n");
*card_value = 0;
}
@ -1009,7 +1009,7 @@ player_games_goals_set(Player *pl, gint clid, gint type, gint value)
if(*games_goals_value < 0)
{
g_warning("player_games_goals_set: negative value; setting to 0\n");
debug_print_message("player_games_goals_set: negative value; setting to 0\n");
*games_goals_value = 0;
}
@ -1163,7 +1163,7 @@ player_update_streak(Player *pl)
else if(pl->streak == PLAYER_STREAK_COLD)
decrease_factor = 1;
else
g_warning("player_update_streak: streak count is positive (%.1f) but player %s is not on a streak!\n", pl->streak_count, pl->name);
debug_print_message("player_update_streak: streak count is positive (%.1f) but player %s is not on a streak!\n", pl->streak_count, pl->name);
pl->streak_count -=
(pl->streak_prob * decrease_factor *
@ -1399,7 +1399,7 @@ player_injury_to_char(gint injury_type)
switch(injury_type)
{
default:
g_warning("player_injury_to_char: unknown type %d\n", injury_type);
debug_print_message("player_injury_to_char: unknown type %d\n", injury_type);
return "";
break;
case PLAYER_INJURY_NONE:
@ -1506,7 +1506,7 @@ player_get_last_name(const gchar *name)
if(!g_utf8_validate(name, -1, NULL))
{
g_warning("player_get_last_name: invalid utf8-string: %s \n", name);
debug_print_message("player_get_last_name: invalid utf8-string: %s \n", name);
return "";
}

View File

@ -110,7 +110,7 @@ strategy_compare_players(gconstpointer a,
return_value = misc_float_compare(skill1, skill2);
}
else
g_warning("strategy_compare_players: unknown lineup type %d\n", strat->lineup);
debug_print_message("strategy_compare_players: unknown lineup type %d\n", strat->lineup);
}
return return_value;
@ -500,7 +500,7 @@ strategy_compare_players_sub(gconstpointer a,
switch(property)
{
default:
g_warning("strategy_compare_players_sub: unknown property %d\n",
debug_print_message("strategy_compare_players_sub: unknown property %d\n",
property);
return_value = 0;
break;

View File

@ -658,7 +658,7 @@ team_change_attribute_with_message(Team *tm, gint attribute, gint new_value)
switch(attribute)
{
default:
g_warning("team_attribute_to_char: unknown attribute %d\n", attribute);
debug_print_message("team_attribute_to_char: unknown attribute %d\n", attribute);
break;
case TEAM_ATTRIBUTE_STYLE:
current_user.tm->style = new_value;

View File

@ -740,7 +740,7 @@ treeview2_create_constants(const GPtrArray *list, gint type)
switch(type)
{
default:
g_warning("treeview2_create_constants: unknown constants type\n");
debug_print_message("treeview2_create_constants: unknown constants type\n");
return NULL;
case CONSTANTS_TYPE_INT:
ls = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);

View File

@ -306,7 +306,7 @@ treeview_helper_get_user_history_icon(gint history_type)
switch(history_type)
{
default:
g_warning("treeview_helper_get_user_history_icon: unknown type %d.\n", history_type);
debug_print_message("treeview_helper_get_user_history_icon: unknown type %d.\n", history_type);
return NULL;
case USER_HISTORY_START_GAME:
return const_app("string_treeview_helper_user_history_symbol_start_game_icon");
@ -417,7 +417,7 @@ treeview_helper_team_compare(GtkTreeModel *model,
switch(type)
{
default:
g_warning("treeview_team_compare: unknown type %d.\n", type);
debug_print_message("treeview_team_compare: unknown type %d.\n", type);
break;
case TEAM_COMPARE_AV_SKILL:
return_value = misc_float_compare(team_get_average_skill(tm1, FALSE),
@ -457,7 +457,7 @@ treeview_helper_player_compare(GtkTreeModel *model,
switch(type)
{
default:
g_warning("treeview_player_compare: unknown type %d.\n", type);
debug_print_message("treeview_player_compare: unknown type %d.\n", type);
break;
case PLAYER_LIST_ATTRIBUTE_POS:
return_value = misc_int_compare(pl1->pos, pl2->pos);
@ -785,7 +785,7 @@ treeview_helper_team_selection(GtkTreeViewColumn *col,
g_object_set(renderer, "text", buf, NULL);
}
else
g_warning("treeview_helper_team_selection: unknown column: %d\n", column);
debug_print_message("treeview_helper_team_selection: unknown column: %d\n", column);
}
/** Render an integer. This is only so that we know when to draw nothing. */
@ -843,7 +843,7 @@ treeview_helper_player_ext_info_to_cell(GtkTreeViewColumn *col,
switch(row_idx)
{
default:
g_warning("treeview_helper_player_ext_info_to_cell: unknown row index %d\n",
debug_print_message("treeview_helper_player_ext_info_to_cell: unknown row index %d\n",
row_idx);
break;
case PLAYER_INFO_ATTRIBUTE_NAME:
@ -1127,7 +1127,7 @@ treeview_helper_player_to_cell(GtkTreeViewColumn *col,
switch(attribute)
{
default:
g_warning("treeview_helper_player_to_cell: unknown attribute %d.\n", attribute);
debug_print_message("treeview_helper_player_to_cell: unknown attribute %d.\n", attribute);
break;
case PLAYER_LIST_ATTRIBUTE_NAME:
treeview_helper_player_name_to_cell(renderer, buf, pl);

View File

@ -551,7 +551,7 @@ user_event_show_next(void)
switch(event->type)
{
default:
g_warning("user_event_show_next: unknown event type %d\n", event->type);
debug_print_message("user_event_show_next: unknown event type %d\n", event->type);
break;
case EVENT_TYPE_PLAYER_LEFT:
game_gui_show_warning(_("%s has left your team because his contract expired."),
@ -820,7 +820,7 @@ user_history_to_string(const UserHistory *history, gchar *buf)
switch(history->type)
{
default:
g_warning("user_history_to_string: unknown history type %d.\n", history->type);
debug_print_message("user_history_to_string: unknown history type %d.\n", history->type);
strcpy(buf, "FIXME!!!");
case USER_HISTORY_START_GAME:
/* Buy a team in a league. */

View File

@ -114,6 +114,9 @@ gint timeout_id;
GRand *rand_generator;
/** Debug information. */
gint debug_level, debug_output;
/**
The list of directories the file_find_support_file() function
searches for support files (e.g. pixmaps or text files).

View File

@ -127,7 +127,7 @@ window_load_hint_number(void)
if(counters[COUNT_HINT_NUMBER] < 0 ||
counters[COUNT_HINT_NUMBER] >= hints.list->len)
{
g_warning("Hint counter out of bounds: %d (bounds 0 and %d).\n",
debug_print_message("Hint counter out of bounds: %d (bounds 0 and %d).\n",
counters[COUNT_HINT_NUMBER], hints.list->len - 1);
counters[COUNT_HINT_NUMBER] = 0;
}
@ -190,7 +190,7 @@ window_show_progress(gint pictype)
switch(pictype)
{
default:
g_warning("window_show_progress: unknown picture type %d",
debug_print_message("window_show_progress: unknown picture type %d",
pictype);
break;
case PIC_TYPE_SAVE:
@ -841,14 +841,14 @@ window_create(gint window_type)
break;
case WINDOW_STARTUP:
if(window.startup != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.startup = create_window_startup();
wind = window.startup;
break;
case WINDOW_LIVE:
if(window.live != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.live = create_window_live();
if(((LiveGame*)statp)->fix != NULL)
@ -858,7 +858,7 @@ window_create(gint window_type)
break;
case WINDOW_WARNING:
if(window.warning != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.warning = create_window_warning();
wind = window.warning;
@ -866,7 +866,7 @@ window_create(gint window_type)
break;
case WINDOW_PROGRESS:
if(window.progress != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.progress = create_window_progress();
wind = window.progress;
@ -874,7 +874,7 @@ window_create(gint window_type)
break;
case WINDOW_DIGITS:
if(window.digits != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.digits = create_window_digits();
@ -883,7 +883,7 @@ window_create(gint window_type)
break;
case WINDOW_STADIUM:
if(window.stadium != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.stadium = create_window_stadium();
wind = window.stadium;
@ -891,7 +891,7 @@ window_create(gint window_type)
break;
case WINDOW_JOB_OFFER:
if(window.job_offer != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.job_offer = create_window_job_offer();
wind = window.job_offer;
@ -899,7 +899,7 @@ window_create(gint window_type)
break;
case WINDOW_YESNO:
if(window.yesno != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.yesno = create_window_yesno();
wind = window.yesno;
@ -907,7 +907,7 @@ window_create(gint window_type)
break;
case WINDOW_OPTIONS:
if(window.options != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.options = create_window_options();
wind = window.options;
@ -915,7 +915,7 @@ window_create(gint window_type)
break;
case WINDOW_FONT_SEL:
if(window.font_sel != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.font_sel = create_window_font_sel();
wind = window.font_sel;
@ -923,14 +923,14 @@ window_create(gint window_type)
break;
case WINDOW_FILE_CHOOSER:
if(window.file_chooser != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.file_chooser = create_window_file_chooser();
wind = window.file_chooser;
break;
case WINDOW_CONTRACT:
if(window.contract != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.contract = create_window_contract();
wind = window.contract;
@ -938,7 +938,7 @@ window_create(gint window_type)
break;
case WINDOW_USER_MANAGEMENT:
if(window.user_management != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.user_management = create_window_user_management();
wind = window.user_management;
@ -946,7 +946,7 @@ window_create(gint window_type)
break;
case WINDOW_DEBUG:
if(window.wdebug != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.wdebug = create_window_debug();
wind = window.wdebug;
@ -954,14 +954,14 @@ window_create(gint window_type)
break;
case WINDOW_HELP:
if(window.help != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.help = create_window_help();
wind = window.help;
break;
case WINDOW_TRANSFER_DIALOG:
if(window.transfer_dialog != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.transfer_dialog = create_window_transfer_dialog();
wind = window.transfer_dialog;
@ -969,7 +969,7 @@ window_create(gint window_type)
break;
case WINDOW_SPONSORS:
if(window.sponsors != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.sponsors = create_window_sponsors();
wind = window.sponsors;
@ -977,7 +977,7 @@ window_create(gint window_type)
break;
case WINDOW_MMATCHES:
if(window.mmatches != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.mmatches = create_window_mmatches();
wind = window.mmatches;
@ -985,7 +985,7 @@ window_create(gint window_type)
break;
case WINDOW_BETS:
if(window.bets != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.bets = create_window_bets();
wind = window.bets;
@ -993,14 +993,14 @@ window_create(gint window_type)
break;
case WINDOW_SPLASH:
if(window.splash != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.splash = create_window_splash();
wind = window.splash;
break;
case WINDOW_TRAINING_CAMP:
if(window.training_camp != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.training_camp = create_window_training_camp();
wind = window.training_camp;
@ -1008,7 +1008,7 @@ window_create(gint window_type)
break;
case WINDOW_ALR:
if(window.alr != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.alr = create_window_alr();
wind = window.alr;
@ -1016,7 +1016,7 @@ window_create(gint window_type)
break;
case WINDOW_NEWS:
if(window.news != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.news = create_window_news();
wind = window.news;
@ -1024,7 +1024,7 @@ window_create(gint window_type)
break;
case WINDOW_CONSTANTS:
if(window.constants != NULL)
g_warning("window_create: called on already existing window\n");
debug_print_message("window_create: called on already existing window\n");
else
window.constants = create_window_constants();
wind = window.constants;

View File

@ -113,7 +113,7 @@ xml_country_read_start_element (GMarkupParseContext *context,
else if(strcmp(element_name, TAG_CUP) == 0)
state = STATE_CUP;
else if(strcmp(element_name, TAG_COUNTRY) != 0)
g_warning("xml_country_read_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_country_read_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -147,7 +147,7 @@ xml_country_read_end_element (GMarkupParseContext *context,
state = STATE_CUPS;
else if(strcmp(element_name, TAG_COUNTRY) != 0)
g_warning("xml_country_read_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_country_read_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -238,7 +238,7 @@ xml_country_read(const gchar *country_name, Country *cntry_arg)
if(!g_file_get_contents(file_name, &file_contents, &length, &error))
{
g_warning("xml_country_read: error reading file %s\n", file_name);
debug_print_message("xml_country_read: error reading file %s\n", file_name);
misc_print_error(&error, TRUE);
return;
}

View File

@ -234,7 +234,7 @@ xml_cup_read_start_element (GMarkupParseContext *context,
else
{
new_wait.cup_round = -1;
g_warning("xml_cup_read_start_element: No round number specified for cup round wait in cup %s\n", new_cup.name);
debug_print_message("xml_cup_read_start_element: No round number specified for cup round wait in cup %s\n", new_cup.name);
}
}
else if(strcmp(element_name, TAG_CUP_ROUND_TWO_MATCH_WEEK_START) == 0)
@ -269,7 +269,7 @@ xml_cup_read_start_element (GMarkupParseContext *context,
else if(strcmp(element_name, TAG_CHOOSE_TEAM_PRELOAD) == 0)
state = STATE_CHOOSE_TEAM_PRELOAD;
else
g_warning("xml_cup_read_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_cup_read_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -356,7 +356,7 @@ xml_cup_read_end_element (GMarkupParseContext *context,
strcmp(element_name, TAG_CHOOSE_TEAM_GENERATE) == 0)
state = STATE_CHOOSE_TEAM;
else if(strcmp(element_name, TAG_CUP) != 0)
g_warning("xml_cup_read_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_cup_read_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -505,7 +505,7 @@ xml_cup_read(const gchar *cup_name, GArray *cups)
if(!g_file_get_contents(file_name, &file_contents, &length, &error))
{
g_warning("xml_cup_read: error reading file %s\n", file_name);
debug_print_message("xml_cup_read: error reading file %s\n", file_name);
misc_print_error(&error, FALSE);
return;
}

View File

@ -275,7 +275,7 @@ xml_league_read_start_element (GMarkupParseContext *context,
else if(strcmp(element_name, TAG_TEAM_DEF_FILE) == 0)
state = STATE_TEAM_DEF_FILE;
else
g_warning("xml_league_read_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_league_read_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -340,7 +340,7 @@ xml_league_read_end_element (GMarkupParseContext *context,
strcmp(element_name, TAG_TEAM_NAMES_FILE) == 0)
state = STATE_TEAM;
else if(strcmp(element_name, TAG_LEAGUE) != 0)
g_warning("xml_league_end_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_league_end_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -508,7 +508,7 @@ xml_league_read(const gchar *league_name, GArray *leagues)
if(!g_file_get_contents(file_name, &file_contents, &length, &error))
{
g_warning("xml_league_read: error reading file %s\n", file_name);
debug_print_message("xml_league_read: error reading file %s\n", file_name);
misc_print_error(&error, FALSE);
return;
}

View File

@ -156,7 +156,7 @@ xml_lg_commentary_event_name_to_int(const gchar *event_string)
else if(strcmp(event_string, EVENT_NAME_BOOST_CHANGE) == 0)
return_value = LIVE_GAME_EVENT_BOOST_CHANGE_ANTI;
else
g_warning("xml_lg_commentary_event_name_to_int: unknown event name %s \n",
debug_print_message("xml_lg_commentary_event_name_to_int: unknown event name %s \n",
event_string);
return return_value;
@ -205,7 +205,7 @@ xml_lg_commentary_read_start_element (GMarkupParseContext *context,
}
else if(strcmp(element_name, TAG_LG_COMMENTARY) != 0)
g_warning("xml_lg_commentary_read_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_lg_commentary_read_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -230,7 +230,7 @@ xml_lg_commentary_read_end_element (GMarkupParseContext *context,
strcmp(element_name, TAG_EVENT_COMMENTARY) == 0)
state = STATE_EVENT;
else if(strcmp(element_name, TAG_LG_COMMENTARY) != 0)
g_warning("xml_lg_commentary_read_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_lg_commentary_read_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -300,7 +300,7 @@ xml_lg_commentary_read(const gchar *commentary_file)
if(!g_file_get_contents(commentary_file, &file_contents, &length, &error))
{
g_warning("xml_lg_commentary_read: error reading file %s\n", commentary_file);
debug_print_message("xml_lg_commentary_read: error reading file %s\n", commentary_file);
if(g_str_has_suffix(commentary_file, "lg_commentary_en.xml"))
misc_print_error(&error, TRUE);
else
@ -321,7 +321,7 @@ xml_lg_commentary_read(const gchar *commentary_file)
}
else
{
g_warning("xml_lg_commentary_read: error parsing file %s\n", commentary_file);
debug_print_message("xml_lg_commentary_read: error parsing file %s\n", commentary_file);
if(g_str_has_suffix(commentary_file, "lg_commentary_en.xml"))
misc_print_error(&error, TRUE);
else

View File

@ -124,7 +124,7 @@ xml_loadsave_cup_start_element (GMarkupParseContext *context,
new_round = cup_round_new();
if(!valid_tag)
g_warning("xml_loadsave_cup_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_cup_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -203,7 +203,7 @@ xml_loadsave_cup_end_element (GMarkupParseContext *context,
tag == TAG_CUP_ROUND_TWO_MATCH_WEEK)
state = TAG_CUP_ROUND;
else if(tag != TAG_CUP)
g_warning("xml_loadsave_cup_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_cup_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -370,7 +370,7 @@ xml_loadsave_cup_read(const gchar *filename, Cup *cup)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_cup_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_cup_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -385,7 +385,7 @@ xml_loadsave_cup_read(const gchar *filename, Cup *cup)
}
else
{
g_warning("xml_loadsave_cup_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_cup_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}

View File

@ -85,7 +85,7 @@ xml_loadsave_fixtures_start_element (GMarkupParseContext *context,
residx1 = residx2 = teamidx = nameidx = 0;
if(!valid_tag)
g_warning("xml_loadsave_fixtures_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_fixtures_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -130,7 +130,7 @@ xml_loadsave_fixtures_end_element (GMarkupParseContext *context,
teamidx++;
}
else if(tag != TAG_FIXTURES)
g_warning("xml_loadsave_fixtures_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_fixtures_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -199,7 +199,7 @@ xml_loadsave_fixtures_read(const gchar *filename, GArray *fixtures)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_fixtures_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_fixtures_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -213,7 +213,7 @@ xml_loadsave_fixtures_read(const gchar *filename, GArray *fixtures)
}
else
{
g_warning("xml_loadsave_fixtures_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_fixtures_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}
}

View File

@ -79,7 +79,7 @@ xml_loadsave_jobs_start_element (GMarkupParseContext *context,
new_job.league_name = NULL;
if(!valid_tag)
g_warning("xml_loadsave_jobs_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_jobs_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -111,7 +111,7 @@ xml_loadsave_jobs_end_element (GMarkupParseContext *context,
tag == TAG_JOB_TEAM_ID)
state = TAG_JOB;
else if(tag != TAG_JOBS)
g_warning("xml_loadsave_jobs_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_jobs_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -184,7 +184,7 @@ xml_loadsave_jobs_read(const gchar *dirname, const gchar *basename)
if(!g_file_get_contents(file, &file_contents, &length, &error))
{
g_warning("xml_loadsave_jobs_read: error reading file %s\n", file);
debug_print_message("xml_loadsave_jobs_read: error reading file %s\n", file);
misc_print_error(&error, TRUE);
}
@ -196,7 +196,7 @@ xml_loadsave_jobs_read(const gchar *dirname, const gchar *basename)
}
else
{
g_warning("xml_loadsave_jobs_read: error parsing file %s\n", file);
debug_print_message("xml_loadsave_jobs_read: error parsing file %s\n", file);
misc_print_error(&error, TRUE);
}
}

View File

@ -125,7 +125,7 @@ xml_loadsave_league_start_element (GMarkupParseContext *context,
g_print("xml_loadsave_league_start_element: state %d\n", state);
if(!valid_tag)
g_warning("xml_loadsave_league_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_league_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -195,7 +195,7 @@ xml_loadsave_league_end_element (GMarkupParseContext *context,
promrankidx++;
}
else if(tag != TAG_LEAGUE)
g_warning("xml_league_read_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_league_read_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -324,7 +324,7 @@ xml_loadsave_league_read(const gchar *filename, const gchar *team_file, League *
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_league_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_league_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -341,7 +341,7 @@ xml_loadsave_league_read(const gchar *filename, const gchar *team_file, League *
}
else
{
g_warning("xml_loadsave_league_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_league_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}

View File

@ -86,7 +86,7 @@ xml_loadsave_league_stat_start_element (GMarkupParseContext *context,
in_state = tag;
if(!valid_tag)
g_warning(
debug_print_message(
"xml_loadsave_league_stat_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -124,7 +124,7 @@ xml_loadsave_league_stat_end_element (GMarkupParseContext *context,
stat_array = lig_stat->player_goalies;
else
{
g_warning("xml_loadsave_league_stat_end_element: unknown in_state %d \n",
debug_print_message("xml_loadsave_league_stat_end_element: unknown in_state %d \n",
in_state);
return;
}
@ -141,7 +141,7 @@ xml_loadsave_league_stat_end_element (GMarkupParseContext *context,
valueidx++;
}
else if(tag != TAG_LEAGUE_STAT)
g_warning(
debug_print_message(
"xml_loadsave_league_stat_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -204,7 +204,7 @@ xml_loadsave_league_stat_read(const gchar *filename, LeagueStat *league_stat)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_league_stat_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_league_stat_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -218,7 +218,7 @@ xml_loadsave_league_stat_read(const gchar *filename, LeagueStat *league_stat)
}
else
{
g_warning("xml_loadsave_league_stat_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_league_stat_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}
}

View File

@ -71,7 +71,7 @@ xml_loadsave_leagues_cups_start_element (GMarkupParseContext *context,
}
if(!valid_tag)
g_warning("xml_loadsave_leagues_cups_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_leagues_cups_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -91,7 +91,7 @@ xml_loadsave_leagues_cups_end_element (GMarkupParseContext *context,
tag == TAG_CUP_FILE)
state = TAG_LEAGUES_CUPS;
else if(tag != TAG_LEAGUES_CUPS)
g_warning("xml_loadsave_leagues_cups_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_leagues_cups_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -146,7 +146,7 @@ xml_loadsave_leagues_cups_read(const gchar *dirname, const gchar *prefix)
if(!g_file_get_contents(file, &file_contents, &length, &error))
{
g_warning("xml_loadsave_misc_read: error reading file %s\n", file);
debug_print_message("xml_loadsave_misc_read: error reading file %s\n", file);
misc_print_error(&error, TRUE);
}
@ -163,7 +163,7 @@ xml_loadsave_leagues_cups_read(const gchar *dirname, const gchar *prefix)
}
else
{
g_warning("xml_loadsave_misc_read: error parsing file %s\n", file);
debug_print_message("xml_loadsave_misc_read: error parsing file %s\n", file);
misc_print_error(&error, TRUE);
}

View File

@ -104,7 +104,7 @@ xml_loadsave_live_game_start_element (GMarkupParseContext *context,
statplidx2 = 0;
if(!valid_tag)
g_warning("xml_loadsave_live_game_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_live_game_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -174,7 +174,7 @@ xml_loadsave_live_game_end_element (GMarkupParseContext *context,
else if(tag == TAG_LIVE_GAME_STAT_PLAYER_ELEMENT)
state = TAG_LIVE_GAME_STAT_PLAYER;
else if(tag != TAG_LIVE_GAME)
g_warning("xml_loadsave_live_game_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_live_game_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -259,7 +259,7 @@ xml_loadsave_live_game_read(const gchar *filename, LiveGame *live_game)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_live_game_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_live_game_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -275,7 +275,7 @@ xml_loadsave_live_game_read(const gchar *filename, LiveGame *live_game)
}
else
{
g_warning("xml_loadsave_live_game_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_live_game_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}
}
@ -299,7 +299,7 @@ xml_loadsave_live_game_write(const gchar *filename, const LiveGame *live_game)
xml_write_int(fil, live_game->fix->id, TAG_LIVE_GAME_FIX_ID, I0);
if(live_game->fix->id > 10000000)
g_warning(
debug_print_message(
"xml_loadsave_live_game_write: suspicious fix id: %d.",
live_game->fix->id);
}

View File

@ -97,7 +97,7 @@ xml_loadsave_misc_start_element (GMarkupParseContext *context,
}
if(!valid_tag)
g_warning("xml_loadsave_misc_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_misc_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -142,7 +142,7 @@ xml_loadsave_misc_end_element (GMarkupParseContext *context,
oddidx++;
}
else if(tag != TAG_MISC)
g_warning("xml_loadsave_misc_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_misc_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -218,7 +218,7 @@ xml_loadsave_misc_read(const gchar *dirname, const gchar *basename)
if(!g_file_get_contents(file, &file_contents, &length, &error))
{
g_warning("xml_loadsave_misc_read: error reading file %s\n", file);
debug_print_message("xml_loadsave_misc_read: error reading file %s\n", file);
misc_print_error(&error, TRUE);
}
@ -235,7 +235,7 @@ xml_loadsave_misc_read(const gchar *dirname, const gchar *basename)
}
else
{
g_warning("xml_loadsave_misc_read: error parsing file %s\n", file);
debug_print_message("xml_loadsave_misc_read: error parsing file %s\n", file);
misc_print_error(&error, TRUE);
}
}

View File

@ -76,7 +76,7 @@ xml_loadsave_newspaper_start_element (GMarkupParseContext *context,
}
if(!valid_tag)
g_warning("xml_loadsave_newspaper_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_newspaper_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -114,7 +114,7 @@ xml_loadsave_newspaper_end_element (GMarkupParseContext *context,
state = TAG_NEWS_PAPER_ARTICLE;
}
else if(tag != TAG_NEWS_PAPER)
g_warning("xml_loadsave_newspaper_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_newspaper_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -186,7 +186,7 @@ xml_loadsave_newspaper_read(const gchar *dirname, const gchar *prefix)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_news_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_news_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -198,7 +198,7 @@ xml_loadsave_newspaper_read(const gchar *dirname, const gchar *prefix)
}
else
{
g_warning("xml_loadsave_news_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_news_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}
}

View File

@ -98,7 +98,7 @@ xml_loadsave_players_start_element(gint tag, Team *tm)
}
if(!valid_tag)
g_warning("xml_loadsave_players_start_element: unknown tag. I'm in state %d\n",
debug_print_message("xml_loadsave_players_start_element: unknown tag. I'm in state %d\n",
state);
}
@ -158,7 +158,7 @@ xml_loadsave_players_end_element(gint tag, GArray *players)
tag == TAG_PLAYER_CARD_RED)
state = TAG_PLAYER_CARD;
else if(tag != TAG_PLAYERS)
g_warning("xml_loadsave_players_end_element: unknown tag. I'm in state %d\n",
debug_print_message("xml_loadsave_players_end_element: unknown tag. I'm in state %d\n",
state);
}

View File

@ -89,7 +89,7 @@ xml_loadsave_season_stats_start_element (GMarkupParseContext *context,
new_season_stat = stat_season_stat_new(-1);
if(!valid_tag)
g_warning("xml_loadsave_season_stats_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_season_stats_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -129,7 +129,7 @@ xml_loadsave_season_stats_end_element (GMarkupParseContext *context,
tag == TAG_CHAMP_STAT_CL_NAME)
state = TAG_CHAMP_STAT;
else if(tag != TAG_SEASON_STATS)
g_warning("xml_loadsave_season_stats_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_season_stats_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -191,7 +191,7 @@ xml_loadsave_season_stats_read(const gchar *dirname, const gchar *prefix)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_season_stats_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_season_stats_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -206,7 +206,7 @@ xml_loadsave_season_stats_read(const gchar *dirname, const gchar *prefix)
}
else
{
g_warning("xml_loadsave_season_stats_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_season_stats_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}
}

View File

@ -76,7 +76,7 @@ xml_loadsave_table_start_element (GMarkupParseContext *context,
valueidx = 0;
if(!valid_tag)
g_warning("xml_loadsave_table_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_table_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -110,7 +110,7 @@ xml_loadsave_table_end_element (GMarkupParseContext *context,
valueidx++;
}
else if(tag != TAG_TABLE)
g_warning("xml_loadsave_table_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_table_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -167,7 +167,7 @@ xml_loadsave_table_read(const gchar *filename, Table *table)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_table_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_table_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -181,7 +181,7 @@ xml_loadsave_table_read(const gchar *filename, Table *table)
}
else
{
g_warning("xml_loadsave_table_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_table_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}
}

View File

@ -100,7 +100,7 @@ xml_loadsave_teams_start_element (GMarkupParseContext *context,
}
if(!valid_tag)
g_warning("xml_loadsave_teams_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_teams_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -148,7 +148,7 @@ xml_loadsave_teams_end_element (GMarkupParseContext *context,
state = TAG_TEAM;
}
else if(tag != TAG_TEAMS)
g_warning("xml_loadsave_teams_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_teams_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -232,7 +232,7 @@ xml_loadsave_teams_read(const gchar *filename, GArray *teams)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_teams_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_teams_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -246,7 +246,7 @@ xml_loadsave_teams_read(const gchar *filename, GArray *teams)
}
else
{
g_warning("xml_loadsave_teams_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_teams_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}

View File

@ -87,7 +87,7 @@ xml_loadsave_transfers_start_element (GMarkupParseContext *context,
}
if(!valid_tag)
g_warning("xml_loadsave_transfers_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_transfers_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -129,7 +129,7 @@ xml_loadsave_transfers_end_element (GMarkupParseContext *context,
tag == TAG_TRANSFER_OFFER_TEAM_ID)
state = TAG_TRANSFER_OFFER;
else if(tag != TAG_TRANSFERS)
g_warning("xml_loadsave_transfers_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_transfers_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -192,7 +192,7 @@ xml_loadsave_transfers_read(const gchar *filename)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_transfers_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_transfers_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -204,7 +204,7 @@ xml_loadsave_transfers_read(const gchar *filename)
}
else
{
g_warning("xml_loadsave_transfers_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_transfers_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}
}

View File

@ -150,7 +150,7 @@ xml_loadsave_users_start_element (GMarkupParseContext *context,
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",
debug_print_message("xml_loadsave_users_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -249,7 +249,7 @@ xml_loadsave_users_end_element (GMarkupParseContext *context,
state = TAG_USER;
}
else if(tag != TAG_USERS)
g_warning("xml_loadsave_users_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_users_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -374,7 +374,7 @@ xml_loadsave_users_read(const gchar *dirname, const gchar *basename)
if(!g_file_get_contents(file, &file_contents, &length, &error))
{
g_warning("xml_loadsave_users_read: error reading file %s\n", file);
debug_print_message("xml_loadsave_users_read: error reading file %s\n", file);
misc_print_error(&error, TRUE);
}
@ -386,7 +386,7 @@ xml_loadsave_users_read(const gchar *dirname, const gchar *basename)
}
else
{
g_warning("xml_loadsave_users_read: error parsing file %s\n", file);
debug_print_message("xml_loadsave_users_read: error parsing file %s\n", file);
misc_print_error(&error, TRUE);
}
}

View File

@ -79,7 +79,7 @@ xml_mmatches_start_element (GMarkupParseContext *context,
new_match.country_name = NULL;
if(!valid_tag)
g_warning("xml_loadsave_mmatches_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_mmatches_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -107,7 +107,7 @@ xml_mmatches_end_element (GMarkupParseContext *context,
tag == TAG_MMATCHES_LG_FILE)
state = TAG_MMATCH;
else if(tag != TAG_MMATCHES)
g_warning("xml_loadsave_mmatches_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_loadsave_mmatches_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -168,7 +168,7 @@ xml_mmatches_read(const gchar *filename, GArray *mmatches)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_loadsave_mmatches_read: error reading file %s\n", filename);
debug_print_message("xml_loadsave_mmatches_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
}
@ -183,7 +183,7 @@ xml_mmatches_read(const gchar *filename, GArray *mmatches)
}
else
{
g_warning("xml_loadsave_mmatches_read: error parsing file %s\n", filename);
debug_print_message("xml_loadsave_mmatches_read: error parsing file %s\n", filename);
misc_print_error(&error, TRUE);
}
}

View File

@ -67,7 +67,7 @@ xml_name_read_start_element (GMarkupParseContext *context,
else if(strcmp(element_name, TAG_LAST_NAME) == 0)
state = STATE_LAST_NAME;
else
g_warning("xml_name_read_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_name_read_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -86,7 +86,7 @@ xml_name_read_end_element (GMarkupParseContext *context,
strcmp(element_name, TAG_LAST_NAME) == 0)
state = STATE_NAMES;
else if(strcmp(element_name, TAG_NAMES) != 0)
g_warning("xml_name_end_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_name_end_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -142,7 +142,7 @@ xml_name_read(const gchar *sid, NameList *namelist)
if(!g_file_get_contents(file_name, &file_contents, &length, &error))
{
g_warning("xml_name_read: error reading file %s\n", file_name);
debug_print_message("xml_name_read: error reading file %s\n", file_name);
misc_print_error(&error, TRUE);
return;
}

View File

@ -87,7 +87,7 @@ xml_news_article_type_to_int(const gchar *type_string)
else if(strcmp(type_string, ARTICLE_TYPE_NAME_RELEGATION) == 0)
return_value = NEWS_ARTICLE_TYPE_RELEGATION;
else
g_warning("xml_news_type_to_int: unknown type name %s \n",
debug_print_message("xml_news_type_to_int: unknown type name %s \n",
type_string);
return return_value;
@ -164,7 +164,7 @@ xml_news_read_start_element (GMarkupParseContext *context,
}
}
else
g_warning("xml_news_read_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_news_read_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -195,7 +195,7 @@ xml_news_read_end_element (GMarkupParseContext *context,
strcmp(element_name, TAG_ARTICLE_SUBTITLE) == 0)
state = STATE_ARTICLE;
else if(strcmp(element_name, TAG_NEWS) != 0)
g_warning("xml_news_read_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_news_read_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -270,7 +270,7 @@ xml_news_read(const gchar *news_file)
if(!g_file_get_contents(news_file, &file_contents, &length, &error))
{
g_warning("xml_news_read: error reading file %s\n", news_file);
debug_print_message("xml_news_read: error reading file %s\n", news_file);
if(g_str_has_suffix(news_file, "news_en.xml"))
misc_print_error(&error, TRUE);
else
@ -291,7 +291,7 @@ xml_news_read(const gchar *news_file)
}
else
{
g_warning("xml_news_read: error parsing file %s\n", news_file);
debug_print_message("xml_news_read: error parsing file %s\n", news_file);
if(g_str_has_suffix(news_file, "news_en.xml"))
misc_print_error(&error, TRUE);
else

View File

@ -138,7 +138,7 @@ xml_strategy_read_start_element (GMarkupParseContext *context,
new_prematch.condition =
g_strdup(attribute_values[atidx]);
else
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
debug_print_message("xml_strategy_read_start_element: unknown attribute %s\n",
attribute_names[atidx]);
atidx++;
@ -158,7 +158,7 @@ xml_strategy_read_start_element (GMarkupParseContext *context,
curprematch.min_fitness =
g_ascii_strtod(attribute_values[atidx], NULL) / 100;
else
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
debug_print_message("xml_strategy_read_start_element: unknown attribute %s\n",
attribute_names[atidx]);
atidx++;
@ -188,7 +188,7 @@ xml_strategy_read_start_element (GMarkupParseContext *context,
new_match_action.condition =
g_strdup(attribute_values[atidx]);
else
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
debug_print_message("xml_strategy_read_start_element: unknown attribute %s\n",
attribute_names[atidx]);
atidx++;
@ -211,7 +211,7 @@ xml_strategy_read_start_element (GMarkupParseContext *context,
curmatchaction.sub_condition =
g_strdup(attribute_values[atidx]);
else
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
debug_print_message("xml_strategy_read_start_element: unknown attribute %s\n",
attribute_names[atidx]);
atidx++;
@ -234,11 +234,11 @@ xml_strategy_read_start_element (GMarkupParseContext *context,
else if(strcmp(attribute_values[atidx], LINEUP_NAME_UNFITTEST) == 0)
curmatchaction.sub_in_prop = STRAT_LINEUP_UNFITTEST;
else
g_warning("xml_strategy_read_start_element: unknown property value %s\n",
debug_print_message("xml_strategy_read_start_element: unknown property value %s\n",
attribute_values[atidx]);
}
else
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
debug_print_message("xml_strategy_read_start_element: unknown attribute %s\n",
attribute_names[atidx]);
atidx++;
@ -261,18 +261,18 @@ xml_strategy_read_start_element (GMarkupParseContext *context,
else if(strcmp(attribute_values[atidx], LINEUP_NAME_UNFITTEST) == 0)
curmatchaction.sub_out_prop = STRAT_LINEUP_UNFITTEST;
else
g_warning("xml_strategy_read_start_element: unknown property value %s\n",
debug_print_message("xml_strategy_read_start_element: unknown property value %s\n",
attribute_values[atidx]);
}
else
g_warning("xml_strategy_read_start_element: unknown attribute %s\n",
debug_print_message("xml_strategy_read_start_element: unknown attribute %s\n",
attribute_names[atidx]);
atidx++;
}
}
else
g_warning("xml_strategy_read_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_strategy_read_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -310,7 +310,7 @@ xml_strategy_read_end_element (GMarkupParseContext *context,
strcmp(element_name, TAG_STRATEGY_MATCH_ACTION_SUB_OUT_POS) == 0)
state = STATE_STRATEGY_MATCH_ACTION_SUB;
else if(strcmp(element_name, TAG_STRATEGY) != 0)
g_warning("xml_strategy_read_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_strategy_read_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -363,7 +363,7 @@ xml_strategy_read_text (GMarkupParseContext *context,
else if(strcmp(buf, LINEUP_NAME_FITTEST) == 0)
curprematch.lineup = STRAT_LINEUP_FITTEST;
else
g_warning(
debug_print_message(
"xml_strategy_read_text: unknown lineup type %s\n", buf);
}
else if(state == STATE_STRATEGY_PREMATCH_BOOST)
@ -375,7 +375,7 @@ xml_strategy_read_text (GMarkupParseContext *context,
else if(strcmp(buf, BOOST_NAME_ANTI) == 0)
curprematch.boost = -1;
else
g_warning(
debug_print_message(
"xml_strategy_read_text: unknown boost type %s\n", buf);
}
else if(state == STATE_STRATEGY_PREMATCH_STYLE)
@ -391,7 +391,7 @@ xml_strategy_read_text (GMarkupParseContext *context,
else if(strcmp(buf, STYLE_NAME_ALL_OUT_ATTACK) == 0)
curprematch.style = 2;
else
g_warning(
debug_print_message(
"xml_strategy_read_text: unknown style type %s\n", buf);
}
else if(state == STATE_STRATEGY_MATCH_ACTION_STYLE)
@ -407,7 +407,7 @@ xml_strategy_read_text (GMarkupParseContext *context,
else if(strcmp(buf, STYLE_NAME_ALL_OUT_ATTACK) == 0)
curmatchaction.style = 2;
else
g_warning(
debug_print_message(
"xml_strategy_read_text: unknown style type %s\n", buf);
}
else if(state == STATE_STRATEGY_MATCH_ACTION_BOOST)
@ -419,7 +419,7 @@ xml_strategy_read_text (GMarkupParseContext *context,
else if(strcmp(buf, BOOST_NAME_ANTI) == 0)
curmatchaction.boost = -1;
else
g_warning(
debug_print_message(
"xml_strategy_read_text: unknown boost type %s\n", buf);
}
else if(state == STATE_STRATEGY_MATCH_ACTION_SUB_IN_POS ||
@ -459,7 +459,7 @@ xml_strategy_read_text (GMarkupParseContext *context,
POS_NAME_FORWARD) == 0)
*pos = (*pos * 10) + 3;
else
g_warning(
debug_print_message(
"xml_strategy_read_text: unknown position %s\n",
(gchar*)g_ptr_array_index(positions, i));
@ -494,7 +494,7 @@ xml_strategy_read(const gchar *filename)
if(!g_file_get_contents(filename, &file_contents, &length, &error))
{
g_warning("xml_strategy_read: error reading file %s\n", filename);
debug_print_message("xml_strategy_read: error reading file %s\n", filename);
misc_print_error(&error, TRUE);
return;
}

View File

@ -120,7 +120,7 @@ xml_team_read_start_element (GMarkupParseContext *context,
else if(strcmp(element_name, TAG_PLAYER_POSITION) == 0)
state = STATE_PLAYER_POSITION;
else
g_warning("xml_team_read_start_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_team_read_start_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -169,7 +169,7 @@ xml_team_read_end_element (GMarkupParseContext *context,
strcmp(element_name, TAG_PLAYER_POSITION) == 0)
state = STATE_PLAYER;
else if(strcmp(element_name, TAG_TEAM) != 0)
g_warning("xml_team_read_end_element: unknown tag: %s; I'm in state %d\n",
debug_print_message("xml_team_read_end_element: unknown tag: %s; I'm in state %d\n",
element_name, state);
}
@ -256,7 +256,7 @@ xml_team_read(Team *tm, const gchar *def_file)
if(!g_file_get_contents(def_file, &file_contents, &length, &error))
{
g_warning("xml_team_read: error reading file %s\n", def_file);
debug_print_message("xml_team_read: error reading file %s\n", def_file);
misc_print_error(&error, FALSE);
return;
}

View File

@ -4,14 +4,6 @@
# can be found in 'bygfoot_app'.
#########
# debug level
int_debug 0
# write debug messages to console debug_writer=1
# write debug messages to file debug_writer=2 (not implemented)
# write debug messages to file console+file debug_writer=2 (not implemented)
int_debug_writer 0
#### float constants get divided by 100000 and loaded as floats
#### so we write 50000 if we'd like to have 0.5