1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

- Implemented map object limit which should also distribute the objects evenly

- Fixed Magic Well limit of 1 per zone
This commit is contained in:
DjWarmonger 2014-07-23 18:02:17 +02:00
parent 8471d32334
commit 1cabc8f7f4
2 changed files with 8 additions and 3 deletions

View File

@ -401,6 +401,7 @@
"object" : { "object" : {
"index" : 0, "index" : 0,
"rmg" : { "rmg" : {
"zoneLimit" : 1,
"value" : 250, "value" : 250,
"rarity" : 100 "rarity" : 100
} }

View File

@ -1606,6 +1606,8 @@ void CRmgTemplateZone::addAllPossibleObjects (CMapGenerator* gen)
ObjectInfo oi; ObjectInfo oi;
oi.maxPerMap = std::numeric_limits<ui32>().max(); oi.maxPerMap = std::numeric_limits<ui32>().max();
int numZones = gen->getZones().size();
for (auto primaryID : VLC->objtypeh->knownObjects()) for (auto primaryID : VLC->objtypeh->knownObjects())
{ {
for (auto secondaryID : VLC->objtypeh->knownSubObjects(primaryID)) for (auto secondaryID : VLC->objtypeh->knownSubObjects(primaryID))
@ -1621,10 +1623,12 @@ void CRmgTemplateZone::addAllPossibleObjects (CMapGenerator* gen)
{ {
return VLC->objtypeh->getHandlerFor(temp.id, temp.subid)->create(temp); return VLC->objtypeh->getHandlerFor(temp.id, temp.subid)->create(temp);
}; };
oi.value = handler->getRMGInfo().value; auto rmgInfo = handler->getRMGInfo();
oi.probability = handler->getRMGInfo().rarity; oi.value = rmgInfo.value;
oi.probability = rmgInfo.rarity;
oi.templ = temp; oi.templ = temp;
oi.maxPerZone = handler->getRMGInfo().zoneLimit; oi.maxPerZone = rmgInfo.zoneLimit;
vstd::amin (oi.maxPerZone, rmgInfo.mapLimit / numZones); //simple, but should distribute objects evenly on large maps
possibleObjects.push_back (oi); possibleObjects.push_back (oi);
} }
} }