Use vector over initializer_list on FixLandOwnershipTilesWithOwnership

This commit is contained in:
Tulio Leao committed 2024-08-19 19:52:14 -03:00
1 parent 194a63c7dc
commit fe69dbb2ea
2 files changed
+4 -5

No files matched your search

+3 -3
View File
@@ -2200,11 +2200,11 @@ uint16_t CheckMaxAllowableLandRightsForTile(const CoordsXYZ& tileMapPos)
return destOwnership;
}
void FixLandOwnershipTilesWithOwnership(std::initializer_list<TileCoordsXY> tiles, uint8_t ownership, bool doNotDowngrade)
void FixLandOwnershipTilesWithOwnership(std::vector<TileCoordsXY> tiles, uint8_t ownership, bool doNotDowngrade)
{
for (const TileCoordsXY* tile = tiles.begin(); tile != tiles.end(); ++tile)
for (const auto& tile : tiles)
{
auto surfaceElement = MapGetSurfaceElementAt(*tile);
auto surfaceElement = MapGetSurfaceElementAt(tile);
if (surfaceElement != nullptr)
{
if (doNotDowngrade && surfaceElement->GetOwnership() == OWNERSHIP_OWNED)
+1 -2
View File
@@ -232,7 +232,6 @@ bool MapIsLocationAtEdge(const CoordsXY& loc);
uint16_t CheckMaxAllowableLandRightsForTile(const CoordsXYZ& tileMapPos);
void FixLandOwnershipTilesWithOwnership(
std::initializer_list<TileCoordsXY> tiles, uint8_t ownership, bool doNotDowngrade = false);
void FixLandOwnershipTilesWithOwnership(std::vector<TileCoordsXY> tiles, uint8_t ownership, bool doNotDowngrade = false);
MapRange ClampRangeWithinMap(const MapRange& range);
void ShiftMap(const TileCoordsXY& amount);