1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

vcmi: use std::optional

This commit is contained in:
Konstantin
2023-04-16 20:42:56 +03:00
parent 0d35606a44
commit 7a5775a9f9
135 changed files with 552 additions and 585 deletions

View File

@@ -66,7 +66,7 @@ void BattleObstacleController::loadObstacleImage(const CObstacleInstance & oi)
void BattleObstacleController::obstacleRemoved(const std::vector<ObstacleChanges> & obstacles)
{
for (auto const & oi : obstacles)
for(const auto & oi : obstacles)
{
auto & obstacle = oi.data["obstacle"];
@@ -97,11 +97,11 @@ void BattleObstacleController::obstacleRemoved(const std::vector<ObstacleChanges
void BattleObstacleController::obstaclePlaced(const std::vector<std::shared_ptr<const CObstacleInstance>> & obstacles)
{
for (auto const & oi : obstacles)
for(const auto & oi : obstacles)
{
auto side = owner.curInt->cb->playerToSide(owner.curInt->playerID);
if(!oi->visibleForSide(side.get(),owner.curInt->cb->battleHasNativeStack(side.get())))
if(!oi->visibleForSide(side.value(), owner.curInt->cb->battleHasNativeStack(side.value())))
continue;
auto animation = std::make_shared<CAnimation>(oi->getAppearAnimation());