mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-13 11:40:38 +02:00
Battles: always update drawbridge state after battle state changed
Now gate tower destruction will immidiately affect drawbridge state.
This commit is contained in:
parent
47433919ab
commit
fbb34b8d04
@ -1240,7 +1240,6 @@ int CGameHandler::moveStack(int stack, BattleHex dest)
|
|||||||
handleDamageFromObstacle(*theLastObstacle, curStack);
|
handleDamageFromObstacle(*theLastObstacle, curStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateDrawbridgeState();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1807,8 +1806,13 @@ void CGameHandler::setupBattle( int3 tile, const CArmedInstance *armies[2], cons
|
|||||||
sendAndApply(&bs);
|
sendAndApply(&bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameHandler::checkForBattleEnd()
|
void CGameHandler::checkBattleStateChanges()
|
||||||
{
|
{
|
||||||
|
//check if drawbridge state need to be changes
|
||||||
|
if(battleGetSiegeLevel() > 0)
|
||||||
|
updateDrawbridgeState();
|
||||||
|
|
||||||
|
//check if battle ended
|
||||||
if(auto result = battleIsFinished())
|
if(auto result = battleIsFinished())
|
||||||
{
|
{
|
||||||
setBattleResult(BattleResult::NORMAL, *result);
|
setBattleResult(BattleResult::NORMAL, *result);
|
||||||
@ -4326,7 +4330,7 @@ bool CGameHandler::makeCustomAction( BattleAction &ba )
|
|||||||
{
|
{
|
||||||
battleMadeAction.setn(true);
|
battleMadeAction.setn(true);
|
||||||
}
|
}
|
||||||
checkForBattleEnd();
|
checkBattleStateChanges();
|
||||||
if(battleResult.get())
|
if(battleResult.get())
|
||||||
{
|
{
|
||||||
battleMadeAction.setn(true);
|
battleMadeAction.setn(true);
|
||||||
@ -5713,7 +5717,7 @@ void CGameHandler::runBattle()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//we're after action, all results applied
|
//we're after action, all results applied
|
||||||
checkForBattleEnd(); //check if this action ended the battle
|
checkBattleStateChanges(); //check if this action ended the battle
|
||||||
|
|
||||||
if(next != nullptr)
|
if(next != nullptr)
|
||||||
{
|
{
|
||||||
@ -5765,7 +5769,7 @@ bool CGameHandler::makeAutomaticAction(const CStack *stack, BattleAction &ba)
|
|||||||
sendAndApply(&bsa);
|
sendAndApply(&bsa);
|
||||||
|
|
||||||
bool ret = makeBattleAction(ba);
|
bool ret = makeBattleAction(ba);
|
||||||
checkForBattleEnd();
|
checkBattleStateChanges();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ public:
|
|||||||
void endBattle(int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2); //ends battle
|
void endBattle(int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2); //ends battle
|
||||||
void prepareAttack(BattleAttack &bat, const CStack *att, const CStack *def, int distance, int targetHex); //distance - number of hexes travelled before attacking
|
void prepareAttack(BattleAttack &bat, const CStack *att, const CStack *def, int distance, int targetHex); //distance - number of hexes travelled before attacking
|
||||||
void applyBattleEffects(BattleAttack &bat, const CStack *att, const CStack *def, int distance, bool secondary); //damage, drain life & fire shield
|
void applyBattleEffects(BattleAttack &bat, const CStack *att, const CStack *def, int distance, bool secondary); //damage, drain life & fire shield
|
||||||
void checkForBattleEnd();
|
void checkBattleStateChanges();
|
||||||
void setupBattle(int3 tile, const CArmedInstance *armies[2], const CGHeroInstance *heroes[2], bool creatureBank, const CGTownInstance *town);
|
void setupBattle(int3 tile, const CArmedInstance *armies[2], const CGHeroInstance *heroes[2], bool creatureBank, const CGTownInstance *town);
|
||||||
void setBattleResult(BattleResult::EResult resultType, int victoriusSide);
|
void setBattleResult(BattleResult::EResult resultType, int victoriusSide);
|
||||||
void duelFinished();
|
void duelFinished();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user