From 0dca225b7f6eab8b6f01fc270c6e7612ade5f261 Mon Sep 17 00:00:00 2001 From: dmccoystephenson Date: Tue, 6 Sep 2022 00:00:35 -0600 Subject: [PATCH] Set an entity's grid id when adding them to a specified location. --- src/grid.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); }