mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Remove non-const iterators to BattleHexArray container
Replaced with several non-const methods to prevent modification of internal storage without corresponding modification of internal flags
This commit is contained in:
@@ -30,16 +30,6 @@ void BattleHexArray::insert(const BattleHexArray & other) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
void BattleHexArray::erase(iterator first, iterator last) noexcept
|
||||
{
|
||||
for(auto it = first; it != last && it != internalStorage.end(); ++it)
|
||||
{
|
||||
presenceFlags[it->toInt()] = false;
|
||||
}
|
||||
|
||||
internalStorage.erase(first, last);
|
||||
}
|
||||
|
||||
void BattleHexArray::clear() noexcept
|
||||
{
|
||||
for(const auto & hex : internalStorage)
|
||||
@@ -129,4 +119,4 @@ const std::map<BattleSide, BattleHexArray::ArrayOfBattleHexArrays> BattleHexArra
|
||||
{ BattleSide::DEFENDER, precalculateNeighbouringTilesDoubleWide(BattleSide::DEFENDER) }
|
||||
};
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
Reference in New Issue
Block a user