1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Skip objects with value too low to be placed in the zone.

This commit is contained in:
Tomasz Zieliński
2023-03-27 17:29:46 +02:00
parent 511a42f9b9
commit b3a457c71a
4 changed files with 23 additions and 7 deletions

View File

@ -59,21 +59,18 @@ void ObjectDistributor::distributeLimitedObjects()
//Skip objects which don't have global per-map limit here
if (rmgInfo.mapLimit)
{
//Count all zones where this object can be placed
std::vector<std::shared_ptr<Zone>> matchingZones;
//TODO: Are all terrains initialized at this point? Including water?
for (const auto& it : zones)
{
if (!handler->getTemplates(it.second->getTerrainType()).empty())
if (!handler->getTemplates(it.second->getTerrainType()).empty() &&
rmgInfo.value <= it.second->getMaxTreasureValue())
{
matchingZones.push_back(it.second);
}
}
//TODO: Also check if the object value is within zone max value
size_t numZones = matchingZones.size();
if (!numZones)
continue;