diff --git a/configure.ac b/configure.ac index 7901f47..a2ff5f2 100644 --- a/configure.ac +++ b/configure.ac @@ -24,6 +24,10 @@ if test "$enable_debug" = "yes"; then AC_DEFINE([DEBUG], [1], [Define to compile with debugging support]) fi +AC_DEFINE([WMUD_TICK_LENGTH], [500], [Length of a game tick, in milliseconds]) +AC_DEFINE([WMUD_HEARTBEAT_LENGTH], [30], [Length of a heartbeat, in ticks]) +AC_DEFINE([WMUD_MAINTENANCE_TIME], [600], [Time between maintenance runs, in seconds]) + m4_ifdef([GTK_DOC_CHECK], [ GTK_DOC_CHECK([1.14], [--flavour no-tmpl]) ],[ diff --git a/wmud/game.c b/wmud/game.c index 0596724..02b7024 100644 --- a/wmud/game.c +++ b/wmud/game.c @@ -17,6 +17,10 @@ * along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include "main.h" @@ -71,7 +75,7 @@ rl_sec_elapsed(gpointer user_data) elapsed_cycle++; } - if (elapsed_ticks % 30 == 0) { + if (elapsed_ticks % WMUD_HEARTBEAT_LENGTH == 0) { g_log(G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, "Heartbeat"); } @@ -108,7 +112,7 @@ wmud_game_init(GThread **game_thread, GMainContext **game_context) /* Create the timeout source which keeps track of elapsed real-world * time */ - timeout_source = g_timeout_source_new(1000); + timeout_source = g_timeout_source_new(WMUD_TICK_LENGTH); g_source_set_callback(timeout_source, rl_sec_elapsed, NULL, NULL); g_source_attach(timeout_source, *game_context); g_source_unref(timeout_source); diff --git a/wmud/maintenance.c b/wmud/maintenance.c index 8bcfb70..efb596e 100644 --- a/wmud/maintenance.c +++ b/wmud/maintenance.c @@ -194,7 +194,7 @@ wmud_maintenance_init(void) maint_loop = g_main_loop_new(maint_context, FALSE); /* Create the timeout source which will do the maintenance tasks */ - timeout_source = g_timeout_source_new_seconds(600); + timeout_source = g_timeout_source_new_seconds(WMUD_MAINTENANCE_TIME); g_source_set_callback(timeout_source, wmud_maintenance, NULL, NULL); g_source_attach(timeout_source, maint_context); g_source_unref(timeout_source);