Don't observe entities that are close to another that is already being observed.
This commit is contained in:
parent
c98e93ee2b
commit
695e1fc5da
|
@ -706,6 +706,10 @@ void observeActivation(Entity *e)
|
||||||
world.observationTimer = FPS * 2;
|
world.observationTimer = FPS * 2;
|
||||||
return;
|
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");
|
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "Can't observe entity - out of array space");
|
||||||
|
|
|
@ -112,6 +112,7 @@ extern void returnToHub(void);
|
||||||
extern void returnToTitle(void);
|
extern void returnToTitle(void);
|
||||||
extern void playBattleSound(int snd, int ch, int x, int y);
|
extern void playBattleSound(int snd, int ch, int x, int y);
|
||||||
extern void pauseSound(int pause);
|
extern void pauseSound(int pause);
|
||||||
|
extern int getDistance(int x1, int y1, int x2, int y2);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
Loading…
Reference in New Issue