From a8b07477b4e7d6afaaf91a2cc3b2ae5a0aebfd59 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 28 May 2024 15:43:06 +0000 Subject: [PATCH 1/4] Fix hero kill mission not registered if target hero was the attacker --- server/battles/BattleResultProcessor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/battles/BattleResultProcessor.cpp b/server/battles/BattleResultProcessor.cpp index 11d4a479d..dbea3fd33 100644 --- a/server/battles/BattleResultProcessor.cpp +++ b/server/battles/BattleResultProcessor.cpp @@ -481,12 +481,12 @@ void BattleResultProcessor::endBattleConfirm(const CBattleInfoCallback & battle) if(finishingBattle->loserHero) //remove beaten hero { - RemoveObject ro(finishingBattle->loserHero->id, battle.battleGetArmyObject(0)->getOwner()); + RemoveObject ro(finishingBattle->loserHero->id, finishingBattle->victor); gameHandler->sendAndApply(&ro); } if(finishingBattle->isDraw() && finishingBattle->winnerHero) //for draw case both heroes should be removed { - RemoveObject ro(finishingBattle->winnerHero->id, battle.battleGetArmyObject(0)->getOwner()); + RemoveObject ro(finishingBattle->winnerHero->id, finishingBattle->loser); gameHandler->sendAndApply(&ro); } From bffc28d9a6ba1a811d60b6fc6c43055dd11534a1 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 28 May 2024 15:43:31 +0000 Subject: [PATCH 2/4] Allow standard defeat on 'To kill a hero' map, in line with H3 --- config/mapOverrides.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/mapOverrides.json b/config/mapOverrides.json index 142c87307..7d9206bf6 100644 --- a/config/mapOverrides.json +++ b/config/mapOverrides.json @@ -295,6 +295,14 @@ }, "message" : "core.genrltxt.252" }, + "standardVictory" : { + "condition" : [ "standardWin" ], + "effect" : { + "messageToSend" : "core.genrltxt.5", + "type" : "victory" + }, + "message" : "core.genrltxt.659" + }, "standardDefeat" : { "condition" : [ "daysWithoutTown", { "value" : 7 } ], "effect" : { From a09276023771adef2c089abde085d9fddbd34d59 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 28 May 2024 16:00:52 +0000 Subject: [PATCH 3/4] Fix freeze on attempt to load campaign save list --- client/lobby/SelectionTab.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/lobby/SelectionTab.cpp b/client/lobby/SelectionTab.cpp index 051e37deb..6711419f0 100644 --- a/client/lobby/SelectionTab.cpp +++ b/client/lobby/SelectionTab.cpp @@ -677,7 +677,6 @@ void SelectionTab::selectFileName(std::string fname) } filter(-1); - selectAbs(-1); for(int i = (int)curItems.size() - 1; i >= 0; i--) { @@ -689,6 +688,8 @@ void SelectionTab::selectFileName(std::string fname) } } + selectAbs(-1); + if(tabType == ESelectionScreen::saveGame && inputName->getText().empty()) inputName->setText("NEWGAME"); } From 49138e3de91d3648ecad20361d9a0ab19e7219e3 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 29 May 2024 14:28:36 +0000 Subject: [PATCH 4/4] Fixes Adrienne starting without Inferno spell in campaign --- lib/mapping/MapFormatH3M.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/mapping/MapFormatH3M.cpp b/lib/mapping/MapFormatH3M.cpp index 99c485439..e2bb899bd 100644 --- a/lib/mapping/MapFormatH3M.cpp +++ b/lib/mapping/MapFormatH3M.cpp @@ -1866,7 +1866,12 @@ CGObjectInstance * CMapLoaderH3M::readHero(const int3 & mapPosition, const Objec //we can read one spell SpellID spell = reader->readSpell(); - if(spell != SpellID::NONE) + // workaround: VCMI uses 'PRESET' spell to indicate that spellbook has been preconfigured on map + // but H3 uses 'PRESET' spell (-2) to indicate that game should give standard spell to hero + if(spell == SpellID::NONE) + object->spells.insert(SpellID::PRESET); //spellbook is preconfigured to be empty + + if (spell.hasValue()) object->spells.insert(spell); }