From 5162b4900784a963b240204e216687cb26013bf0 Mon Sep 17 00:00:00 2001 From: rendo Date: Sat, 14 Mar 2026 09:16:31 +0500 Subject: [PATCH] grid freed --- src/world.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/world.cpp b/src/world.cpp index d72de2f..4442b7f 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -16,6 +16,7 @@ World::~World(){ for(int i = 0; i < this->entities.size();i++) { delete this->entities[i]; } + delete [] this->grid; UnloadTexture(this->texture_atlas); } @@ -111,7 +112,7 @@ void World::update_grid() { for(int i = 0; i < this->entities.size(); i++) { int indexified_position = indexify_position(this->entities[i]->position); - if (indexified_position < 0 || indexified_position >= this->get_capacity() || grid[indexified_position] != nullptr) + if (indexified_position < 0 || indexified_position >= this->get_capacity()) continue; grid[indexified_position] = this->entities[i]; }