mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +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;
|
int totalDensity = 0;
|
||||||
for (auto t : treasureInfo)
|
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;
|
totalDensity += t.density;
|
||||||
|
|
||||||
//treasure density is inversely proportional to zone size but must be scaled back to map size
|
//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