server/src/gamedb.c

31 lines
574 B
C
Raw Normal View History

2018-09-25 18:07:02 +02:00
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "gamedb.h"
#include "kernel/db/driver.h"
2018-09-25 18:07:02 +02:00
#include "kernel/database.h"
#include "kernel/faction.h"
int gamedb_update(void)
2018-09-25 18:07:02 +02:00
{
faction *f;
int err;
const char *dbname;
2018-09-25 18:07:02 +02:00
dbname = config_get("game.dbname");
err = db_driver_open(DB_GAME, dbname);
if (err == 0) {
for (f = factions; f; f = f->next) {
int uid = dblib_save_faction(f, turn);
if (uid > 0) {
f->uid = uid;
}
2018-09-25 18:07:02 +02:00
}
db_driver_close(DB_GAME);
2018-09-25 18:07:02 +02:00
}
return err;
2018-09-25 18:07:02 +02:00
}