diff --git a/src/world/entities.c b/src/world/entities.c index eafd5e8..8a4fe26 100644 --- a/src/world/entities.c +++ b/src/world/entities.c @@ -452,6 +452,14 @@ static void checkStuckInWall(void) { int mx, my; + mx = self->x / MAP_TILE_SIZE; + my = self->y / MAP_TILE_SIZE; + + if (!isWithinMap(mx, my)) + { + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "%s (%d) outside world at %d,%d", self->name, self->type, mx, my); + } + switch (self->type) { case ET_PRESSURE_PLATE: @@ -461,9 +469,6 @@ static void checkStuckInWall(void) break; default: - mx = self->x / MAP_TILE_SIZE; - my = self->y / MAP_TILE_SIZE; - if (hasHitWorld(mx, my)) { SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "%s (%d): in wall at %d,%d", self->name, self->type, mx, my); diff --git a/src/world/entities.h b/src/world/entities.h index 2783859..10ddab3 100644 --- a/src/world/entities.h +++ b/src/world/entities.h @@ -39,6 +39,7 @@ extern float limit(float i, float a, float b); extern void playBattleSound(int snd, int ch, int x, int y); extern void removeFromQuadtree(Entity *e, Quadtree *root); extern void terminateJetpack(void); +extern int isWithinMap(int x, int y); extern Camera camera; extern Dev dev;