Add config.h macros for timing parameters

This commit is contained in:
Gergely Polonkai 2013-11-26 11:22:19 +01:00
parent 5871943455
commit 3629734cc3
3 changed files with 11 additions and 3 deletions

View File

@ -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])
],[

View File

@ -17,6 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <glib.h>
#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);

View File

@ -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);