Przeglądaj źródła

Zone position will be moved to its center of mass.

DjWarmonger 11 lat temu
rodzic
commit
37463a3e45
2 zmienionych plików z 13 dodań i 1 usunięć
  1. 1 1
      lib/rmg/CRmgTemplateZone.cpp
  2. 12 0
      lib/rmg/CZonePlacer.cpp

+ 1 - 1
lib/rmg/CRmgTemplateZone.cpp

@@ -512,7 +512,7 @@ bool CRmgTemplateZone::fill(CMapGenerator* gen)
 		placeObject(gen, obj.first, pos);
 		placeObject(gen, obj.first, pos);
 		if (obj.second)
 		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;
 	std::vector<CGObjectInstance*> guarded_objects;

+ 12 - 0
lib/rmg/CZonePlacer.cpp

@@ -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";
 	logGlobal->infoStream() << "Finished zone colouring";
 }
 }