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); }