diff --git a/src/battle/entities.c b/src/battle/entities.c index d4ec9a6..ea25079 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -556,6 +556,16 @@ void countNumEnemies(void) SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "battle.numInitialEnemies=%d", battle.numInitialEnemies); } +void addAllEntsToQuadtree(void) +{ + Entity *e; + + for (e = battle.entityHead.next ; e != NULL ; e = e->next) + { + addToQuadtree(e, &battle.quadtree); + } +} + static int drawComparator(const void *a, const void *b) { Entity *e1 = *((Entity**)a); diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index 99899df..a8896df 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -223,6 +223,8 @@ void loadMission(char *filename) initPlayer(); initMissionInfo(); + + addAllEntsToQuadtree(); playMusic(music); } diff --git a/src/galaxy/mission.h b/src/galaxy/mission.h index cbdcd6e..af2a4d9 100644 --- a/src/galaxy/mission.h +++ b/src/galaxy/mission.h @@ -54,6 +54,7 @@ extern char *getPlanetTextureName(int n); extern char *getMusicFilename(int n); extern int getJSONValue(cJSON *node, char *name, int defValue); extern char *getJSONValueStr(cJSON *node, char *name, char *defValue); +extern void addAllEntsToQuadtree(void); extern Battle battle; extern Entity *player;