浏览代码

Merge pull request #4049 from IvanSavenko/campaign_fix

[1.5.2] Campaign fixes
Ivan Savenko 1 年之前
父节点
当前提交
2fcbfd978a
共有 4 个文件被更改,包括 18 次插入4 次删除
  1. 2 1
      client/lobby/SelectionTab.cpp
  2. 8 0
      config/mapOverrides.json
  3. 6 1
      lib/mapping/MapFormatH3M.cpp
  4. 2 2
      server/battles/BattleResultProcessor.cpp

+ 2 - 1
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");
 }

+ 8 - 0
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" : {

+ 6 - 1
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);
 	}
 

+ 2 - 2
server/battles/BattleResultProcessor.cpp

@@ -484,12 +484,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);
 	}