浏览代码

Randomized shapes for treasure piles.

DjWarmonger 11 年之前
父节点
当前提交
f8359b4eb5
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      lib/rmg/CRmgTemplateZone.cpp

+ 5 - 1
lib/rmg/CRmgTemplateZone.cpp

@@ -741,7 +741,11 @@ bool CRmgTemplateZone::createTreasurePile (CMapGenerator* gen, int3 &pos)
 			//now find place for next object
 			int3 placeFound(-1,-1,-1);
 
-			for (auto tile : boundary)
+			//randomize next position from among possible ones
+			std::vector<int3> boundaryCopy (boundary.begin(), boundary.end());
+			RandomGeneratorUtil::randomShuffle(boundaryCopy, gen->rand);
+
+			for (auto tile : boundaryCopy)
 			{
 				if (gen->isPossible(tile)) //we can place new treasure only on possible tile
 				{