mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
CGameHandler: obstacle trigger does not use CStack
This commit is contained in:
parent
22dd97ad18
commit
e946ddcfeb
@ -1506,7 +1506,7 @@ int CGameHandler::moveStack(int stack, BattleHex dest)
|
||||
{
|
||||
if(stackIsMoving && start != curStack->getPosition())
|
||||
{
|
||||
stackIsMoving = handleDamageFromObstacle(curStack, stackIsMoving, passed);
|
||||
stackIsMoving = handleDamageFromObstacle(curStack, passed);
|
||||
passed.insert(curStack->getPosition());
|
||||
if(curStack->doubleWide())
|
||||
passed.insert(curStack->occupiedHex());
|
||||
@ -1544,7 +1544,7 @@ int CGameHandler::moveStack(int stack, BattleHex dest)
|
||||
passed.clear(); //Just empty passed, obstacles will handled automatically
|
||||
}
|
||||
//handling obstacle on the final field (separate, because it affects both flying and walking stacks)
|
||||
handleDamageFromObstacle(curStack, false, passed);
|
||||
handleDamageFromObstacle(curStack, passed);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -5219,7 +5219,7 @@ void CGameHandler::stackTurnTrigger(const CStack *st)
|
||||
}
|
||||
}
|
||||
|
||||
bool CGameHandler::handleDamageFromObstacle(const CStack * curStack, bool stackIsMoving, const std::set<BattleHex> & passed)
|
||||
bool CGameHandler::handleDamageFromObstacle(const battle::Unit * curStack, const std::set<BattleHex> & passed)
|
||||
{
|
||||
if(!curStack->alive())
|
||||
return false;
|
||||
@ -5247,7 +5247,7 @@ bool CGameHandler::handleDamageFromObstacle(const CStack * curStack, bool stackI
|
||||
changedObstacle.toInfo(bocp.changes.back(), operation);
|
||||
sendAndApply(&bocp);
|
||||
};
|
||||
const auto side = curStack->side;
|
||||
const auto side = curStack->unitSide();
|
||||
auto shouldReveal = !spellObstacle->hidden || !gs->curB->battleIsObstacleVisibleForSide(*obstacle, (BattlePerspective::BattlePerspective)side);
|
||||
const auto * hero = gs->curB->battleGetFightingHero(spellObstacle->casterSide);
|
||||
auto caster = spells::ObstacleCasterProxy(gs->curB->getSidePlayer(spellObstacle->casterSide), hero, *spellObstacle);
|
||||
@ -5272,14 +5272,11 @@ bool CGameHandler::handleDamageFromObstacle(const CStack * curStack, bool stackI
|
||||
if(!curStack->alive())
|
||||
return false;
|
||||
|
||||
if((obstacle->stopsMovement() && stackIsMoving))
|
||||
if(obstacle->stopsMovement())
|
||||
movementStopped = true;
|
||||
}
|
||||
|
||||
if(stackIsMoving)
|
||||
return curStack->alive() && !movementStopped;
|
||||
|
||||
return curStack->alive();
|
||||
return curStack->alive() && !movementStopped;
|
||||
}
|
||||
|
||||
void CGameHandler::handleTimeEvents()
|
||||
|
@ -232,7 +232,7 @@ public:
|
||||
bool makeCustomAction(BattleAction &ba);
|
||||
void stackEnchantedTrigger(const CStack * stack);
|
||||
void stackTurnTrigger(const CStack *stack);
|
||||
bool handleDamageFromObstacle(const CStack * curStack, bool stackIsMoving = false, const std::set<BattleHex> & passed = {}); //checks if obstacle is land mine and handles possible consequences
|
||||
bool handleDamageFromObstacle(const battle::Unit * curStack, const std::set<BattleHex> & passed = {}); //checks if obstacle is land mine and handles possible consequences
|
||||
|
||||
void removeObstacle(const CObstacleInstance &obstacle);
|
||||
bool queryReply( QueryID qid, const JsonNode & answer, PlayerColor player );
|
||||
|
Loading…
Reference in New Issue
Block a user