1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Explicitly ban 'large' dwellings from random selection

Old code was relying on specific sorting order leading to easy to break
logic
This commit is contained in:
Ivan Savenko
2024-04-22 12:35:55 +03:00
parent 7d6b936a9d
commit ffec4b9154
4 changed files with 14 additions and 1 deletions

View File

@@ -146,7 +146,7 @@ void CGDwelling::pickRandomObject(CRandomGenerator & rand)
{
const auto * handler = dynamic_cast<const DwellingInstanceConstructor *>(VLC->objtypeh->getHandlerFor(primaryID, entry).get());
if (handler->producesCreature(cid.toCreature()))
if (!handler->isBannedForRandomDwelling() && handler->producesCreature(cid.toCreature()))
return MapObjectSubID(entry);
}
return MapObjectSubID();