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:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user