1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

vcmi: now obstacles can have disappearing anim

It is a reverse version of appearingAnimation.
This commit is contained in:
Konstantin
2023-03-26 19:57:21 +03:00
parent 7543fdf787
commit eff41f66ed
8 changed files with 108 additions and 13 deletions

View File

@ -759,6 +759,7 @@ void CPlayerInterface::battleObstaclesChanged(const std::vector<ObstacleChanges>
BATTLE_EVENT_POSSIBLE_RETURN;
std::vector<std::shared_ptr<const CObstacleInstance>> newObstacles;
std::vector<ObstacleChanges> removedObstacles;
for(auto & change : obstacles)
{
@ -770,11 +771,16 @@ void CPlayerInterface::battleObstaclesChanged(const std::vector<ObstacleChanges>
else
logNetwork->error("Invalid obstacle instance %d", change.id);
}
if(change.operation == BattleChanges::EOperation::REMOVE)
removedObstacles.push_back(change); //Obstacles are already removed, so, show animation based on json struct
}
if (!newObstacles.empty())
battleInt->obstaclePlaced(newObstacles);
if (!removedObstacles.empty())
battleInt->obstacleRemoved(removedObstacles);
battleInt->fieldController->redrawBackgroundWithHexes();
}