void cPrefabPiecePool::AssignGens(int a_Seed, cBiomeGenPtr & a_BiomeGen, cTerrainHeightGenPtr & a_HeightGen, int a_SeaLevel) { // Assign the generator linkage to all starting pieces' VerticalStrategies: for (auto & piece: m_StartingPieces) { auto verticalStrategy = piece->GetVerticalStrategy(); if (verticalStrategy != nullptr) { verticalStrategy->AssignGens(a_Seed, a_BiomeGen, a_HeightGen, a_SeaLevel); } } // for piece - m_StartingPieces[] // Assign the generator linkage to all pieces' VerticalLimits: for (auto & piece: m_AllPieces) { auto verticalLimit = piece->GetVerticalLimit(); if (verticalLimit != nullptr) { verticalLimit->AssignGens(a_Seed, a_BiomeGen, a_HeightGen, a_SeaLevel); } } // for piece - m_AllPieces[] }
cVillageGen::cVillageGen( int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxDepth, int a_MaxSize, int a_MinDensity, int a_MaxDensity, cBiomeGenPtr a_BiomeGen, cTerrainHeightGenPtr a_HeightGen, int a_SeaLevel, const AStringVector & a_PrefabsToLoad ) : super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 100), m_Noise(a_Seed + 1000), m_MaxDepth(a_MaxDepth), m_MaxSize(a_MaxSize), m_MinDensity(a_MinDensity), m_MaxDensity(a_MaxDensity), m_BiomeGen(a_BiomeGen), m_HeightGen(a_HeightGen) { for (const auto & toLoad: a_PrefabsToLoad) { auto prefabs = std::make_shared<cVillagePiecePool>(); auto fileName = Printf("Prefabs%sVillages%s%s.cubeset", cFile::GetPathSeparator().c_str(), cFile::GetPathSeparator().c_str(), toLoad.c_str()); if (prefabs->LoadFromFile(fileName, true)) { if (NoCaseCompare(prefabs->GetIntendedUse(), "village") != 0) { LOGWARNING("Village generator: File %s is intended for use in \"%s\", rather than villages. Loading the file, but the generator may behave unexpectedly.", fileName.c_str(), prefabs->GetIntendedUse().c_str() ); } prefabs->AssignGens(a_Seed, m_BiomeGen, m_HeightGen, a_SeaLevel); m_Pools.push_back(std::move(prefabs)); } } }