From ec50000130e34a4597f9933fde2147396fb35cac Mon Sep 17 00:00:00 2001 From: Sara Date: Wed, 12 Jul 2023 02:52:04 +0200 Subject: [PATCH] un-negated uses of object_is_valid that shouldn't be, and negated ones that should be --- src/corelib/world.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/world.c b/src/corelib/world.c index 0036b7f..7eb4ddb 100644 --- a/src/corelib/world.c +++ b/src/corelib/world.c @@ -37,7 +37,7 @@ int _expand_world() { static inline size_t _find_free_object() { for(int i = 0; i < _world_objects.num; ++i) { - if(object_is_valid(_world_objects.objects[i])) { + if(!object_is_valid(_world_objects.objects[i])) { return i; } } @@ -73,7 +73,7 @@ object_t* instantiate_object(const object_t *original) { void world_update() { for(int i = 0; i < _world_objects.num; ++i) { object_t* object = world_get_object(i); - if(!object_is_valid(object) + if(object_is_valid(object) && object->evt_update != NULL) { object->evt_update(object); } @@ -83,7 +83,7 @@ void world_update() { void world_draw() { for(int i = 0; i < _world_objects.num; ++i) { object_t* object = world_get_object(i); - if(!object_is_valid(object) + if(object_is_valid(object) && object->evt_draw != NULL) { object->evt_draw(object); }