From eff158a9a815c9d35197c5fa361c8ee21b0166d7 Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Sun, 23 Apr 2023 11:38:33 +0300 Subject: [PATCH] Fix killing hero with grail --- server/CGameHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index cf0ed56d5..41e218e29 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -789,12 +789,12 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance * heroAttacker, con sendMoveArtifact(art, &ma); } } - while(!finishingBattle->loserHero->artifactsInBackpack.empty()) + for(int slotNumber = finishingBattle->loserHero->artifactsInBackpack.size() - 1; slotNumber >= 0; slotNumber--) { //we assume that no big artifacts can be found MoveArtifact ma; ma.src = ArtifactLocation(finishingBattle->loserHero, - ArtifactPosition(GameConstants::BACKPACK_START)); //backpack automatically shifts arts to beginning + ArtifactPosition(GameConstants::BACKPACK_START + slotNumber)); //backpack automatically shifts arts to beginning const CArtifactInstance * art = ma.src.getArt(); if (art->artType->getId() != ArtifactID::GRAIL) //grail may not be won {