Move the gamedb to a separate file.

This commit is contained in:
Enno Rehling 2018-09-25 18:07:02 +02:00
parent 8cccef41ad
commit 274d44ee18
5 changed files with 24 additions and 13 deletions

View File

@ -97,6 +97,7 @@ set (ERESSEA_SRC
economy.c
eressea.c
exparse.c
gamedb.c
give.c
guard.c
items.c

View File

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

View File

@ -6,7 +6,6 @@ extern "C" {
void game_init(void);
void game_done(void);
void game_write_dbstate(void);
#ifdef __cplusplus
}

20
src/gamedb.c Normal file
View File

@ -0,0 +1,20 @@
#ifdef _MSC_VER
#include <platform.h>
#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;
}
}
}

3
src/gamedb.h Normal file
View File

@ -0,0 +1,3 @@
#pragma once
void gamedb_update(void);