Don't observe entities that are close to another that is already being observed.

This commit is contained in:
Steve 2018-02-28 08:00:24 +00:00
parent c98e93ee2b
commit 695e1fc5da
2 changed files with 5 additions and 0 deletions

View File

@ -706,6 +706,10 @@ void observeActivation(Entity *e)
world.observationTimer = FPS * 2;
return;
}
else if (getDistance(e->x, e->y, world.entitiesToObserve[i]->x, world.entitiesToObserve[i]->y) < SCREEN_HEIGHT - 50)
{
return;
}
}
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "Can't observe entity - out of array space");

View File

@ -112,6 +112,7 @@ extern void returnToHub(void);
extern void returnToTitle(void);
extern void playBattleSound(int snd, int ch, int x, int y);
extern void pauseSound(int pause);
extern int getDistance(int x1, int y1, int x2, int y2);
extern App app;
extern Colors colors;