Enable some more clang-tidy linter checks (#4738)

* Avoid inefficient AString -> c_str() -> AString round trip

* Avoid redundant string init expressions

* Avoid unnecessary return, continue, etc.

* Add .clang-format to help with clang-tidy fix-its

* Avoid unnecessary passing by value

* Avoid unnecessary local copying

* Avoid copying in range-for loops

* Avoid over-complicated boolean expressions

* Some violations missed by my local clang-tidy

* Allow unnecessary continue statements

* Add brackets

* Another expression missed locally

* Move BindingsProcessor call into clang-tidy.sh and add space

* Fix pushd not found error

* Different grouping of CheckBlockInteractionRate
This commit is contained in:
peterbell10
2020-05-14 22:15:35 +00:00
committed by GitHub
parent edb548f9d6
commit 13144a08e4
100 changed files with 286 additions and 297 deletions
+3 -3
View File
@@ -58,7 +58,7 @@ void cBioGenConstant::InitializeBiomeGen(cIniFile & a_IniFile)
// cBioGenCache:
cBioGenCache::cBioGenCache(cBiomeGenPtr a_BioGenToCache, size_t a_CacheSize) :
m_BioGenToCache(a_BioGenToCache),
m_BioGenToCache(std::move(a_BioGenToCache)),
m_CacheSize(a_CacheSize),
m_NumHits(0),
m_NumMisses(0),
@@ -139,7 +139,7 @@ void cBioGenCache::InitializeBiomeGen(cIniFile & a_IniFile)
////////////////////////////////////////////////////////////////////////////////
// cBioGenMulticache:
cBioGenMulticache::cBioGenMulticache(cBiomeGenPtr a_BioGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches) :
cBioGenMulticache::cBioGenMulticache(const cBiomeGenPtr & a_BioGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches) :
m_NumSubCaches(a_NumSubCaches)
{
m_Caches.reserve(a_NumSubCaches);
@@ -167,7 +167,7 @@ void cBioGenMulticache::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMa
void cBioGenMulticache::InitializeBiomeGen(cIniFile & a_IniFile)
{
for (auto itr : m_Caches)
for (const auto & itr : m_Caches)
{
itr->InitializeBiomeGen(a_IniFile);
}
+1 -1
View File
@@ -97,7 +97,7 @@ public:
This allows us to use shorter cache depths with faster lookups for more covered area. (#381)
a_SubCacheSize defines the size of each sub-cache
a_NumSubCaches defines how many sub-caches are used for the multicache. */
cBioGenMulticache(cBiomeGenPtr a_BioGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches);
cBioGenMulticache(const cBiomeGenPtr & a_BioGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches);
protected:
typedef std::vector<cBiomeGenPtr> cBiomeGenPtrs;
+1 -1
View File
@@ -330,7 +330,7 @@ void cCompoGenNether::InitializeCompoGen(cIniFile & a_IniFile)
// cCompoGenCache:
cCompoGenCache::cCompoGenCache(cTerrainCompositionGenPtr a_Underlying, int a_CacheSize) :
m_Underlying(a_Underlying),
m_Underlying(std::move(a_Underlying)),
m_CacheSize(a_CacheSize),
m_CacheOrder(new int[ToUnsigned(a_CacheSize)]),
m_CacheData(new sCacheData[ToUnsigned(a_CacheSize)]),
+2 -2
View File
@@ -39,8 +39,8 @@
cTerrainCompositionGenPtr cTerrainCompositionGen::CreateCompositionGen(
cIniFile & a_IniFile,
cBiomeGenPtr a_BiomeGen,
cTerrainShapeGenPtr a_ShapeGen,
const cBiomeGenPtr & a_BiomeGen,
const cTerrainShapeGenPtr & a_ShapeGen,
int a_Seed
)
{
+4 -4
View File
@@ -98,7 +98,7 @@ public:
*/
static cTerrainShapeGenPtr CreateShapeGen(
cIniFile & a_IniFile,
cBiomeGenPtr a_BiomeGen,
const cBiomeGenPtr & a_BiomeGen,
int a_Seed,
bool & a_CacheOffByDefault
);
@@ -137,7 +137,7 @@ public:
/** Creates a cTerrainHeightGen descendant based on the INI file settings. */
static cTerrainHeightGenPtr CreateHeightGen(
cIniFile & a_IniFile,
cBiomeGenPtr a_BiomeGen,
const cBiomeGenPtr & a_BiomeGen,
int a_Seed,
bool & a_CacheOffByDefault
);
@@ -169,8 +169,8 @@ public:
a_ShapeGen is the underlying shape generator, some composition generators may depend on it providing additional shape around the chunk. */
static cTerrainCompositionGenPtr CreateCompositionGen(
cIniFile & a_IniFile,
cBiomeGenPtr a_BiomeGen,
cTerrainShapeGenPtr a_ShapeGen,
const cBiomeGenPtr & a_BiomeGen,
const cTerrainShapeGenPtr & a_ShapeGen,
int a_Seed
);
} ;
+3 -3
View File
@@ -21,9 +21,9 @@ class cCompositedHeiGen:
{
public:
cCompositedHeiGen(cBiomeGenPtr a_BiomeGen, cTerrainShapeGenPtr a_ShapeGen, cTerrainCompositionGenPtr a_CompositionGen):
m_BiomeGen(a_BiomeGen),
m_ShapeGen(a_ShapeGen),
m_CompositionGen(a_CompositionGen)
m_BiomeGen(std::move(a_BiomeGen)),
m_ShapeGen(std::move(a_ShapeGen)),
m_CompositionGen(std::move(a_CompositionGen))
{
}
+1 -1
View File
@@ -118,7 +118,7 @@ const cDistortedHeightmap::sGenParam cDistortedHeightmap::m_GenParam[256] =
cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGenPtr a_BiomeGen) :
cDistortedHeightmap::cDistortedHeightmap(int a_Seed, const cBiomeGenPtr & a_BiomeGen) :
m_NoiseDistortX(a_Seed + 1000),
m_NoiseDistortZ(a_Seed + 2000),
m_CurChunkCoords(0x7fffffff, 0x7fffffff), // Set impossible coords for the chunk so that it's always considered stale
+1 -1
View File
@@ -26,7 +26,7 @@ class cDistortedHeightmap :
public cTerrainShapeGen
{
public:
cDistortedHeightmap(int a_Seed, cBiomeGenPtr a_BiomeGen);
cDistortedHeightmap(int a_Seed, const cBiomeGenPtr & a_BiomeGen);
protected:
typedef cChunkDef::BiomeMap BiomeNeighbors[3][3];
+1 -1
View File
@@ -289,7 +289,7 @@ protected:
cDungeonRoomsFinisher::cDungeonRoomsFinisher(cTerrainShapeGenPtr a_ShapeGen, int a_Seed, int a_GridSize, int a_MaxSize, int a_MinSize, const AString & a_HeightDistrib) :
Super(a_Seed + 100, a_GridSize, a_GridSize, a_GridSize, a_GridSize, a_MaxSize, a_MaxSize, 1024),
m_ShapeGen(a_ShapeGen),
m_ShapeGen(std::move(a_ShapeGen)),
m_MaxHalfSize((a_MaxSize + 1) / 2),
m_MinHalfSize((a_MinSize + 1) / 2),
m_HeightProbability(cChunkDef::Height)
+1 -1
View File
@@ -275,7 +275,7 @@ void cFinishGenClumpTopBlock::TryPlaceFoliageClump(cChunkDesc & a_ChunkDesc, int
void cFinishGenClumpTopBlock::ParseConfigurationString(AString a_RawClumpInfo, std::vector<BiomeInfo> & a_Output)
void cFinishGenClumpTopBlock::ParseConfigurationString(const AString & a_RawClumpInfo, std::vector<BiomeInfo> & a_Output)
{
// Initialize the vector for all biomes.
for (int i = static_cast<int>(a_Output.size()); i < static_cast<int>(biMaxVariantBiome); i++)
+2 -2
View File
@@ -104,7 +104,7 @@ public:
BiomeInfo(int a_MinNumClumpsPerChunk, int a_MaxNumClumpsPerChunk, std::vector<FoliageInfo> a_Blocks) :
m_MinNumClumpsPerChunk(a_MinNumClumpsPerChunk),
m_MaxNumClumpsPerChunk(a_MaxNumClumpsPerChunk),
m_Blocks(a_Blocks)
m_Blocks(std::move(a_Blocks))
{}
};
@@ -118,7 +118,7 @@ public:
/** Parses a string and puts a vector with a length of biMaxVariantBiome in a_Output.
The format of the string is "<Biomes separated with a comma>;<Blocks separated with a comma>". This can also be repeated with a | */
static void ParseConfigurationString(AString a_String, std::vector<BiomeInfo> & a_Output);
static void ParseConfigurationString(const AString & a_String, std::vector<BiomeInfo> & a_Output);
/** Parses an inifile in search for all clumps */
static std::vector<BiomeInfo> ParseIniFile(cIniFile & a_IniFile, AString a_ClumpPrefix);
+4 -4
View File
@@ -107,7 +107,7 @@ void cHeiGenFlat::InitializeHeightGen(cIniFile & a_IniFile)
// cHeiGenCache:
cHeiGenCache::cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, size_t a_CacheSize) :
m_HeiGenToCache(a_HeiGenToCache),
m_HeiGenToCache(std::move(a_HeiGenToCache)),
m_CacheSize(a_CacheSize),
m_NumHits(0),
m_NumMisses(0),
@@ -219,7 +219,7 @@ bool cHeiGenCache::GetHeightAt(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_Rel
////////////////////////////////////////////////////////////////////////////////
// cHeiGenMultiCache:
cHeiGenMultiCache::cHeiGenMultiCache(cTerrainHeightGenPtr a_HeiGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches):
cHeiGenMultiCache::cHeiGenMultiCache(const cTerrainHeightGenPtr & a_HeiGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches):
m_NumSubCaches(a_NumSubCaches)
{
// Create the individual sub-caches:
@@ -638,7 +638,7 @@ public:
cHeiGenMinMax(int a_Seed, cBiomeGenPtr a_BiomeGen):
m_Noise(a_Seed),
m_BiomeGen(a_BiomeGen),
m_BiomeGen(std::move(a_BiomeGen)),
m_TotalWeight(0)
{
// Initialize the weights:
@@ -831,7 +831,7 @@ protected:
////////////////////////////////////////////////////////////////////////////////
// cTerrainHeightGen:
cTerrainHeightGenPtr cTerrainHeightGen::CreateHeightGen(cIniFile & a_IniFile, cBiomeGenPtr a_BiomeGen, int a_Seed, bool & a_CacheOffByDefault)
cTerrainHeightGenPtr cTerrainHeightGen::CreateHeightGen(cIniFile & a_IniFile, const cBiomeGenPtr & a_BiomeGen, int a_Seed, bool & a_CacheOffByDefault)
{
AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", "");
if (HeightGenName.empty())
+2 -2
View File
@@ -73,7 +73,7 @@ class cHeiGenMultiCache:
public cTerrainHeightGen
{
public:
cHeiGenMultiCache(cTerrainHeightGenPtr a_HeightGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches);
cHeiGenMultiCache(const cTerrainHeightGenPtr & a_HeightGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches);
// cTerrainHeightGen overrides:
virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap & a_HeightMap) override;
@@ -176,7 +176,7 @@ public:
cHeiGenBiomal(int a_Seed, cBiomeGenPtr a_BiomeGen):
m_Noise(a_Seed),
m_BiomeGen(a_BiomeGen)
m_BiomeGen(std::move(a_BiomeGen))
{
}
+1 -1
View File
@@ -511,7 +511,7 @@ cBiomalNoise3DComposable::cBiomalNoise3DComposable(int a_Seed, cBiomeGenPtr a_Bi
m_DensityNoiseA(a_Seed + 1),
m_DensityNoiseB(a_Seed + 2),
m_BaseNoise(a_Seed + 3),
m_BiomeGen(a_BiomeGen),
m_BiomeGen(std::move(a_BiomeGen)),
m_LastChunkCoords(0x7fffffff, 0x7fffffff) // Set impossible coords for the chunk so that it's always considered stale
{
// Generate the weight distribution for summing up neighboring biomes:
+1 -1
View File
@@ -183,7 +183,7 @@ public:
void SetVerticalStrategy(cVerticalStrategyPtr a_VerticalStrategy)
{
m_VerticalStrategy = a_VerticalStrategy;
m_VerticalStrategy = std::move(a_VerticalStrategy);
}
cVerticalStrategyPtr GetVerticalStrategy(void) const
+3 -3
View File
@@ -23,8 +23,8 @@ public:
cGen(int a_Seed, cBiomeGenPtr a_BiomeGen, cTerrainHeightGenPtr a_HeightGen, int a_SeaLevel, const AString & a_Name):
Super(a_Seed),
m_BiomeGen(a_BiomeGen),
m_HeightGen(a_HeightGen),
m_BiomeGen(std::move(a_BiomeGen)),
m_HeightGen(std::move(a_HeightGen)),
m_SeaLevel(a_SeaLevel),
m_Name(a_Name),
m_MaxDepth(5)
@@ -131,7 +131,7 @@ cPieceStructuresGen::cPieceStructuresGen(int a_Seed):
bool cPieceStructuresGen::Initialize(const AString & a_Prefabs, int a_SeaLevel, cBiomeGenPtr a_BiomeGen, cTerrainHeightGenPtr a_HeightGen)
bool cPieceStructuresGen::Initialize(const AString & a_Prefabs, int a_SeaLevel, const cBiomeGenPtr & a_BiomeGen, const cTerrainHeightGenPtr & a_HeightGen)
{
// Load each piecepool:
auto structures = StringSplitAndTrim(a_Prefabs, "|");
+1 -1
View File
@@ -34,7 +34,7 @@ public:
a_Prefabs contains the list of prefab sets that should be activated, "|"-separated.
All problems are logged to the console and the generator skips over them.
Returns true if at least one prefab set is valid (the generator should be kept). */
bool Initialize(const AString & a_Prefabs, int a_SeaLevel, cBiomeGenPtr a_BiomeGen, cTerrainHeightGenPtr a_HeightGen);
bool Initialize(const AString & a_Prefabs, int a_SeaLevel, const cBiomeGenPtr & a_BiomeGen, const cTerrainHeightGenPtr & a_HeightGen);
// cFinishGen override:
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
+1 -1
View File
@@ -19,7 +19,7 @@ cPrefabStructure::cPrefabStructure(
):
Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Pieces(std::move(a_Pieces)),
m_HeightGen(a_HeightGen)
m_HeightGen(std::move(a_HeightGen))
{
}
+25 -25
View File
@@ -198,7 +198,7 @@ public:
cProtIntGenZoom(int a_Seed, Underlying a_UnderlyingGen):
Super(a_Seed),
m_UnderlyingGen(a_UnderlyingGen)
m_UnderlyingGen(std::move(a_UnderlyingGen))
{
}
@@ -269,7 +269,7 @@ public:
cProtIntGenSmooth(int a_Seed, Underlying a_Underlying):
Super(a_Seed),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -342,7 +342,7 @@ class cProtIntGenAvgValues:
public:
cProtIntGenAvgValues(Underlying a_Underlying):
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -387,7 +387,7 @@ class cProtIntGenAvg4Values:
public:
cProtIntGenAvg4Values(Underlying a_Underlying):
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -438,7 +438,7 @@ class cProtIntGenWeightAvg:
public:
cProtIntGenWeightAvg(Underlying a_Underlying):
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -490,7 +490,7 @@ public:
m_ChancePct(a_ChancePct),
m_Min(a_Min),
m_Range(a_Range),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -537,7 +537,7 @@ public:
Super(a_Seed),
m_Range(a_HalfRange * 2 + 1),
m_HalfRange(a_HalfRange),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -580,7 +580,7 @@ public:
cProtIntGenRndAvg(int a_Seed, int a_AvgChancePct, Underlying a_Underlying):
Super(a_Seed),
m_AvgChancePct(a_AvgChancePct),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -638,7 +638,7 @@ public:
cProtIntGenRndBetween(int a_Seed, int a_AvgChancePct, Underlying a_Underlying):
Super(a_Seed),
m_AvgChancePct(a_AvgChancePct),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -693,7 +693,7 @@ class cProtIntGenBeaches:
public:
cProtIntGenBeaches(Underlying a_Underlying):
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -798,7 +798,7 @@ public:
cProtIntGenAddIslands(int a_Seed, int a_Chance, Underlying a_Underlying):
Super(a_Seed),
m_Chance(a_Chance),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -842,7 +842,7 @@ class cProtIntGenBiomeGroupEdges:
public:
cProtIntGenBiomeGroupEdges(Underlying a_Underlying):
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -941,7 +941,7 @@ public:
cProtIntGenBiomes(int a_Seed, Underlying a_Underlying):
Super(a_Seed),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -1072,7 +1072,7 @@ public:
m_From(a_From),
m_To(a_To),
m_Chance(a_Chance),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -1131,8 +1131,8 @@ class cProtIntGenMixRivers:
public:
cProtIntGenMixRivers(Underlying a_Biomes, Underlying a_Rivers):
m_Biomes(a_Biomes),
m_Rivers(a_Rivers)
m_Biomes(std::move(a_Biomes)),
m_Rivers(std::move(a_Rivers))
{
}
@@ -1197,7 +1197,7 @@ public:
cProtIntGenRiver(int a_Seed, Underlying a_Underlying):
Super(a_Seed),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -1256,7 +1256,7 @@ public:
Super(a_Seed),
m_Chance(a_Chance),
m_ToValue(a_ToValue),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -1347,7 +1347,7 @@ public:
Super(a_Seed),
m_Chance(a_Chance),
m_ToValue(a_ToValue),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -1396,7 +1396,7 @@ public:
cProtIntGenRareBiomeGroups(int a_Seed, int a_Chance, Underlying a_Underlying):
Super(a_Seed),
m_Chance(a_Chance),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -1444,8 +1444,8 @@ public:
cProtIntGenAlternateBiomes(int a_Seed, Underlying a_Alterations, Underlying a_BaseBiomes):
Super(a_Seed),
m_Alterations(a_Alterations),
m_BaseBiomes(a_BaseBiomes)
m_Alterations(std::move(a_Alterations)),
m_BaseBiomes(std::move(a_BaseBiomes))
{
}
@@ -1510,7 +1510,7 @@ public:
cProtIntGenBiomeEdges(int a_Seed, Underlying a_Underlying):
Super(a_Seed),
m_Underlying(a_Underlying)
m_Underlying(std::move(a_Underlying))
{
}
@@ -1670,8 +1670,8 @@ public:
cProtIntGenMBiomes(int a_Seed, Underlying a_Alteration, Underlying a_Underlying):
Super(a_Seed),
m_Underlying(a_Underlying),
m_Alteration(a_Alteration)
m_Underlying(std::move(a_Underlying)),
m_Alteration(std::move(a_Alteration))
{
}
+2 -2
View File
@@ -24,7 +24,7 @@ class cTerrainHeightToShapeGen:
{
public:
cTerrainHeightToShapeGen(cTerrainHeightGenPtr a_HeightGen):
m_HeightGen(a_HeightGen)
m_HeightGen(std::move(a_HeightGen))
{
}
@@ -77,7 +77,7 @@ typedef std::shared_ptr<cTerrainHeightToShapeGen> cTerrainHeightToShapeGenPtr;
cTerrainShapeGenPtr cTerrainShapeGen::CreateShapeGen(
cIniFile & a_IniFile,
cBiomeGenPtr a_BiomeGen,
const cBiomeGenPtr & a_BiomeGen,
int a_Seed,
bool & a_CacheOffByDefault
)
+4 -4
View File
@@ -25,9 +25,9 @@ public:
cStructGenTrees(int a_Seed, cBiomeGenPtr a_BiomeGen, cTerrainShapeGenPtr a_ShapeGen, cTerrainCompositionGenPtr a_CompositionGen) :
m_Seed(a_Seed),
m_Noise(a_Seed),
m_BiomeGen(a_BiomeGen),
m_ShapeGen(a_ShapeGen),
m_CompositionGen(a_CompositionGen)
m_BiomeGen(std::move(a_BiomeGen)),
m_ShapeGen(std::move(a_ShapeGen)),
m_CompositionGen(std::move(a_CompositionGen))
{}
protected:
@@ -82,7 +82,7 @@ public:
m_Noise(a_Seed),
m_Seed(a_Seed),
m_Fluid(a_Fluid),
m_ShapeGen(a_ShapeGen),
m_ShapeGen(std::move(a_ShapeGen)),
m_Probability(a_Probability)
{
}
+1 -1
View File
@@ -615,7 +615,7 @@ void GetAcaciaTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, sSetBl
a_OtherBlocks.push_back(sSetBlock(BranchPos.x, BranchPos.y + 1, BranchPos.z, E_BLOCK_NEW_LEAVES, E_META_NEWLEAVES_ACACIA));
// Choose if we have to add another branch
bool TwoTop = (a_Noise.IntNoise3D(a_BlockPos) < 0 ? true : false);
bool TwoTop = (a_Noise.IntNoise3D(a_BlockPos) < 0);
if (!TwoTop)
{
return;
+2 -2
View File
@@ -21,7 +21,7 @@ class cTwoHeights:
public:
cTwoHeights(int a_Seed, cBiomeGenPtr a_BiomeGen):
cTwoHeights(int a_Seed, const cBiomeGenPtr & a_BiomeGen):
m_Seed(a_Seed),
m_Choice(a_Seed),
m_HeightA(a_Seed + 1, a_BiomeGen),
@@ -113,7 +113,7 @@ protected:
cTerrainShapeGenPtr CreateShapeGenTwoHeights(int a_Seed, cBiomeGenPtr a_BiomeGen)
cTerrainShapeGenPtr CreateShapeGenTwoHeights(int a_Seed, const cBiomeGenPtr & a_BiomeGen)
{
return std::make_shared<cTwoHeights>(a_Seed, a_BiomeGen);
}
+1 -1
View File
@@ -16,7 +16,7 @@
/** Creates and returns a new instance of the cTwoHeights terrain shape generator.
The instance must be Initialize()-d before it is used. */
extern cTerrainShapeGenPtr CreateShapeGenTwoHeights(int a_Seed, cBiomeGenPtr a_BiomeGen);
extern cTerrainShapeGenPtr CreateShapeGenTwoHeights(int a_Seed, const cBiomeGenPtr & a_BiomeGen);
+3 -3
View File
@@ -137,7 +137,7 @@ public:
{a_OriginX + a_MaxSize, cChunkDef::Height - 1, a_OriginZ + a_MaxSize}
),
m_Prefabs(a_Prefabs),
m_HeightGen(a_HeightGen)
m_HeightGen(std::move(a_HeightGen))
{
// Generate the pieces for this village; don't care about the Y coord:
cPieceGeneratorBFSTree pg(*this, a_Seed);
@@ -348,8 +348,8 @@ cVillageGen::cVillageGen(
m_MaxSize(a_MaxSize),
m_MinDensity(a_MinDensity),
m_MaxDensity(a_MaxDensity),
m_BiomeGen(a_BiomeGen),
m_HeightGen(a_HeightGen)
m_BiomeGen(std::move(a_BiomeGen)),
m_HeightGen(std::move(a_HeightGen))
{
for (const auto & toLoad: a_PrefabsToLoad)
{