From 37463a3e455727af0dda8e65c3bba3590b014f6e Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Sun, 1 Jun 2014 21:01:18 +0200 Subject: [PATCH] Zone position will be moved to its center of mass. --- lib/rmg/CRmgTemplateZone.cpp | 2 +- lib/rmg/CZonePlacer.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/rmg/CRmgTemplateZone.cpp b/lib/rmg/CRmgTemplateZone.cpp index 4259ea93a..e33fe74d1 100644 --- a/lib/rmg/CRmgTemplateZone.cpp +++ b/lib/rmg/CRmgTemplateZone.cpp @@ -512,7 +512,7 @@ bool CRmgTemplateZone::fill(CMapGenerator* gen) placeObject(gen, obj.first, pos); if (obj.second) { - guardObject (gen, obj.first, obj.second); //FIXME: set apriopriate guard strength + guardObject (gen, obj.first, obj.second); } } std::vector guarded_objects; diff --git a/lib/rmg/CZonePlacer.cpp b/lib/rmg/CZonePlacer.cpp index 3785f58d3..86a8fd072 100644 --- a/lib/rmg/CZonePlacer.cpp +++ b/lib/rmg/CZonePlacer.cpp @@ -220,5 +220,17 @@ void CZonePlacer::assignZones(shared_ptr mapGenOptions) } } } + //set position to center of mass + for (auto zone : zones) + { + int3 total(0,0,0); + auto tiles = zone.second->getTileInfo(); + for (auto tile : tiles) + { + total += tile; + } + int size = tiles.size(); + zone.second->setPos (int3(total.x/size, total.y/size, total.z/size)); + } logGlobal->infoStream() << "Finished zone colouring"; }