grid freed
This commit is contained in:
parent
45a160fcaa
commit
5162b49007
1 changed files with 2 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ World::~World(){
|
||||||
for(int i = 0; i < this->entities.size();i++) {
|
for(int i = 0; i < this->entities.size();i++) {
|
||||||
delete this->entities[i];
|
delete this->entities[i];
|
||||||
}
|
}
|
||||||
|
delete [] this->grid;
|
||||||
UnloadTexture(this->texture_atlas);
|
UnloadTexture(this->texture_atlas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -111,7 +112,7 @@ void World::update_grid() {
|
||||||
for(int i = 0; i < this->entities.size(); i++)
|
for(int i = 0; i < this->entities.size(); i++)
|
||||||
{
|
{
|
||||||
int indexified_position = indexify_position(this->entities[i]->position);
|
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;
|
continue;
|
||||||
grid[indexified_position] = this->entities[i];
|
grid[indexified_position] = this->entities[i];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue