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:
parent
7f31b7dddb
commit
37463a3e45
@ -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;
|
||||
|
@ -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";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user