mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Compile fix for Kingdom Overview
Fixed common crash with gained exp, fixed necromancy.
This commit is contained in:
@@ -414,6 +414,27 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer
|
||||
sendAndApply(&iw);
|
||||
sendAndApply(&cs);
|
||||
}
|
||||
// Necromancy if applicable.
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!duel)
|
||||
{
|
||||
@@ -449,27 +470,6 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer
|
||||
return;
|
||||
}
|
||||
|
||||
// Necromancy if applicable.
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(visitObjectAfterVictory && winnerHero == hero1)
|
||||
{
|
||||
visitObjectOnTile(*getTile(winnerHero->getPosition()), winnerHero);
|
||||
@@ -506,8 +506,8 @@ void CGameHandler::afterBattleCallback() //object interaction after leveling up
|
||||
(*battleEndCallback)(battleResult.data);
|
||||
delete battleEndCallback;
|
||||
battleEndCallback = 0;
|
||||
delete battleResult.data; //remove only after battle
|
||||
}
|
||||
delete battleResult.data;
|
||||
}
|
||||
void CGameHandler::prepareAttack(BattleAttack &bat, const CStack *att, const CStack *def, int distance, int targetHex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user