1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-21 21:17:49 +02:00

Fix bug 803

This commit is contained in:
ori.bar 2011-09-04 01:44:50 +00:00
parent 5b836f428a
commit 4f2bc1cc35

View File

@ -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)