mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Optimization for random treasures.
This commit is contained in:
parent
17f3f94ca6
commit
01390e0c2c
@ -1304,6 +1304,12 @@ void CRmgTemplateZone::createTreasures(CMapGenerator* gen)
|
||||
int totalDensity = 0;
|
||||
for (auto t : treasureInfo)
|
||||
{
|
||||
//discard objects with too high value to be ever placed
|
||||
vstd::erase_if(possibleObjects, [t](const ObjectInfo& oi) -> bool
|
||||
{
|
||||
return oi.value > t.max;
|
||||
});
|
||||
|
||||
totalDensity += t.density;
|
||||
|
||||
//treasure density is inversely proportional to zone size but must be scaled back to map size
|
||||
|
Loading…
x
Reference in New Issue
Block a user