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

Treasure piles will prefer to grow upwards to make space for object accessible from bottom.

This commit is contained in:
DjWarmonger 2014-11-22 14:17:53 +01:00
parent 91d89add7c
commit 9e5cc2d1b1

View File

@ -787,7 +787,12 @@ bool CRmgTemplateZone::createTreasurePile (CMapGenerator* gen, int3 &pos, float
//randomize next position from among possible ones
std::vector<int3> boundaryCopy (boundary.begin(), boundary.end());
RandomGeneratorUtil::randomShuffle(boundaryCopy, gen->rand);
//RandomGeneratorUtil::randomShuffle(boundaryCopy, gen->rand);
auto chooseTopTile = [](const int3 & lhs, const int3 & rhs) -> bool
{
return lhs.y < rhs.y;
};
boost::sort(boundaryCopy, chooseTopTile); //start from top tiles to allow objects accessible from bottom
for (auto tile : boundaryCopy)
{