1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Zone position will be moved to its center of mass.

This commit is contained in:
DjWarmonger 2014-06-01 21:01:18 +02:00
parent 7f31b7dddb
commit 37463a3e45
2 changed files with 13 additions and 1 deletions

View File

@ -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<CGObjectInstance*> guarded_objects;

View File

@ -220,5 +220,17 @@ void CZonePlacer::assignZones(shared_ptr<CMapGenOptions> 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";
}