Delay the "too many entities" check.

Rather than checking the raw edict count in the entities file against the
progs' max_edicts, check the allocated entity's number. This allows loading
of sophisticated maps (eg, digs04) that prune many of their entities.
This commit is contained in:
Bill Currie 2012-07-09 15:07:34 +09:00
parent ce16750b04
commit 6e0907a6b1

View file

@ -434,8 +434,6 @@ ED_SpawnEntities (progs_t *pr, plitem_t *entity_list)
max_edicts -= *pr->num_edicts;
count = PL_A_NumObjects (entity_list);
if (count > max_edicts)
PR_Error (pr, "too many entities: %d > %d", count, max_edicts);
for (i = 0; i < count; i++) {
entity = PL_ObjectAtIndex (entity_list, i);
@ -448,6 +446,11 @@ ED_SpawnEntities (progs_t *pr, plitem_t *entity_list)
else
ent = ED_Alloc (pr);
// don't allow the last edict to be used, as otherwise we can't detect
// too many edicts
if (NUM_FOR_EDICT (pr, ent) >= pr->max_edicts - 1)
PR_Error (pr, "too many entities: %d > %d", count, max_edicts);
ED_InitEntity (pr, entity, ent);
// remove things from different skill levels or deathmatch