From 9f100106ebfd83d1e1ca4f5d32ad6080dbe819cd Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 9 Feb 2018 07:42:10 +0000 Subject: [PATCH] Don't add enemies if noEnemies flag set. --- src/test/atlasTest.c | 2 ++ src/test/atlasTest.h | 1 + src/world/worldLoader.c | 5 +++++ src/world/worldLoader.h | 1 + 4 files changed, 9 insertions(+) diff --git a/src/test/atlasTest.c b/src/test/atlasTest.c index 972051c..a08ed37 100644 --- a/src/test/atlasTest.c +++ b/src/test/atlasTest.c @@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void initAtlasTest(void) { + dev.cheatNoEnemies = 1; + initGame(); initHub(); diff --git a/src/test/atlasTest.h b/src/test/atlasTest.h index e830add..102b583 100644 --- a/src/test/atlasTest.h +++ b/src/test/atlasTest.h @@ -27,3 +27,4 @@ extern void initGame(void); extern void initEntities(void); extern void loadWorld(char *filename); +extern Dev dev; diff --git a/src/world/worldLoader.c b/src/world/worldLoader.c index 1b17e55..5ab4be1 100644 --- a/src/world/worldLoader.c +++ b/src/world/worldLoader.c @@ -166,6 +166,11 @@ static void loadEntities(cJSON *root) self->init(); self->animate(); + + if (self->type == ET_ENEMY && dev.cheatNoEnemies) + { + self->alive = ALIVE_DEAD; + } } } diff --git a/src/world/worldLoader.h b/src/world/worldLoader.h index fd7f56f..89a2ff7 100644 --- a/src/world/worldLoader.h +++ b/src/world/worldLoader.h @@ -25,5 +25,6 @@ extern char *readFile(const char *filename); extern void loadSprite(cJSON *root); extern Entity *createEntity(char *typeStr); +extern Dev dev; extern Entity *self; extern World world;