From 2a2a431431db3b879a32d59f65f3c2110eaa4acd Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 17 Apr 2011 20:06:20 +0900 Subject: [PATCH] Register a complaint when the map has too many entities. I was wondering why that parrot was dead. Not realizing that negke's coag3 map had too many entities really ruined the pleasure of playing it, so it's best to treat such situations as an error (max_edicts can be bumped up to 32000 if need be, but 2048 is plenty for his map). --- libs/gamecode/engine/pr_parse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/gamecode/engine/pr_parse.c b/libs/gamecode/engine/pr_parse.c index 14e056267..64037fcb6 100644 --- a/libs/gamecode/engine/pr_parse.c +++ b/libs/gamecode/engine/pr_parse.c @@ -408,8 +408,12 @@ ED_SpawnEntities (progs_t *pr, plitem_t *entity_list) int count; const char *classname; dfunction_t *func; + pr_int_t max_edicts = pr->pr_edictareasize / pr->pr_edict_size; + 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);