1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +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
{
//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;
}