bygfoot/src/debug.c

96 lines
2.7 KiB
C
Raw Normal View History

2005-08-14 21:03:11 +02:00
#include "callbacks.h"
2005-05-13 20:20:47 +02:00
#include "debug.h"
#include "game_gui.h"
#include "option.h"
2005-06-20 16:24:54 +02:00
#include "support.h"
2005-05-13 20:20:47 +02:00
#include "user.h"
#include "variables.h"
/** Take some debug action depending on the text and the value. */
void
debug_action(const gchar *text, gint value)
{
if(g_str_has_prefix(text, "deb"))
{
opt_set_int("int_opt_debug", value);
2005-07-08 11:26:00 +02:00
game_gui_print_message("Debug value set to %d.", value);
2005-05-13 20:20:47 +02:00
}
else if(g_str_has_prefix(text, "cap"))
{
current_user.tm->stadium.capacity += value;
2005-07-08 11:26:00 +02:00
game_gui_print_message("Stadium capacity changed by %d. New: %d.", value,
2005-06-20 14:46:57 +02:00
current_user.tm->stadium.capacity);
2005-05-13 20:20:47 +02:00
}
else if(g_str_has_prefix(text, "saf"))
{
current_user.tm->stadium.safety += ((gfloat)value / 100);
current_user.tm->stadium.safety =
CLAMP(current_user.tm->stadium.safety, 0, 1);
2005-07-08 11:26:00 +02:00
game_gui_print_message("Stadium safety changed by %d. New: %.2f", value,
2005-06-20 14:46:57 +02:00
current_user.tm->stadium.safety);
2005-05-13 20:20:47 +02:00
}
else if(g_str_has_prefix(text, "mon"))
{
current_user.money += value;
2005-07-08 11:26:00 +02:00
game_gui_print_message("Money changed by %d. New: %d.", value,
2005-06-20 14:46:57 +02:00
current_user.money);
2005-05-13 20:20:47 +02:00
}
2005-05-28 12:41:53 +02:00
else if(g_str_has_prefix(text, "suc"))
{
current_user.counters[COUNT_USER_SUCCESS] += value;
2005-07-08 11:26:00 +02:00
game_gui_print_message("Success counter changed by %d. New: %d.", value,
2005-06-20 14:46:57 +02:00
current_user.counters[COUNT_USER_SUCCESS]);
2005-05-28 12:41:53 +02:00
}
2005-07-15 14:42:57 +02:00
else if(g_str_has_prefix(text, "scout"))
{
current_user.scout = value;
game_gui_print_message("Scout changed to %d.", value);
}
else if(g_str_has_prefix(text, "phys"))
{
current_user.physio = value;
game_gui_print_message("Physio changed to %d.", value);
}
else if(g_str_has_prefix(text, "yc"))
{
current_user.youth_academy.coach = value;
game_gui_print_message("Youth coach changed to %d.", value);
}
else if(g_str_has_prefix(text, "pospref"))
{
current_user.youth_academy.pos_pref = value;
game_gui_print_message("Recruiting pref changed to %d.", value);
}
2005-08-14 21:03:11 +02:00
else if(g_str_has_prefix(text, "goto"))
{
while(week < value)
on_button_new_week_clicked(NULL, NULL);
}
2005-05-28 12:41:53 +02:00
else if(g_str_has_prefix(text, "help"))
{
printf("Debug options:\n"
"deb \t set debug 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"
2005-07-15 14:42:57 +02:00
"scout \t change scout\n"
"physio \t change physio\n"
"youth coach \t change youth coach\n"
"pospref \t change recruiting pref\n"
2005-08-14 21:03:11 +02:00
"goto \t Press 'new week' automatically until\n"
" \t the appropriate week is reached\n"
2005-05-28 12:41:53 +02:00
"help \t display this help\n");
}
2005-05-13 20:20:47 +02:00
2005-06-20 16:24:54 +02:00
setsav0;
2005-05-13 20:20:47 +02:00
}
gboolean
debug_reset_counter(gpointer data)
{
counters[COUNT_SHOW_DEBUG] = 0;
return FALSE;
}