1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-08 00:39:47 +02:00

Remove hardcoded check for number of heroes on map

This commit is contained in:
Ivan Savenko 2024-08-15 13:15:18 +00:00
parent d09fb07362
commit 66d96e6ef6

View File

@ -2696,10 +2696,11 @@ bool CGameHandler::garrisonSwap(ObjectInstanceID tid)
} }
else if (town->garrisonHero && !town->visitingHero) //move hero out of the garrison 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 int mapCap = VLC->settings()->getInteger(EGameSettings::HEROES_PER_PLAYER_ON_MAP_CAP);
if (getHeroCount(town->garrisonHero->tempOwner,false) >= 8) //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; return false;
} }