From: Rudolf Polzer Date: Tue, 1 Nov 2011 08:26:06 +0000 (+0100) Subject: add a cvar "sessionid" to make progs.db unique across multiple servers using the... X-Git-Tag: xonotic-v0.6.0~35^2~72 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1f5b5365f75a317384ad9176e9064809a1eb31e1;p=xonotic%2Fxonotic-data.pk3dir.git add a cvar "sessionid" to make progs.db unique across multiple servers using the same directory --- diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 21f21141e..3a6e123e0 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -1058,6 +1058,7 @@ float autocvar_quit_when_empty; float autocvar_r_showbboxes; float autocvar_rescan_pending; float autocvar_samelevel; +string autocvar_sessionid; #define autocvar_skill cvar("skill") float autocvar_skill_auto; #define autocvar_slowmo cvar("slowmo") diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index e139c6b97..1980047b0 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -643,7 +643,7 @@ void spawnfunc_worldspawn (void) // needs to be done so early as they would still spawn RegisterWeapons(); - ServerProgsDB = db_load("server.db"); + ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid)); TemporaryDB = db_create(); @@ -2914,7 +2914,7 @@ void RestoreGame() // some things then break, so let's work around them... // Progs DB (capture records) - ServerProgsDB = db_load("server.db"); + ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid)); // Mapinfo MapInfo_Shutdown(); @@ -2948,9 +2948,9 @@ void SV_Shutdown() if(!cheatcount_total) { if(autocvar_sv_db_saveasdump) - db_dump(ServerProgsDB, "server.db"); + db_dump(ServerProgsDB, strcat("server.db", autocvar_sessionid)); else - db_save(ServerProgsDB, "server.db"); + db_save(ServerProgsDB, strcat("server.db", autocvar_sessionid)); } if(autocvar_developer) {