diff --git a/src/grid.cpp b/src/grid.cpp index d86c171..5ddc9a8 100644 --- a/src/grid.cpp +++ b/src/grid.cpp @@ -69,7 +69,8 @@ namespace envlibcpp { } void Grid::addEntityToLocation(Entity& entity, Location& location) { - for (Location &l : locations) { + entity.setGridId(id); + for (Location& l : locations) { if (l.getId() == location.getId()) { location.addEntity(entity); }