mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-03 06:20:57 +00:00
Host_Loadgame_f(): no need for entnum >= sv.max_edicts check
because EDICT_NUM() does it already. also move ent->free=false statement to partial zero-fill case. Host_ClearMemory(): remove check before free(sv.edicts) SV_Init(): initialize sv.edicts to NULL (just paranoia) git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1319 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
de4bea0e74
commit
9c7eb2c6ff
3 changed files with 9 additions and 6 deletions
|
@ -549,7 +549,7 @@ void Host_ClearMemory (void)
|
||||||
/* host_hunklevel MUST be set at this point */
|
/* host_hunklevel MUST be set at this point */
|
||||||
Hunk_FreeToLowMark (host_hunklevel);
|
Hunk_FreeToLowMark (host_hunklevel);
|
||||||
cls.signon = 0;
|
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 (&sv, 0, sizeof(sv));
|
||||||
memset (&cl, 0, sizeof(cl));
|
memset (&cl, 0, sizeof(cl));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1226,16 +1226,17 @@ void Host_Loadgame_f (void)
|
||||||
else
|
else
|
||||||
{ // parse an edict
|
{ // parse an edict
|
||||||
ent = EDICT_NUM(entnum);
|
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) {
|
if (entnum < sv.num_edicts) {
|
||||||
|
ent->free = false;
|
||||||
memset (&ent->v, 0, progs->entityfields * 4);
|
memset (&ent->v, 0, progs->entityfields * 4);
|
||||||
}
|
}
|
||||||
else if (entnum < sv.max_edicts) {
|
else {
|
||||||
memset (ent, 0, pr_edict_size);
|
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);
|
ED_ParseEdict (start, ent);
|
||||||
|
|
||||||
// link it into the bsp tree
|
// link it into the bsp tree
|
||||||
|
|
|
@ -87,6 +87,8 @@ void SV_Init (void)
|
||||||
extern cvar_t sv_aim;
|
extern cvar_t sv_aim;
|
||||||
extern cvar_t sv_altnoclip; //johnfitz
|
extern cvar_t sv_altnoclip; //johnfitz
|
||||||
|
|
||||||
|
sv.edicts = NULL; // ericw -- sv.edicts switched to use malloc()
|
||||||
|
|
||||||
Cvar_RegisterVariable (&sv_maxvelocity);
|
Cvar_RegisterVariable (&sv_maxvelocity);
|
||||||
Cvar_RegisterVariable (&sv_gravity);
|
Cvar_RegisterVariable (&sv_gravity);
|
||||||
Cvar_RegisterVariable (&sv_friction);
|
Cvar_RegisterVariable (&sv_friction);
|
||||||
|
|
Loading…
Reference in a new issue