1
0
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:
Ivan Savenko
2025-01-29 23:02:51 +00:00
parent 5c8c69e665
commit d8ec69bfaa
6 changed files with 74 additions and 55 deletions

View File

@@ -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