1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-09 13:24:01 +00:00

Fix unsafe entity iteration.

It was possible to crash the game by creating many entities in a script
callback that iterates over entities, for example.
This commit is contained in:
fgenesis 2013-07-05 00:06:28 +02:00
parent 748dc6cd9d
commit 51ee827d98

View file

@ -166,7 +166,8 @@ enum AquariaActions
typedef std::list<Entity*> EntityList;
typedef std::vector<Entity*> EntityContainer;
#define FOR_ENTITIES(i) for (Entity **i = &dsq->entities[0]; *i != 0; i++)
// last entry is always NULL. added if is a little hack to ensure the scope of the iterator variable
#define FOR_ENTITIES(i) for (size_t i##_i = 0; dsq->entities[i##_i] != 0; ++i##_i) if (Entity **i = &dsq->entities[i##_i])
enum MenuPage