Report entities being outside of game world.

This commit is contained in:
Steve 2018-03-16 22:27:47 +00:00
parent 513f7fdb58
commit 50aea7c890
2 changed files with 9 additions and 3 deletions

View File

@ -452,6 +452,14 @@ static void checkStuckInWall(void)
{ {
int mx, my; 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) switch (self->type)
{ {
case ET_PRESSURE_PLATE: case ET_PRESSURE_PLATE:
@ -461,9 +469,6 @@ static void checkStuckInWall(void)
break; break;
default: default:
mx = self->x / MAP_TILE_SIZE;
my = self->y / MAP_TILE_SIZE;
if (hasHitWorld(mx, my)) 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); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "%s (%d): in wall at %d,%d", self->name, self->type, mx, my);

View File

@ -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 playBattleSound(int snd, int ch, int x, int y);
extern void removeFromQuadtree(Entity *e, Quadtree *root); extern void removeFromQuadtree(Entity *e, Quadtree *root);
extern void terminateJetpack(void); extern void terminateJetpack(void);
extern int isWithinMap(int x, int y);
extern Camera camera; extern Camera camera;
extern Dev dev; extern Dev dev;