mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-05 00:49:09 +02:00
Fixed crash on ending battle with a draw
This commit is contained in:
@ -2205,25 +2205,31 @@ void BattleResultAccepted::applyGs(CGameState * gs) const
|
|||||||
for(auto & res : heroResult)
|
for(auto & res : heroResult)
|
||||||
{
|
{
|
||||||
if(res.hero)
|
if(res.hero)
|
||||||
res.hero->removeBonusesRecursive(Bonus::OneBattle);
|
res.hero->removeBonusesRecursive(Bonus::OneBattle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grow up growing artifacts
|
if(winnerSide != 2)
|
||||||
if(const auto hero = heroResult[winnerSide].hero)
|
{
|
||||||
{
|
// Grow up growing artifacts
|
||||||
if(hero->commander && hero->commander->alive)
|
const auto hero = heroResult[winnerSide].hero;
|
||||||
{
|
|
||||||
for(auto & art : hero->commander->artifactsWorn)
|
if (hero)
|
||||||
art.second.artifact->growingUp();
|
{
|
||||||
}
|
if(hero->commander && hero->commander->alive)
|
||||||
for(auto & art : hero->artifactsWorn)
|
{
|
||||||
{
|
for(auto & art : hero->commander->artifactsWorn)
|
||||||
art.second.artifact->growingUp();
|
art.second.artifact->growingUp();
|
||||||
}
|
}
|
||||||
}
|
for(auto & art : hero->artifactsWorn)
|
||||||
if(VLC->settings()->getBoolean(EGameSettings::MODULE_STACK_EXPERIENCE))
|
{
|
||||||
{
|
art.second.artifact->growingUp();
|
||||||
if(heroResult[0].army)
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(VLC->settings()->getBoolean(EGameSettings::MODULE_STACK_EXPERIENCE))
|
||||||
|
{
|
||||||
|
if(heroResult[0].army)
|
||||||
heroResult[0].army->giveStackExp(heroResult[0].exp);
|
heroResult[0].army->giveStackExp(heroResult[0].exp);
|
||||||
if(heroResult[1].army)
|
if(heroResult[1].army)
|
||||||
heroResult[1].army->giveStackExp(heroResult[1].exp);
|
heroResult[1].army->giveStackExp(heroResult[1].exp);
|
||||||
|
Reference in New Issue
Block a user