]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
Add support for the .dpk package format used by Unvanquished
[xonotic/darkplaces.git] / sv_main.c
index 090e1f4880c272c63ae94767447d3e4ed4a1b280..7754a35272c742cd698d35be3efef2f3374e552b 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -434,30 +434,6 @@ static void SV_AreaStats_f(cmd_state_t *cmd)
        World_PrintAreaStats(&sv.world, "server");
 }
 
-static qbool SV_CanSave(void)
-{
-       prvm_prog_t *prog = SVVM_prog;
-       if(SV_IsLocalServer() == 1)
-       {
-               // singleplayer checks
-               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;
-       
-}
-
 static void SV_ServerOptions (void)
 {
        int i;
@@ -710,7 +686,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_writepicture_quality);
 
        SV_InitOperatorCommands();
-       host.hook.SV_CanSave = SV_CanSave;
+       host.hook.SV_Shutdown = SV_Shutdown;
 
        sv_mempool = Mem_AllocPool("server", 0, NULL);
 
@@ -1298,7 +1274,7 @@ static void SV_Download_f(cmd_state_t *cmd)
 
        if (!sv_allowdownloads_archive.integer)
        {
-               if (!strcasecmp(extension, "pak") || !strcasecmp(extension, "pk3"))
+               if (!strcasecmp(extension, "pak") || !strcasecmp(extension, "pk3") || !strcasecmp(extension, "dpk"))
                {
                        SV_ClientPrintf("Download rejected: file \"%s\" is an archive\nYou must separately download or purchase the data archives for this game/mod to get this file\n", host_client->download_name);
                        SV_ClientCommands("\nstopdownload\n");
@@ -2083,10 +2059,12 @@ void SV_Shutdown(void)
        prvm_prog_t *prog = SVVM_prog;
        int i;
 
-       Con_DPrintf("SV_Shutdown\n");
+       SV_LockThreadMutex();
 
        if (!sv.active)
-               return;
+               goto end;
+
+       Con_DPrintf("SV_Shutdown\n");
 
        NetConn_Heartbeat(2);
        NetConn_Heartbeat(2);
@@ -2115,8 +2093,8 @@ void SV_Shutdown(void)
 //
        memset(&sv, 0, sizeof(sv));
        memset(svs.clients, 0, svs.maxclients*sizeof(client_t));
-
-       cl.islocalgame = false;
+end:
+       SV_UnlockThreadMutex();
 }
 
 /////////////////////////////////////////////////////