From e5f3a60c9e5753328d8772fb2666db0515b17dc2 Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Wed, 30 Jul 2014 13:52:21 +0200 Subject: [PATCH] Treasure distance now scales depending on zone size. Should be close to OH3 formula. --- lib/rmg/CRmgTemplateZone.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/rmg/CRmgTemplateZone.cpp b/lib/rmg/CRmgTemplateZone.cpp index d0205ceb1..6f058f456 100644 --- a/lib/rmg/CRmgTemplateZone.cpp +++ b/lib/rmg/CRmgTemplateZone.cpp @@ -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(200.f / totalDensity, 4); + const double minDistance = std::max((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 {