Ensure edict_size is never 0.

Avoids division by / in NUM_FOR_EDICT
This commit is contained in:
Bill Currie 2012-05-06 21:35:42 +09:00
parent 1dd5cccda2
commit 0036a5e113
2 changed files with 4 additions and 2 deletions

View file

@ -42,6 +42,7 @@
#include "QF/cvar.h"
#include "QF/dstring.h"
#include "QF/hash.h"
#include "QF/mathlib.h"
#include "QF/progs.h"
#include "QF/qdefs.h"
#include "QF/qendian.h"
@ -174,7 +175,7 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size, int edicts, int zone)
pr->zone_size &= ~(sizeof (void*) - 1);
// size of edict asked for by progs
pr->pr_edict_size = progs.entityfields * 4;
pr->pr_edict_size = max (1, progs.entityfields) * 4;
// size of engine data
pr->pr_edict_size += sizeof (edict_t) - sizeof (pr_type_t);
// round off to next highest whole word address (esp for Alpha)

View file

@ -55,6 +55,7 @@
#include "QF/cmd.h"
#include "QF/cvar.h"
#include "QF/hash.h"
#include "QF/mathlib.h"
#include "QF/pr_comp.h"
#include "QF/progs.h"
#include "QF/quakeio.h"
@ -263,7 +264,7 @@ convert_qfo (void)
pr.pr_fielddefs = P (ddef_t, ofs_fielddefs);
pr.pr_globals = P (pr_type_t, ofs_globals);
pr.globals_size = pr.progs->numglobals;
pr.pr_edict_size = pr.progs->entityfields * 4;
pr.pr_edict_size = max (1, pr.progs->entityfields) * 4;
pr.pr_edictareasize = 1 * pr.pr_edict_size;
#undef P