diff --git a/Quake/host.c b/Quake/host.c index 7d3e16e4..8481b09c 100644 --- a/Quake/host.c +++ b/Quake/host.c @@ -549,7 +549,7 @@ void Host_ClearMemory (void) /* host_hunklevel MUST be set at this point */ Hunk_FreeToLowMark (host_hunklevel); cls.signon = 0; - if (sv.edicts) free(sv.edicts); // ericw -- sv.edicts switched to use malloc() + free(sv.edicts); // ericw -- sv.edicts switched to use malloc() memset (&sv, 0, sizeof(sv)); memset (&cl, 0, sizeof(cl)); } diff --git a/Quake/host_cmd.c b/Quake/host_cmd.c index acd79604..fa367738 100644 --- a/Quake/host_cmd.c +++ b/Quake/host_cmd.c @@ -1226,16 +1226,17 @@ void Host_Loadgame_f (void) else { // parse an edict ent = EDICT_NUM(entnum); + #if 0 /* EDICT_NUM() checks this already */ + if (entnum >= sv.max_edicts) + Host_Error ("Loadgame: no free edicts (max_edicts is %i)", sv.max_edicts); + #endif if (entnum < sv.num_edicts) { + ent->free = false; memset (&ent->v, 0, progs->entityfields * 4); } - else if (entnum < sv.max_edicts) { + else { memset (ent, 0, pr_edict_size); } - else { - Host_Error ("Loadgame: no free edicts (max_edicts is %i)", sv.max_edicts); - } - ent->free = false; ED_ParseEdict (start, ent); // link it into the bsp tree diff --git a/Quake/sv_main.c b/Quake/sv_main.c index 431b12ca..401b43ad 100644 --- a/Quake/sv_main.c +++ b/Quake/sv_main.c @@ -87,6 +87,8 @@ void SV_Init (void) extern cvar_t sv_aim; extern cvar_t sv_altnoclip; //johnfitz + sv.edicts = NULL; // ericw -- sv.edicts switched to use malloc() + Cvar_RegisterVariable (&sv_maxvelocity); Cvar_RegisterVariable (&sv_gravity); Cvar_RegisterVariable (&sv_friction);