Added reference to harbored map object to tiles; minor refactoring

This commit is contained in:
2022-06-10 16:15:12 +02:00
parent 26d3289962
commit 18af6a56be
3 changed files with 16 additions and 9 deletions
+4 -1
View File
@@ -38,9 +38,12 @@ void AMapObject::Activate()
{
}
// Any subclass of MapObject has a defined array of Vectors relative to its origin which has to occupy() upon being placed on the map.
void AMapObject::Occupy()
{
for (auto& V : Occupying) {
MapRef->Grid[MapRef->GridIndex(Origin->Q + V.Q, Origin->R + V.R)]->bFree = false;
AHexTile* OccupiedHex = MapRef->Grid[MapRef->GridIndex(Origin->Q + V.Q, Origin->R + V.R)];
OccupiedHex->bFree = false;
OccupiedHex->MapObject = this;
}
}