ソースを参照

Remove hardcoded check for number of heroes on map

Ivan Savenko 1 年間 前
コミット
66d96e6ef6
1 ファイル変更4 行追加3 行削除
  1. 4 3
      server/CGameHandler.cpp

+ 4 - 3
server/CGameHandler.cpp

@@ -2696,10 +2696,11 @@ bool CGameHandler::garrisonSwap(ObjectInstanceID tid)
 	}
 	else if (town->garrisonHero && !town->visitingHero) //move hero out of the garrison
 	{
-		//check if moving hero out of town will break 8 wandering heroes limit
-		if (getHeroCount(town->garrisonHero->tempOwner,false) >= 8)
+		int mapCap = VLC->settings()->getInteger(EGameSettings::HEROES_PER_PLAYER_ON_MAP_CAP);
+		//check if moving hero out of town will break wandering heroes limit
+		if (getHeroCount(town->garrisonHero->tempOwner,false) >= mapCap)
 		{
-			complain("Cannot move hero out of the garrison, there are already 8 wandering heroes!");
+			complain("Cannot move hero out of the garrison, there are already " + std::to_string(mapCap) + " wandering heroes!");
 			return false;
 		}