1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00
This commit is contained in:
Michał W. Urbańczyk 2011-09-01 02:48:29 +00:00
parent 20a53b04fd
commit 102593aabe

View File

@ -506,9 +506,10 @@ void CGameHandler::afterBattleCallback() //object interaction after leveling up
{
if(battleEndCallback && *battleEndCallback)
{
(*battleEndCallback)(battleResult.data);
delete battleEndCallback;
battleEndCallback = 0;
boost::function<void(BattleResult*)> *backup = battleEndCallback;
battleEndCallback = NULL; //we need to set it to NULL or else we have infinite recursion when after battle callback gives exp (eg Pandora Box with exp)
(*backup)(battleResult.data);
delete backup;
}
}
void CGameHandler::prepareAttack(BattleAttack &bat, const CStack *att, const CStack *def, int distance, int targetHex)
@ -4994,8 +4995,8 @@ void CGameHandler::runBattle()
const CGHeroInstance * curOwner = gs->curB->battleGetOwner(next);
if( (next->position < 0 && (!curOwner || curOwner->getSecSkillLevel(CGHeroInstance::BALLISTICS) == 0)) //arrow turret, hero has no ballistics
|| (next->getCreature()->idNumber == 146 && (!curOwner || curOwner->getSecSkillLevel(CGHeroInstance::ARTILLERY) == 0))) //ballista, hero has no artillery
if( (next->position < 0 || next->getCreature()->idNumber == 146) //arrow turret or ballista
&& (!curOwner || curOwner->getSecSkillLevel(CGHeroInstance::ARTILLERY) == 0)) //hero has no artillery
{
BattleAction attack;
attack.actionType = BattleAction::SHOOT;