X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=sv_save.c;h=799a0d8a08b2aa450e729dd8fa081e89dff3c1fb;hb=8507719df58bf767983c92ecfa32a70090bf501e;hp=a08e33a58b37cd965bf5ce62867ddd4f205d90bf;hpb=f1572007b4abc4cba2a834095c84e731562926b8;p=xonotic%2Fdarkplaces.git diff --git a/sv_save.c b/sv_save.c index a08e33a5..799a0d8a 100644 --- a/sv_save.c +++ b/sv_save.c @@ -176,6 +176,30 @@ void SV_Savegame_to(prvm_prog_t *prog, const char *name) Con_Print("done.\n"); } +static qbool SV_CanSave(void) +{ + prvm_prog_t *prog = SVVM_prog; + if(SV_IsLocalServer() == 1) + { + // singleplayer checks + // FIXME: This only checks if the first player is dead? + if ((svs.clients[0].active && PRVM_serveredictfloat(svs.clients[0].edict, deadflag))) + { + Con_Print("Can't savegame with a dead player\n"); + return false; + } + + if(host.hook.CL_Intermission && host.hook.CL_Intermission()) + { + Con_Print("Can't save in intermission.\n"); + return false; + } + } + else + Con_Print(CON_WARN "Warning: saving a multiplayer game may have strange results when restored (to properly resume, all players must join in the same player slots and then the game can be reloaded).\n"); + return true; +} + /* =============== SV_Savegame_f @@ -192,11 +216,8 @@ void SV_Savegame_f(cmd_state_t *cmd) return; } - if(host.hook.SV_CanSave) - { - if(!host.hook.SV_CanSave()) - return; - } + if(!SV_CanSave()) + return; if (Cmd_Argc(cmd) != 2) {