From 4f2bc1cc35f7b37a41019ab3bae4b1aa4aa496e1 Mon Sep 17 00:00:00 2001 From: "ori.bar" Date: Sun, 4 Sep 2011 01:44:50 +0000 Subject: [PATCH] Fix bug 803 --- server/CGameHandler.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 1efdfad05..b59b38bd1 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -421,23 +421,10 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer const CGHeroInstance *winnerHero = battleResult.data->winner != 0 ? hero2 : hero1; const CGHeroInstance *loserHero = battleResult.data->winner != 0 ? hero1 : hero2; - if (winnerHero) - { - CStackBasicDescriptor raisedStack = winnerHero->calculateNecromancy(*battleResult.data); - - // Give raised units to winner and show dialog, if any were raised. - if (raisedStack.type) - { - TSlot slot = winnerHero->getSlotFor(raisedStack.type); - - if (slot != -1) - { - winnerHero->showNecromancyDialog(raisedStack); - addToSlot(StackLocation(winnerHero, slot), raisedStack.type, raisedStack.count); - } - } - } - + const CStackBasicDescriptor raisedStack = winnerHero ? winnerHero->calculateNecromancy(*battleResult.data) : CStackBasicDescriptor(); + // Give raised units to winner and show dialog, if any were raised, + // units will be given after casualities are taken + const TSlot necroSlot = raisedStack.type ? winnerHero->getSlotFor(raisedStack.type) : -1; if(!duel) { @@ -464,6 +451,11 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer afterBattleCallback(); } + if (necroSlot != -1) + { + winnerHero->showNecromancyDialog(raisedStack); + addToSlot(StackLocation(winnerHero, necroSlot), raisedStack.type, raisedStack.count); + } sendAndApply(&resultsApplied); if(duel)