From 274d44ee183c3c43b6aa75b02dfd4e20bb6e7a07 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 25 Sep 2018 18:07:02 +0200 Subject: [PATCH] Move the gamedb to a separate file. --- src/CMakeLists.txt | 1 + src/eressea.c | 12 ------------ src/eressea.h | 1 - src/gamedb.c | 20 ++++++++++++++++++++ src/gamedb.h | 3 +++ 5 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 src/gamedb.c create mode 100644 src/gamedb.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9502cc4bf..7b50907f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -97,6 +97,7 @@ set (ERESSEA_SRC economy.c eressea.c exparse.c + gamedb.c give.c guard.c items.c diff --git a/src/eressea.c b/src/eressea.c index 67ab26af5..0bf1454ee 100644 --- a/src/eressea.c +++ b/src/eressea.c @@ -39,18 +39,6 @@ /* manually free() everything at exit? */ #undef CLEANUP_CODE -void game_write_dbstate(void) -{ - faction *f; - - for (f = factions; f; f = f->next) { - int uid = dblib_save_faction(f, turn); - if (uid > 0) { - f->uid = uid; - } - } -} - void game_done(void) { log_dead_factions(); diff --git a/src/eressea.h b/src/eressea.h index cfc1b12ef..f3ea4d4a5 100755 --- a/src/eressea.h +++ b/src/eressea.h @@ -6,7 +6,6 @@ extern "C" { void game_init(void); void game_done(void); - void game_write_dbstate(void); #ifdef __cplusplus } diff --git a/src/gamedb.c b/src/gamedb.c new file mode 100644 index 000000000..cf9a922bc --- /dev/null +++ b/src/gamedb.c @@ -0,0 +1,20 @@ +#ifdef _MSC_VER +#include +#endif + +#include "gamedb.h" + +#include "kernel/database.h" +#include "kernel/faction.h" + +void gamedb_update(void) +{ + faction *f; + + for (f = factions; f; f = f->next) { + int uid = dblib_save_faction(f, turn); + if (uid > 0) { + f->uid = uid; + } + } +} diff --git a/src/gamedb.h b/src/gamedb.h new file mode 100644 index 000000000..ea4614298 --- /dev/null +++ b/src/gamedb.h @@ -0,0 +1,3 @@ +#pragma once + +void gamedb_update(void);