1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-15 20:03:15 +02:00

Treasure distance now scales depending on zone size. Should be close to OH3 formula.

This commit is contained in:
DjWarmonger
2014-07-30 13:52:21 +02:00
parent f9245e67e8
commit e5f3a60c9e

View File

@@ -1089,8 +1089,12 @@ bool CRmgTemplateZone::createRequiredObjects(CMapGenerator* gen)
void CRmgTemplateZone::createTreasures(CMapGenerator* gen)
{
//treasure density is proportional to map siz,e but must be scaled bakc to map size
//also, normalize it to zone count - higher count means relative smaller zones
//this is squared distance for optimization purposes
const double minDistance = std::max<float>(200.f / totalDensity, 4);
const double minDistance = std::max<float>((800.f * size * size * gen->getZones().size()) /
(gen->mapGenOptions->getWidth() * gen->mapGenOptions->getHeight() * totalDensity), 2);
//distance lower than 2 causes objects to overlap and crash
do {