summaryrefslogtreecommitdiff
path: root/src/entity.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/entity.c')
-rw-r--r--src/entity.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/entity.c b/src/entity.c
index 07bea1e..9d495d2 100644
--- a/src/entity.c
+++ b/src/entity.c
@@ -46,8 +46,8 @@ entity_meet(Entity *this, Entity *other)
Entity *
entity_place_meeting(Entity *this, struct Game *g, unsigned int type)
{
- for (__auto_type i = 0; i < MAX_ENTITIES; i++)
- if (this != &g->entities[i] && (type == -1u || g->entities[i].type == type) &&
+ for (__auto_type i = MAX_ENTITIES - 1; i >= 0; i--)
+ if (this != &g->entities[i] && ((type == -1u && g->entities[i].smash != NULL) || g->entities[i].type == type) &&
entity_meet(this, &g->entities[i]))
return &g->entities[i];
return NULL;