]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_save.c
Fix a bug in Cvar_RegisterVirtual which was corrupting memory when adding a second...
[xonotic/darkplaces.git] / sv_save.c
index 799a0d8a08b2aa450e729dd8fa081e89dff3c1fb..b90f748775029e8b2ff0b9640fdfef52bd768961 100644 (file)
--- a/sv_save.c
+++ b/sv_save.c
@@ -270,16 +270,11 @@ void SV_Loadgame_f(cmd_state_t *cmd)
 
        Con_Printf("Loading game from %s...\n", filename);
 
-       // stop playing demos
-       if (cls.demoplayback)
-               CL_Disconnect ();
-
-#ifdef CONFIG_MENU
-       // remove menu
-       if (key_dest == key_menu || key_dest == key_menu_grabbed)
-               MR_ToggleMenu(0);
-#endif
-       key_dest = key_game;
+       if(host.hook.Disconnect)
+               host.hook.Disconnect(false, NULL);
+
+       if(host.hook.ToggleMenu)
+               host.hook.ToggleMenu();
 
        cls.demonum = -1;               // stop demo loop in case this fails
 
@@ -434,7 +429,7 @@ void SV_Loadgame_f(cmd_state_t *cmd)
                                PRVM_MEM_IncreaseEdicts(prog);
                        ent = PRVM_EDICT_NUM(entnum);
                        memset(ent->fields.fp, 0, prog->entityfields * sizeof(prvm_vec_t));
-                       ent->priv.server->free = false;
+                       ent->free = false;
 
                        if(developer_entityparsing.integer)
                                Con_Printf("SV_Loadgame_f: loading edict %d\n", entnum);
@@ -442,7 +437,7 @@ void SV_Loadgame_f(cmd_state_t *cmd)
                        PRVM_ED_ParseEdict (prog, start, ent);
 
                        // link it into the bsp tree
-                       if (!ent->priv.server->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
+                       if (!ent->free && !VectorCompare(PRVM_serveredictvector(ent, absmin), PRVM_serveredictvector(ent, absmax)))
                                SV_LinkEdict(ent);
                }