1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-25 00:37:24 +02:00

Distribute limited objects evenly in zones with matching terrain

This commit is contained in:
Tomasz Zieliński
2023-03-27 09:09:58 +02:00
parent a88e1dc1f6
commit 18a87d1ec0
9 changed files with 206 additions and 31 deletions

View File

@ -508,7 +508,11 @@ void AObjectTypeHandler::init(const JsonNode & input)
if (!input["rmg"].isNull())
{
rmgInfo.value = static_cast<ui32>(input["rmg"]["value"].Float());
rmgInfo.mapLimit = loadJsonOrMax(input["rmg"]["mapLimit"]);
const JsonNode & mapLimit = input["rmg"]["mapLimit"];
if (!mapLimit.isNull())
rmgInfo.mapLimit.reset(static_cast<ui32>(mapLimit.Float()));
rmgInfo.zoneLimit = loadJsonOrMax(input["rmg"]["zoneLimit"]);
rmgInfo.rarity = static_cast<ui32>(input["rmg"]["rarity"].Float());
} // else block is not needed - set in constructor