summaryrefslogtreecommitdiffstats
path: root/src/Generating
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-13 18:38:06 +0200
committerAlexander Harkness <me@bearbin.net>2020-04-16 22:07:48 +0200
commit9ee47e59995f858ec531b3ee467f131594e4ba1f (patch)
treef005d8af4a0362d7eab8a96a71aca0d73275f8e1 /src/Generating
parentPrevent crash when breeding (diff)
downloadcuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar.gz
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar.bz2
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar.lz
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar.xz
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.tar.zst
cuberite-9ee47e59995f858ec531b3ee467f131594e4ba1f.zip
Diffstat (limited to 'src/Generating')
-rw-r--r--src/Generating/BioGen.cpp8
-rw-r--r--src/Generating/BioGen.h42
-rw-r--r--src/Generating/Caves.cpp7
-rw-r--r--src/Generating/Caves.h9
-rw-r--r--src/Generating/ComposableGenerator.h5
-rw-r--r--src/Generating/DungeonRoomsFinisher.cpp10
-rw-r--r--src/Generating/DungeonRoomsFinisher.h5
-rw-r--r--src/Generating/FinishGen.h11
-rw-r--r--src/Generating/GridStructGen.cpp7
-rw-r--r--src/Generating/HeiGen.cpp3
-rw-r--r--src/Generating/HeiGen.h7
-rw-r--r--src/Generating/IntGen.h235
-rw-r--r--src/Generating/MineShafts.cpp45
-rw-r--r--src/Generating/MineShafts.h2
-rw-r--r--src/Generating/Noise3DGenerator.h5
-rw-r--r--src/Generating/PieceStructuresGen.cpp3
-rw-r--r--src/Generating/PieceStructuresGen.h5
-rw-r--r--src/Generating/PrefabStructure.h3
-rw-r--r--src/Generating/ProtIntGen.h225
-rw-r--r--src/Generating/Ravines.cpp10
-rw-r--r--src/Generating/Ravines.h7
-rw-r--r--src/Generating/RoughRavines.cpp13
-rw-r--r--src/Generating/RoughRavines.h5
-rw-r--r--src/Generating/TwoHeights.cpp4
-rw-r--r--src/Generating/VillageGen.cpp21
-rw-r--r--src/Generating/VillageGen.h6
26 files changed, 394 insertions, 309 deletions
diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp
index c84cb559d..f6122244b 100644
--- a/src/Generating/BioGen.cpp
+++ b/src/Generating/BioGen.cpp
@@ -129,7 +129,7 @@ void cBioGenCache::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a
void cBioGenCache::InitializeBiomeGen(cIniFile & a_IniFile)
{
- super::InitializeBiomeGen(a_IniFile);
+ Super::InitializeBiomeGen(a_IniFile);
m_BioGenToCache->InitializeBiomeGen(a_IniFile);
}
@@ -280,7 +280,7 @@ void cBioGenCheckerboard::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::Biome
void cBioGenCheckerboard::InitializeBiomeGen(cIniFile & a_IniFile)
{
- super::InitializeBiomeGen(a_IniFile);
+ Super::InitializeBiomeGen(a_IniFile);
AString Biomes = a_IniFile.GetValueSet ("Generator", "CheckerBoardBiomes", "");
m_BiomeSize = a_IniFile.GetValueSetI("Generator", "CheckerboardBiomeSize", 64);
m_BiomeSize = (m_BiomeSize < 8) ? 8 : m_BiomeSize;
@@ -315,7 +315,7 @@ void cBioGenVoronoi::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap &
void cBioGenVoronoi::InitializeBiomeGen(cIniFile & a_IniFile)
{
- super::InitializeBiomeGen(a_IniFile);
+ Super::InitializeBiomeGen(a_IniFile);
int CellSize = a_IniFile.GetValueSetI("Generator", "VoronoiCellSize", 128);
int JitterSize = a_IniFile.GetValueSetI("Generator", "VoronoiJitterSize", CellSize);
int OddRowOffset = a_IniFile.GetValueSetI("Generator", "VoronoiOddRowOffset", 0);
@@ -364,7 +364,7 @@ void cBioGenDistortedVoronoi::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::B
void cBioGenDistortedVoronoi::InitializeBiomeGen(cIniFile & a_IniFile)
{
- super::InitializeBiomeGen(a_IniFile);
+ Super::InitializeBiomeGen(a_IniFile);
m_CellSize = a_IniFile.GetValueSetI("Generator", "DistortedVoronoiCellSize", 96);
m_Voronoi.SetCellSize(m_CellSize);
InitializeBiomes(a_IniFile.GetValueSet("Generator", "DistortedVoronoiBiomes", ""));
diff --git a/src/Generating/BioGen.h b/src/Generating/BioGen.h
index c20babde0..ee297adb2 100644
--- a/src/Generating/BioGen.h
+++ b/src/Generating/BioGen.h
@@ -42,10 +42,10 @@ protected:
/** A simple cache that stores N most recently generated chunks' biomes; N being settable upon creation */
-class cBioGenCache :
+class cBioGenCache:
public cBiomeGen
{
- typedef cBiomeGen super;
+ using Super = cBiomeGen;
public:
@@ -87,11 +87,10 @@ protected:
-class cBioGenMulticache :
+class cBioGenMulticache:
public cBiomeGen
{
-
- typedef cBiomeGen super;
+ using Super = cBiomeGen;
public:
/* Creates a new multicache - a cache that divides the caching into several sub-caches based on the chunk coords.
@@ -120,12 +119,13 @@ protected:
/** Base class for generators that use a list of available biomes. This class takes care of the list. */
-class cBiomeGenList :
+class cBiomeGenList:
public cBiomeGen
{
- typedef cBiomeGen super;
+ using Super = cBiomeGen;
protected:
+
// List of biomes that the generator is allowed to generate:
typedef std::vector<EMCSBiome> EMCSBiomes;
EMCSBiomes m_Biomes;
@@ -139,12 +139,13 @@ protected:
-class cBioGenCheckerboard :
+class cBioGenCheckerboard:
public cBiomeGenList
{
- typedef cBiomeGenList super;
+ using Super = cBiomeGenList;
protected:
+
int m_BiomeSize;
// cBiomeGen overrides:
@@ -156,18 +157,20 @@ protected:
-class cBioGenVoronoi :
+class cBioGenVoronoi:
public cBiomeGenList
{
- typedef cBiomeGenList super;
+ using Super = cBiomeGenList;
public:
+
cBioGenVoronoi(int a_Seed) :
m_Voronoi(a_Seed)
{
}
protected:
+
cVoronoiMap m_Voronoi;
// cBiomeGen overrides:
@@ -181,13 +184,14 @@ protected:
-class cBioGenDistortedVoronoi :
+class cBioGenDistortedVoronoi:
public cBiomeGenList
{
- typedef cBiomeGenList super;
+ using Super = cBiomeGenList;
public:
- cBioGenDistortedVoronoi(int a_Seed) :
+
+ cBioGenDistortedVoronoi(int a_Seed):
m_Noise(a_Seed),
m_Voronoi(a_Seed),
m_CellSize(0)
@@ -216,12 +220,13 @@ protected:
-class cBioGenMultiStepMap :
+class cBioGenMultiStepMap:
public cBiomeGen
{
- typedef cBiomeGen super;
+ using Super = cBiomeGen;
public:
+
cBioGenMultiStepMap(int a_Seed);
protected:
@@ -276,12 +281,13 @@ protected:
-class cBioGenTwoLevel :
+class cBioGenTwoLevel:
public cBiomeGen
{
- typedef cBiomeGen super;
+ using Super = cBiomeGen;
public:
+
cBioGenTwoLevel(int a_Seed);
protected:
diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp
index 193c75554..0d22d5b96 100644
--- a/src/Generating/Caves.cpp
+++ b/src/Generating/Caves.cpp
@@ -117,12 +117,13 @@ typedef std::vector<cCaveTunnel *> cCaveTunnels;
/** A collection of connected tunnels, possibly branching. */
-class cStructGenWormNestCaves::cCaveSystem :
+class cStructGenWormNestCaves::cCaveSystem:
public cGridStructGen::cStructure
{
- typedef cGridStructGen::cStructure super;
+ using Super = cGridStructGen::cStructure;
public:
+
// The generating block position; is read directly in cStructGenWormNestCaves::GetCavesForChunk()
int m_BlockX;
int m_BlockZ;
@@ -577,7 +578,7 @@ AString cCaveTunnel::ExportAsSVG(int a_Color, int a_OffsetX, int a_OffsetZ) cons
// cStructGenWormNestCaves::cCaveSystem:
cStructGenWormNestCaves::cCaveSystem::cCaveSystem(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_MaxOffset, int a_Size, cNoise & a_Noise) :
- super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
+ Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Size(a_Size)
{
int Num = 1 + a_Noise.IntNoise2DInt(a_OriginX, a_OriginZ) % 3;
diff --git a/src/Generating/Caves.h b/src/Generating/Caves.h
index cf47d9a92..82545b4e0 100644
--- a/src/Generating/Caves.h
+++ b/src/Generating/Caves.h
@@ -62,13 +62,15 @@ protected:
-class cStructGenWormNestCaves :
+class cStructGenWormNestCaves:
public cGridStructGen
{
- typedef cGridStructGen super;
+ using Super = cGridStructGen;
+
public:
+
cStructGenWormNestCaves(int a_Seed, int a_Size = 64, int a_Grid = 96, int a_MaxOffset = 128) :
- super(a_Seed, a_Grid, a_Grid, a_MaxOffset, a_MaxOffset, a_Size, a_Size, 100),
+ Super(a_Seed, a_Grid, a_Grid, a_MaxOffset, a_MaxOffset, a_Size, a_Size, 100),
m_Size(a_Size),
m_MaxOffset(a_MaxOffset),
m_Grid(a_Grid)
@@ -76,6 +78,7 @@ public:
}
protected:
+
class cCaveSystem; // fwd: Caves.cpp
int m_Size; // relative size of the cave systems' caves. Average number of blocks of each initial tunnel
diff --git a/src/Generating/ComposableGenerator.h b/src/Generating/ComposableGenerator.h
index 9c643847c..f0960f1d3 100644
--- a/src/Generating/ComposableGenerator.h
+++ b/src/Generating/ComposableGenerator.h
@@ -200,12 +200,13 @@ typedef std::list<cFinishGenPtr> cFinishGenList;
-class cComposableGenerator :
+class cComposableGenerator:
public cChunkGenerator
{
- typedef cChunkGenerator Super;
+ using Super = cChunkGenerator;
public:
+
cComposableGenerator();
// cChunkGenerator::cGenerator overrides:
diff --git a/src/Generating/DungeonRoomsFinisher.cpp b/src/Generating/DungeonRoomsFinisher.cpp
index c595a6451..4299f71a7 100644
--- a/src/Generating/DungeonRoomsFinisher.cpp
+++ b/src/Generating/DungeonRoomsFinisher.cpp
@@ -24,10 +24,10 @@ static const int ROOM_HEIGHT = 4;
////////////////////////////////////////////////////////////////////////////////
// cDungeonRoom:
-class cDungeonRoom :
+class cDungeonRoom:
public cGridStructGen::cStructure
{
- typedef cGridStructGen::cStructure super;
+ using Super = cGridStructGen::cStructure;
public:
@@ -37,8 +37,8 @@ public:
int a_HalfSizeX, int a_HalfSizeZ,
int a_FloorHeight,
cNoise & a_Noise
- ) :
- super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
+ ):
+ Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_StartX(a_OriginX - a_HalfSizeX),
m_EndX(a_OriginX + a_HalfSizeX),
m_StartZ(a_OriginZ - a_HalfSizeZ),
@@ -288,7 +288,7 @@ protected:
// cDungeonRoomsFinisher:
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),
+ Super(a_Seed + 100, a_GridSize, a_GridSize, a_GridSize, a_GridSize, a_MaxSize, a_MaxSize, 1024),
m_ShapeGen(a_ShapeGen),
m_MaxHalfSize((a_MaxSize + 1) / 2),
m_MinHalfSize((a_MinSize + 1) / 2),
diff --git a/src/Generating/DungeonRoomsFinisher.h b/src/Generating/DungeonRoomsFinisher.h
index e5828f989..72ac5cb51 100644
--- a/src/Generating/DungeonRoomsFinisher.h
+++ b/src/Generating/DungeonRoomsFinisher.h
@@ -16,12 +16,13 @@
-class cDungeonRoomsFinisher :
+class cDungeonRoomsFinisher:
public cGridStructGen
{
- typedef cGridStructGen super;
+ using Super = cGridStructGen;
public:
+
/** Creates a new dungeon room finisher.
a_ShapeGen is the underlying terrain shape generator, so that the rooms can always be placed under the terrain.
a_MaxSize and a_MinSize are the maximum and minimum sizes of the room's internal (air) area, in blocks across.
diff --git a/src/Generating/FinishGen.h b/src/Generating/FinishGen.h
index b6edce84f..4dfd35a7c 100644
--- a/src/Generating/FinishGen.h
+++ b/src/Generating/FinishGen.h
@@ -487,9 +487,10 @@ Note that this class uses the "Nest" terminology for individual packs of ore, it
class cFinishGenOres:
public cFinishGen
{
- typedef cFinishGen Super;
+ using Super = cFinishGen;
public:
+
struct OreInfo
{
BLOCKTYPE m_BlockType; // The type of the nest.
@@ -574,12 +575,13 @@ protected:
-class cFinishGenOreNests :
+class cFinishGenOreNests:
public cFinishGenOres
{
- typedef cFinishGenOres Super;
+ using Super = cFinishGenOres;
public:
+
cFinishGenOreNests(int a_Seed, const OreInfos & a_OreInfos):
Super(a_Seed, a_OreInfos)
{}
@@ -602,9 +604,10 @@ protected:
class cFinishGenOrePockets:
public cFinishGenOres
{
- typedef cFinishGenOres Super;
+ using Super = cFinishGenOres;
public:
+
cFinishGenOrePockets(int a_Seed, const OreInfos & a_OreInfos):
Super(a_Seed, a_OreInfos)
{}
diff --git a/src/Generating/GridStructGen.cpp b/src/Generating/GridStructGen.cpp
index 83a98706f..4a565f220 100644
--- a/src/Generating/GridStructGen.cpp
+++ b/src/Generating/GridStructGen.cpp
@@ -16,14 +16,15 @@
/** A cStructure descendant representing an empty structure.
Used when the generator descended from cGridStructGen doesn't return any structure, to keep at least the
Origin coords so that the structure isn't queried over and over again. */
-class cEmptyStructure :
+class cEmptyStructure:
public cGridStructGen::cStructure
{
- typedef cGridStructGen::cStructure super;
+ using Super = cGridStructGen::cStructure;
public:
+
cEmptyStructure(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ) :
- super(a_GridX, a_GridZ, a_OriginX, a_OriginZ)
+ Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ)
{
}
diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp
index 16b7c826b..515fdf4ba 100644
--- a/src/Generating/HeiGen.cpp
+++ b/src/Generating/HeiGen.cpp
@@ -629,12 +629,13 @@ NOISE_DATATYPE cHeiGenBiomal::GetHeightAt(int a_RelX, int a_RelZ, int a_ChunkX,
class cHeiGenMinMax:
public cTerrainHeightGen
{
- typedef cTerrainHeightGen Super;
+ using Super = cTerrainHeightGen;
/** Size of the averaging process, in columns (for each direction). Must be less than 16. */
static const int AVERAGING_SIZE = 4;
public:
+
cHeiGenMinMax(int a_Seed, cBiomeGenPtr a_BiomeGen):
m_Noise(a_Seed),
m_BiomeGen(a_BiomeGen),
diff --git a/src/Generating/HeiGen.h b/src/Generating/HeiGen.h
index e4fa12fb3..c8118860e 100644
--- a/src/Generating/HeiGen.h
+++ b/src/Generating/HeiGen.h
@@ -167,13 +167,14 @@ protected:
-class cHeiGenBiomal :
+class cHeiGenBiomal:
public cTerrainHeightGen
{
- typedef cTerrainHeightGen Super;
+ using Super = cTerrainHeightGen;
public:
- cHeiGenBiomal(int a_Seed, cBiomeGenPtr a_BiomeGen) :
+
+ cHeiGenBiomal(int a_Seed, cBiomeGenPtr a_BiomeGen):
m_Noise(a_Seed),
m_BiomeGen(a_BiomeGen)
{
diff --git a/src/Generating/IntGen.h b/src/Generating/IntGen.h
index ae46b2de2..3b9f3b027 100644
--- a/src/Generating/IntGen.h
+++ b/src/Generating/IntGen.h
@@ -55,14 +55,14 @@ class cIntGen
{
public:
- typedef cIntGen<SizeX, SizeZ> IntGenType;
+ using IntGenType = cIntGen<SizeX, SizeZ>;
/** Force a virtual destructor in all descendants.
Descendants contain virtual functions and are referred to via pointer-to-base, so they need a virtual destructor. */
virtual ~cIntGen() {}
/** Holds the array of values generated by this class (descendant). */
- typedef int Values[SizeX * SizeZ];
+ using Values = int[SizeX * SizeZ];
/** Generates the array of templated size into a_Values, based on given min coords. */
virtual void GetInts(int a_MinX, int a_MinZ, Values & a_Values) = 0;
@@ -84,7 +84,7 @@ struct sGens : sGens<N - 1, N - 1, S...>
template<int... S>
struct sGens<0, S...>
{
- typedef sSeq<S...> type;
+ using type = sSeq<S...>;
};
@@ -94,7 +94,7 @@ class cIntGenFactory
public:
- typedef Gen Generator;
+ using Generator = Gen;
cIntGenFactory(Args&&... a_args) :
m_args(std::make_tuple<Args...>(std::forward<Args>(a_args)...))
@@ -135,13 +135,14 @@ cIntGenFactory<Gen, Args...> MakeIntGen(Args&&... a_Args)
/** Provides additional cNoise member and its helper functions. */
template <int SizeX, int SizeZ = SizeX>
-class cIntGenWithNoise :
+class cIntGenWithNoise:
public cIntGen<SizeX, SizeZ>
{
- typedef cIntGen<SizeX, SizeZ> super;
+ using Super = cIntGen<SizeX, SizeZ>;
public:
- cIntGenWithNoise(int a_Seed) :
+
+ cIntGenWithNoise(int a_Seed):
m_Noise(a_Seed)
{
}
@@ -176,26 +177,27 @@ protected:
/** Generates a 2D array of random integers in the specified range [0 .. Range). */
template <int Range, int SizeX, int SizeZ = SizeX>
-class cIntGenChoice :
+class cIntGenChoice:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
public:
- cIntGenChoice(int a_Seed) :
- super(a_Seed)
+
+ cIntGenChoice(int a_Seed):
+ Super(a_Seed)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
for (int z = 0; z < SizeZ; z++)
{
int BaseZ = a_MinZ + z;
for (int x = 0; x < SizeX; x++)
{
- a_Values[x + SizeX * z] = (super::m_Noise.IntNoise2DInt(a_MinX + x, BaseZ) / 7) % Range;
+ a_Values[x + SizeX * z] = (Super::m_Noise.IntNoise2DInt(a_MinX + x, BaseZ) / 7) % Range;
}
} // for z
}
@@ -209,27 +211,28 @@ public:
Has a threshold (in percent) of how much land, the larger the threshold, the more land.
Generates 0 for ocean, biome group ID for landmass. */
template <int SizeX, int SizeZ = SizeX>
-class cIntGenLandOcean :
+class cIntGenLandOcean:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
public:
- cIntGenLandOcean(int a_Seed, int a_Threshold) :
- super(a_Seed),
+
+ cIntGenLandOcean(int a_Seed, int a_Threshold):
+ Super(a_Seed),
m_Threshold(a_Threshold)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
for (int z = 0; z < SizeZ; z++)
{
int BaseZ = a_MinZ + z;
for (int x = 0; x < SizeX; x++)
{
- int rnd = (super::m_Noise.IntNoise2DInt(a_MinX + x, BaseZ) / 7);
+ int rnd = (Super::m_Noise.IntNoise2DInt(a_MinX + x, BaseZ) / 7);
a_Values[x + SizeX * z] = ((rnd % 100) < m_Threshold) ? ((rnd / 101) % bgLandOceanMax + 1) : 0;
}
}
@@ -253,27 +256,29 @@ protected:
This means that the zoome out image is randomly distorted. Applying zoom several times provides all
the distortion that the generators need. */
template <int SizeX, int SizeZ = SizeX>
-class cIntGenZoom :
+class cIntGenZoom:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
protected:
+
static const int m_LowerSizeX = (SizeX / 2) + 2;
static const int m_LowerSizeZ = (SizeZ / 2) + 2;
public:
- typedef std::shared_ptr<cIntGen<m_LowerSizeX, m_LowerSizeZ>> Underlying;
+ using Underlying = std::shared_ptr<cIntGen<m_LowerSizeX, m_LowerSizeZ>>;
- cIntGenZoom(int a_Seed, Underlying a_UnderlyingGen) :
- super(a_Seed),
+
+ cIntGenZoom(int a_Seed, Underlying a_UnderlyingGen):
+ Super(a_Seed),
m_UnderlyingGen(a_UnderlyingGen)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the underlying data with half the resolution:
int lowerMinX = a_MinX >> 1;
@@ -298,9 +303,9 @@ public:
int RndX = (x + lowerMinX) * 2;
int RndZ = (z + lowerMinZ) * 2;
cache[idx] = PrevZ0;
- cache[idx + lowStepX] = super::ChooseRandomOne(RndX, RndZ + 1, PrevZ0, PrevZ1);
- cache[idx + 1] = super::ChooseRandomOne(RndX, RndZ - 1, PrevZ0, ValX1Z0);
- cache[idx + 1 + lowStepX] = super::ChooseRandomOne(RndX, RndZ, PrevZ0, ValX1Z0, PrevZ1, ValX1Z1);
+ cache[idx + lowStepX] = Super::ChooseRandomOne(RndX, RndZ + 1, PrevZ0, PrevZ1);
+ cache[idx + 1] = Super::ChooseRandomOne(RndX, RndZ - 1, PrevZ0, ValX1Z0);
+ cache[idx + 1 + lowStepX] = Super::ChooseRandomOne(RndX, RndZ, PrevZ0, ValX1Z0, PrevZ1, ValX1Z1);
idx += 2;
PrevZ0 = ValX1Z0;
PrevZ1 = ValX1Z1;
@@ -325,25 +330,27 @@ protected:
/** Smoothes out some artifacts generated by the zooming - mostly single-pixel values.
Compares each pixel to its neighbors and if the neighbors are equal, changes the pixel to their value. */
template <int SizeX, int SizeZ = SizeX>
-class cIntGenSmooth :
+class cIntGenSmooth:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
+
static const int m_LowerSizeX = SizeX + 2;
static const int m_LowerSizeZ = SizeZ + 2;
public:
- typedef std::shared_ptr<cIntGen<m_LowerSizeX, m_LowerSizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<m_LowerSizeX, m_LowerSizeZ>>;
- cIntGenSmooth(int a_Seed, Underlying a_Underlying) :
- super(a_Seed),
+ cIntGenSmooth(int a_Seed, Underlying a_Underlying):
+ Super(a_Seed),
m_Underlying(a_Underlying)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the underlying values:
int lowerData[m_LowerSizeX * m_LowerSizeZ];
@@ -364,7 +371,7 @@ public:
if ((left == right) && (above == below))
{
- if (((super::m_Noise.IntNoise2DInt(a_MinX + x, NoiseZ) / 7) % 2) == 0)
+ if (((Super::m_Noise.IntNoise2DInt(a_MinX + x, NoiseZ) / 7) % 2) == 0)
{
val = left;
}
@@ -401,24 +408,26 @@ protected:
/** Converts land biomes at the edge of an ocean into the respective beach biome. */
template <int SizeX, int SizeZ = SizeX>
-class cIntGenBeaches :
+class cIntGenBeaches:
public cIntGen<SizeX, SizeZ>
{
- typedef cIntGen<SizeX, SizeZ> super;
+ using Super = cIntGen<SizeX, SizeZ>;
+
static const int m_UnderlyingSizeX = SizeX + 2;
static const int m_UnderlyingSizeZ = SizeZ + 2;
public:
- typedef std::shared_ptr<cIntGen<m_UnderlyingSizeX, m_UnderlyingSizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<m_UnderlyingSizeX, m_UnderlyingSizeZ>>;
- cIntGenBeaches(Underlying a_Underlying) :
+ cIntGenBeaches(Underlying a_Underlying):
m_Underlying(a_Underlying)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Map for biome -> its beach:
static const int ToBeach[] =
@@ -503,24 +512,25 @@ protected:
/** Generates the underlying numbers and then randomly changes some ocean group pixels into random land
biome group pixels, based on the predefined chance. */
template <int SizeX, int SizeZ = SizeX>
-class cIntGenAddIslands :
+class cIntGenAddIslands:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
public:
- typedef std::shared_ptr<cIntGen<SizeX, SizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<SizeX, SizeZ>>;
- cIntGenAddIslands(int a_Seed, int a_Chance, Underlying a_Underlying) :
- super(a_Seed),
+ cIntGenAddIslands(int a_Seed, int a_Chance, Underlying a_Underlying):
+ Super(a_Seed),
m_Chance(a_Chance),
m_Underlying(a_Underlying)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
m_Underlying->GetInts(a_MinX, a_MinZ, a_Values);
for (int z = 0; z < SizeZ; z++)
@@ -529,7 +539,7 @@ public:
{
if (a_Values[x + z * SizeX] == bgOcean)
{
- int rnd = super::m_Noise.IntNoise2DInt(a_MinX + x, a_MinZ + z) / 7;
+ int rnd = Super::m_Noise.IntNoise2DInt(a_MinX + x, a_MinZ + z) / 7;
if (rnd % 1000 < m_Chance)
{
a_Values[x + z * SizeX] = (rnd / 1003) % bgLandOceanMax;
@@ -552,25 +562,26 @@ protected:
/** A filter that adds an edge biome group between two biome groups that need an edge between them. */
template <int SizeX, int SizeZ = SizeX>
-class cIntGenBiomeGroupEdges :
+class cIntGenBiomeGroupEdges:
public cIntGen<SizeX, SizeZ>
{
- typedef cIntGen<SizeX, SizeZ> super;
+ using Super = cIntGen<SizeX, SizeZ>;
static const int m_UnderlyingSizeX = SizeX + 2;
static const int m_UnderlyingSizeZ = SizeZ + 2;
public:
- typedef std::shared_ptr<cIntGen<m_UnderlyingSizeX, m_UnderlyingSizeZ>> Underlying;
+ using Underlying = std::shared_ptr<cIntGen<m_UnderlyingSizeX, m_UnderlyingSizeZ>>;
- cIntGenBiomeGroupEdges(Underlying a_Underlying) :
+
+ cIntGenBiomeGroupEdges(Underlying a_Underlying):
m_Underlying(a_Underlying)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values)
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values)
{
// Generate the underlying biome groups:
int lowerValues[m_UnderlyingSizeX * m_UnderlyingSizeZ];
@@ -653,23 +664,24 @@ protected:
For each pixel, takes its biome group and chooses a random biome from that group; replaces the value with
that biome. */
template <int SizeX, int SizeZ = SizeX>
-class cIntGenBiomes :
+class cIntGenBiomes:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
public:
- typedef std::shared_ptr<cIntGen<SizeX, SizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<SizeX, SizeZ>>;
- cIntGenBiomes(int a_Seed, Underlying a_Underlying) :
- super(a_Seed),
+ cIntGenBiomes(int a_Seed, Underlying a_Underlying):
+ Super(a_Seed),
m_Underlying(a_Underlying)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Define the per-biome-group biomes:
static const int oceanBiomes[] =
@@ -755,7 +767,7 @@ public:
const cBiomesInGroups & Biomes = (val > bgfRare) ?
rareBiomesInGroups[(val & (bgfRare - 1)) % ARRAYCOUNT(rareBiomesInGroups)] :
biomesInGroups[val % ARRAYCOUNT(biomesInGroups)];
- int rnd = (super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7);
+ int rnd = (Super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7);
a_Values[x + IdxZ] = Biomes.Biomes[rnd % Biomes.Count];
}
}
@@ -780,17 +792,18 @@ protected:
/** Randomly replaces pixels of one value to another value, using the given chance. */
template <int SizeX, int SizeZ = SizeX>
-class cIntGenReplaceRandomly :
+class cIntGenReplaceRandomly:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
public:
- typedef std::shared_ptr<cIntGen<SizeX, SizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<SizeX, SizeZ>>;
- cIntGenReplaceRandomly(int a_From, int a_To, int a_Chance, int a_Seed, Underlying a_Underlying) :
- super(a_Seed),
+ cIntGenReplaceRandomly(int a_From, int a_To, int a_Chance, int a_Seed, Underlying a_Underlying):
+ Super(a_Seed),
m_From(a_From),
m_To(a_To),
m_Chance(a_Chance),
@@ -799,7 +812,7 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the underlying values:
m_Underlying->GetInts(a_MinX, a_MinZ, a_Values);
@@ -813,7 +826,7 @@ public:
int idx = x + idxZ;
if (a_Values[idx] == m_From)
{
- int rnd = super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7;
+ int rnd = Super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7;
if (rnd % 1000 < m_Chance)
{
a_Values[idx] = m_To;
@@ -849,10 +862,11 @@ template <int SizeX, int SizeZ = SizeX>
class cIntGenMixRivers:
public cIntGen<SizeX, SizeZ>
{
- typedef cIntGen<SizeX, SizeZ> super;
+ using Super = cIntGen<SizeX, SizeZ>;
public:
- typedef std::shared_ptr<cIntGen<SizeX, SizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<SizeX, SizeZ>>;
cIntGenMixRivers(Underlying a_Biomes, Underlying a_Rivers):
@@ -862,11 +876,11 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the underlying data:
m_Biomes->GetInts(a_MinX, a_MinZ, a_Values);
- typename super::Values riverData;
+ typename Super::Values riverData;
m_Rivers->GetInts(a_MinX, a_MinZ, riverData);
// Mix the values:
@@ -916,22 +930,24 @@ template <int SizeX, int SizeZ = SizeX>
class cIntGenRiver:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
+
static const int UnderlyingSizeX = SizeX + 2;
static const int UnderlyingSizeZ = SizeZ + 2;
public:
- typedef std::shared_ptr<cIntGen<UnderlyingSizeX, UnderlyingSizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<UnderlyingSizeX, UnderlyingSizeZ>>;
cIntGenRiver(int a_Seed, Underlying a_Underlying):
- super(a_Seed),
+ Super(a_Seed),
m_Underlying(a_Underlying)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the underlying data:
int Cache[UnderlyingSizeX * UnderlyingSizeZ];
@@ -975,16 +991,18 @@ template <int SizeX, int SizeZ = SizeX>
class cIntGenAddToOcean:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
+
static const int UnderlyingSizeX = SizeX + 2;
static const int UnderlyingSizeZ = SizeZ + 2;
public:
- typedef std::shared_ptr<cIntGen<UnderlyingSizeX, UnderlyingSizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<UnderlyingSizeX, UnderlyingSizeZ>>;
cIntGenAddToOcean(int a_Seed, int a_Chance, int a_ToValue, Underlying a_Underlying):
- super(a_Seed),
+ Super(a_Seed),
m_Chance(a_Chance),
m_ToValue(a_ToValue),
m_Underlying(a_Underlying)
@@ -992,7 +1010,7 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the underlying data:
int Cache[UnderlyingSizeX * UnderlyingSizeZ];
@@ -1036,7 +1054,7 @@ public:
// If at least 3 ocean neighbors and the chance is right, change:
if (
(NumOceanNeighbors >= 3) &&
- ((super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7) % 1000 < m_Chance)
+ ((Super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7) % 1000 < m_Chance)
)
{
a_Values[x + z * SizeX] = m_ToValue;
@@ -1065,16 +1083,18 @@ protected:
/** Changes random pixels of the underlying data to the specified value. */
template <int SizeX, int SizeZ = SizeX>
-class cIntGenSetRandomly :
+class cIntGenSetRandomly:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
public:
- typedef std::shared_ptr<cIntGen<SizeX, SizeZ>> Underlying;
- cIntGenSetRandomly(int a_Seed, int a_Chance, int a_ToValue, Underlying a_Underlying) :
- super(a_Seed),
+ using Underlying = std::shared_ptr<cIntGen<SizeX, SizeZ>>;
+
+
+ cIntGenSetRandomly(int a_Seed, int a_Chance, int a_ToValue, Underlying a_Underlying):
+ Super(a_Seed),
m_Chance(a_Chance),
m_ToValue(a_ToValue),
m_Underlying(a_Underlying)
@@ -1082,7 +1102,7 @@ public:
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the underlying data:
m_Underlying->GetInts(a_MinX, a_MinZ, a_Values);
@@ -1092,7 +1112,7 @@ public:
{
for (int x = 0; x < SizeX; x++)
{
- int rnd = super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7;
+ int rnd = Super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7;
if (rnd % 1000 < m_Chance)
{
a_Values[x + z * SizeX] = m_ToValue;
@@ -1120,21 +1140,22 @@ template <int SizeX, int SizeZ = SizeX>
class cIntGenRareBiomeGroups:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
public:
- typedef std::shared_ptr<cIntGen<SizeX, SizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<SizeX, SizeZ>>;
cIntGenRareBiomeGroups(int a_Seed, int a_Chance, Underlying a_Underlying):
- super(a_Seed),
+ Super(a_Seed),
m_Chance(a_Chance),
m_Underlying(a_Underlying)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the underlying data:
m_Underlying->GetInts(a_MinX, a_MinZ, a_Values);
@@ -1144,7 +1165,7 @@ public:
{
for (int x = 0; x < SizeX; x++)
{
- int rnd = super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7;
+ int rnd = Super::m_Noise.IntNoise2DInt(x + a_MinX, z + a_MinZ) / 7;
if (rnd % 1000 < m_Chance)
{
int idx = x + SizeX * z;
@@ -1172,25 +1193,26 @@ template <int SizeX, int SizeZ = SizeX>
class cIntGenAlternateBiomes:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
public:
- typedef std::shared_ptr<cIntGen<SizeX, SizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<SizeX, SizeZ>>;
cIntGenAlternateBiomes(int a_Seed, Underlying a_Alterations, Underlying a_BaseBiomes):
- super(a_Seed),
+ Super(a_Seed),
m_Alterations(a_Alterations),
m_BaseBiomes(a_BaseBiomes)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the base biomes and the alterations:
m_BaseBiomes->GetInts(a_MinX, a_MinZ, a_Values);
- typename super::Values alterations;
+ typename Super::Values alterations;
m_Alterations->GetInts(a_MinX, a_MinZ, alterations);
// Change the biomes into their alternate versions:
@@ -1240,22 +1262,24 @@ template <int SizeX, int SizeZ = SizeX>
class cIntGenBiomeEdges:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
+
static const int m_LowerSizeX = SizeX + 2;
static const int m_LowerSizeZ = SizeZ + 2;
public:
- typedef std::shared_ptr<cIntGen<m_LowerSizeX, m_LowerSizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<m_LowerSizeX, m_LowerSizeZ>>;
cIntGenBiomeEdges(int a_Seed, Underlying a_Underlying):
- super(a_Seed),
+ Super(a_Seed),
m_Underlying(a_Underlying)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the underlying biomes:
typename Underlying::element_type::Values lowerValues;
@@ -1402,25 +1426,26 @@ template <int SizeX, int SizeZ = SizeX>
class cIntGenMBiomes:
public cIntGenWithNoise<SizeX, SizeZ>
{
- typedef cIntGenWithNoise<SizeX, SizeZ> super;
+ using Super = cIntGenWithNoise<SizeX, SizeZ>;
public:
- typedef std::shared_ptr<cIntGen<SizeX, SizeZ>> Underlying;
+
+ using Underlying = std::shared_ptr<cIntGen<SizeX, SizeZ>>;
cIntGenMBiomes(int a_Seed, Underlying a_Alteration, Underlying a_Underlying):
- super(a_Seed),
+ Super(a_Seed),
m_Underlying(a_Underlying),
m_Alteration(a_Alteration)
{
}
- virtual void GetInts(int a_MinX, int a_MinZ, typename super::Values & a_Values) override
+ virtual void GetInts(int a_MinX, int a_MinZ, typename Super::Values & a_Values) override
{
// Generate the underlying biomes and the alterations:
m_Underlying->GetInts(a_MinX, a_MinZ, a_Values);
- typename super::Values alterations;
+ typename Super::Values alterations;
m_Alteration->GetInts(a_MinX, a_MinZ, alterations);
// Wherever alterations are nonzero, change into alternate biome, if available:
diff --git a/src/Generating/MineShafts.cpp b/src/Generating/MineShafts.cpp
index 80ba3f5b5..2045533c1 100644
--- a/src/Generating/MineShafts.cpp
+++ b/src/Generating/MineShafts.cpp
@@ -81,18 +81,19 @@ public:
virtual void ProcessChunk(cChunkDesc & a_ChunkDesc) = 0;
} ;
-typedef std::vector<cMineShaft *> cMineShafts;
+using cMineShafts = std::vector<cMineShaft *>;
-class cMineShaftDirtRoom :
+class cMineShaftDirtRoom:
public cMineShaft
{
- typedef cMineShaft super;
+ using Super = cMineShaft;
public:
+
cMineShaftDirtRoom(cStructGenMineShafts::cMineShaftSystem & a_Parent, cNoise & a_Noise);
// cMineShaft overrides:
@@ -104,16 +105,16 @@ public:
-class cMineShaftCorridor :
+class cMineShaftCorridor:
public cMineShaft
{
- typedef cMineShaft super;
+ using Super = cMineShaft;
public:
+
/** Creates a new Corridor attached to the specified pivot point and direction.
Checks all ParentSystem's objects and disallows intersecting. Initializes the new object to fit.
- May return nullptr if cannot fit.
- */
+ May return nullptr if cannot fit. */
static cMineShaft * CreateAndFit(
cStructGenMineShafts::cMineShaftSystem & a_ParentSystem,
int a_PivotX, int a_PivotY, int a_PivotZ, eDirection a_Direction,
@@ -157,16 +158,16 @@ protected:
-class cMineShaftCrossing :
+class cMineShaftCrossing:
public cMineShaft
{
- typedef cMineShaft super;
+ using Super = cMineShaft;
public:
+
/** Creates a new Crossing attached to the specified pivot point and direction.
Checks all ParentSystem's objects and disallows intersecting. Initializes the new object to fit.
- May return nullptr if cannot fit.
- */
+ May return nullptr if cannot fit. */
static cMineShaft * CreateAndFit(
cStructGenMineShafts::cMineShaftSystem & a_ParentSystem,
int a_PivotX, int a_PivotY, int a_PivotZ, eDirection a_Direction,
@@ -185,12 +186,13 @@ protected:
-class cMineShaftStaircase :
+class cMineShaftStaircase:
public cMineShaft
{
- typedef cMineShaft super;
+ using Super = cMineShaft;
public:
+
enum eSlope
{
sUp,
@@ -228,12 +230,13 @@ protected:
-class cStructGenMineShafts::cMineShaftSystem :
+class cStructGenMineShafts::cMineShaftSystem:
public cGridStructGen::cStructure
{
- typedef cGridStructGen::cStructure super;
+ using Super = cGridStructGen::cStructure;
public:
+
int m_GridSize; ///< Maximum offset of the dirtroom from grid center, * 2, in each direction
int m_MaxRecursion; ///< Maximum recursion level (initialized from cStructGenMineShafts::m_MaxRecursion)
int m_ProbLevelCorridor; ///< Probability level of a branch object being the corridor
@@ -283,7 +286,7 @@ cStructGenMineShafts::cMineShaftSystem::cMineShaftSystem(
int a_GridSize, int a_MaxSystemSize, cNoise & a_Noise,
int a_ProbLevelCorridor, int a_ProbLevelCrossing, int a_ProbLevelStaircase
) :
- super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
+ Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_GridSize(a_GridSize),
m_MaxRecursion(8), // TODO: settable
m_ProbLevelCorridor(a_ProbLevelCorridor),
@@ -404,7 +407,7 @@ bool cStructGenMineShafts::cMineShaftSystem::CanAppend(const cCuboid & a_Boundin
// cMineShaftDirtRoom:
cMineShaftDirtRoom::cMineShaftDirtRoom(cStructGenMineShafts::cMineShaftSystem & a_Parent, cNoise & a_Noise) :
- super(a_Parent, mskDirtRoom)
+ Super(a_Parent, mskDirtRoom)
{
// Make the room of random size, min 10 x 4 x 10; max 18 x 12 x 18:
int rnd = a_Noise.IntNoise3DInt(a_Parent.m_OriginX, 0, a_Parent.m_OriginZ) / 7;
@@ -500,7 +503,7 @@ cMineShaftCorridor::cMineShaftCorridor(
const cCuboid & a_BoundingBox, int a_NumSegments, eDirection a_Direction,
cNoise & a_Noise
) :
- super(a_ParentSystem, mskCorridor, a_BoundingBox),
+ Super(a_ParentSystem, mskCorridor, a_BoundingBox),
m_NumSegments(a_NumSegments),
m_Direction(a_Direction),
m_ChestPosition(-1),
@@ -973,7 +976,7 @@ void cMineShaftCorridor::PlaceTorches(cChunkDesc & a_ChunkDesc)
// cMineShaftCrossing:
cMineShaftCrossing::cMineShaftCrossing(cStructGenMineShafts::cMineShaftSystem & a_ParentSystem, const cCuboid & a_BoundingBox) :
- super(a_ParentSystem, mskCrossing, a_BoundingBox)
+ Super(a_ParentSystem, mskCrossing, a_BoundingBox)
{
}
@@ -1113,7 +1116,7 @@ cMineShaftStaircase::cMineShaftStaircase(
eDirection a_Direction,
eSlope a_Slope
) :
- super(a_ParentSystem, mskStaircase, a_BoundingBox),
+ Super(a_ParentSystem, mskStaircase, a_BoundingBox),
m_Direction(a_Direction),
m_Slope(a_Slope)
{
@@ -1289,7 +1292,7 @@ cStructGenMineShafts::cStructGenMineShafts(
int a_Seed, int a_GridSize, int a_MaxOffset, int a_MaxSystemSize,
int a_ChanceCorridor, int a_ChanceCrossing, int a_ChanceStaircase
) :
- super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSystemSize, a_MaxSystemSize, 100),
+ Super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSystemSize, a_MaxSystemSize, 100),
m_GridSize(a_GridSize),
m_MaxSystemSize(a_MaxSystemSize),
m_ProbLevelCorridor(std::max(0, a_ChanceCorridor)),
diff --git a/src/Generating/MineShafts.h b/src/Generating/MineShafts.h
index 83f60ec77..43eff2055 100644
--- a/src/Generating/MineShafts.h
+++ b/src/Generating/MineShafts.h
@@ -18,7 +18,7 @@
class cStructGenMineShafts :
public cGridStructGen
{
- typedef cGridStructGen super;
+ typedef cGridStructGen Super;
public:
cStructGenMineShafts(
diff --git a/src/Generating/Noise3DGenerator.h b/src/Generating/Noise3DGenerator.h
index 80e328214..43245bebd 100644
--- a/src/Generating/Noise3DGenerator.h
+++ b/src/Generating/Noise3DGenerator.h
@@ -20,12 +20,13 @@
-class cNoise3DGenerator :
+class cNoise3DGenerator:
public cChunkGenerator
{
- typedef cChunkGenerator Super;
+ using Super = cChunkGenerator;
public:
+
cNoise3DGenerator();
virtual ~cNoise3DGenerator() override;
diff --git a/src/Generating/PieceStructuresGen.cpp b/src/Generating/PieceStructuresGen.cpp
index 4f31c6833..343771a43 100644
--- a/src/Generating/PieceStructuresGen.cpp
+++ b/src/Generating/PieceStructuresGen.cpp
@@ -17,9 +17,10 @@
class cPieceStructuresGen::cGen:
public cGridStructGen
{
- typedef cGridStructGen Super;
+ using Super = cGridStructGen;
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),
diff --git a/src/Generating/PieceStructuresGen.h b/src/Generating/PieceStructuresGen.h
index 1a75c90a6..f0449a9b3 100644
--- a/src/Generating/PieceStructuresGen.h
+++ b/src/Generating/PieceStructuresGen.h
@@ -21,12 +21,13 @@ cPieceGenerator instance.
-class cPieceStructuresGen :
+class cPieceStructuresGen:
public cFinishGen
{
- typedef cFinishGen Super;
+ using Super = cFinishGen;
public:
+
cPieceStructuresGen(int a_Seed);
/** Initializes the generator based on the specified prefab sets.
diff --git a/src/Generating/PrefabStructure.h b/src/Generating/PrefabStructure.h
index 423408396..e102b4863 100644
--- a/src/Generating/PrefabStructure.h
+++ b/src/Generating/PrefabStructure.h
@@ -19,9 +19,10 @@
class cPrefabStructure:
public cGridStructGen::cStructure
{
- typedef cGridStructGen::cStructure Super;
+ using Super = cGridStructGen::cStructure;
public:
+
cPrefabStructure(
int a_GridX, int a_GridZ,
int a_OriginX, int a_OriginZ,
diff --git a/src/Generating/ProtIntGen.h b/src/Generating/ProtIntGen.h
index 24cdafa15..22cd35c53 100644
--- a/src/Generating/ProtIntGen.h
+++ b/src/Generating/ProtIntGen.h
@@ -51,7 +51,7 @@ protected:
public:
/** Type of the generic interface used for storing links to the underlying generators. */
- typedef std::shared_ptr<cProtIntGen> Underlying;
+ using Underlying = std::shared_ptr<cProtIntGen>;
/** Force a virtual destructor in all descendants.
@@ -67,13 +67,14 @@ public:
/** Provides additional cNoise member and its helper functions. */
-class cProtIntGenWithNoise :
+class cProtIntGenWithNoise:
public cProtIntGen
{
- typedef cProtIntGen super;
+ using Super = cProtIntGen;
public:
- cProtIntGenWithNoise(int a_Seed) :
+
+ cProtIntGenWithNoise(int a_Seed):
m_Noise(a_Seed)
{
}
@@ -107,14 +108,15 @@ protected:
/** Generates a 2D array of random integers in the specified range [0 .. Range). */
-class cProtIntGenChoice :
+class cProtIntGenChoice:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- cProtIntGenChoice(int a_Seed, int a_Range) :
- super(a_Seed),
+
+ cProtIntGenChoice(int a_Seed, int a_Range):
+ Super(a_Seed),
m_Range(a_Range)
{
}
@@ -127,7 +129,7 @@ public:
int BaseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++)
{
- a_Values[x + a_SizeX * z] = (super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7) % m_Range;
+ a_Values[x + a_SizeX * z] = (Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7) % m_Range;
}
} // for z
}
@@ -143,14 +145,15 @@ protected:
/** Decides between the ocean and landmass biomes.
Has a threshold (in percent) of how much land, the larger the threshold, the more land.
Generates 0 for ocean, biome group ID for landmass. */
-class cProtIntGenLandOcean :
+class cProtIntGenLandOcean:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- cProtIntGenLandOcean(int a_Seed, int a_Threshold) :
- super(a_Seed),
+
+ cProtIntGenLandOcean(int a_Seed, int a_Threshold):
+ Super(a_Seed),
m_Threshold(a_Threshold)
{
}
@@ -163,7 +166,7 @@ public:
int BaseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++)
{
- int rnd = (super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7);
+ int rnd = (Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7);
a_Values[x + a_SizeX * z] = ((rnd % 100) < m_Threshold) ? ((rnd / 101) % bgLandOceanMax + 1) : 0;
}
}
@@ -186,14 +189,15 @@ protected:
/** Zooms the underlying value array to twice the size. Uses random-neighbor for the pixels in-between.
This means that the zoome out image is randomly distorted. Applying zoom several times provides all
the distortion that the generators need. */
-class cProtIntGenZoom :
+class cProtIntGenZoom:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- cProtIntGenZoom(int a_Seed, Underlying a_UnderlyingGen) :
- super(a_Seed),
+
+ cProtIntGenZoom(int a_Seed, Underlying a_UnderlyingGen):
+ Super(a_Seed),
m_UnderlyingGen(a_UnderlyingGen)
{
}
@@ -230,9 +234,9 @@ public:
int RndX = (static_cast<int>(x) + lowerMinX) * 2;
int RndZ = (static_cast<int>(z) + lowerMinZ) * 2;
cache[idx] = PrevZ0;
- cache[idx + lowStepX] = super::chooseRandomOne(RndX, RndZ + 1, PrevZ0, PrevZ1);
- cache[idx + 1] = super::chooseRandomOne(RndX, RndZ - 1, PrevZ0, ValX1Z0);
- cache[idx + 1 + lowStepX] = super::chooseRandomOne(RndX, RndZ, PrevZ0, ValX1Z0, PrevZ1, ValX1Z1);
+ cache[idx + lowStepX] = Super::chooseRandomOne(RndX, RndZ + 1, PrevZ0, PrevZ1);
+ cache[idx + 1] = Super::chooseRandomOne(RndX, RndZ - 1, PrevZ0, ValX1Z0);
+ cache[idx + 1 + lowStepX] = Super::chooseRandomOne(RndX, RndZ, PrevZ0, ValX1Z0, PrevZ1, ValX1Z1);
idx += 2;
PrevZ0 = ValX1Z0;
PrevZ1 = ValX1Z1;
@@ -256,14 +260,15 @@ protected:
/** Smoothes out some artifacts generated by the zooming - mostly single-pixel values.
Compares each pixel to its neighbors and if the neighbors are equal, changes the pixel to their value. */
-class cProtIntGenSmooth :
+class cProtIntGenSmooth:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- cProtIntGenSmooth(int a_Seed, Underlying a_Underlying) :
- super(a_Seed),
+
+ cProtIntGenSmooth(int a_Seed, Underlying a_Underlying):
+ Super(a_Seed),
m_Underlying(a_Underlying)
{
}
@@ -293,7 +298,7 @@ public:
if ((left == right) && (above == below))
{
- if (((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 2) == 0)
+ if (((Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 2) == 0)
{
val = left;
}
@@ -329,13 +334,14 @@ protected:
/** Averages the values of the underlying 2 * 2 neighbors. */
-class cProtIntGenAvgValues :
+class cProtIntGenAvgValues:
public cProtIntGen
{
- typedef cProtIntGen super;
+ using Super = cProtIntGen;
public:
- cProtIntGenAvgValues(Underlying a_Underlying) :
+
+ cProtIntGenAvgValues(Underlying a_Underlying):
m_Underlying(a_Underlying)
{
}
@@ -373,13 +379,14 @@ protected:
/** Averages the values of the underlying 4 * 4 neighbors. */
-class cProtIntGenAvg4Values :
+class cProtIntGenAvg4Values:
public cProtIntGen
{
- typedef cProtIntGen super;
+ using Super = cProtIntGen;
public:
- cProtIntGenAvg4Values(Underlying a_Underlying) :
+
+ cProtIntGenAvg4Values(Underlying a_Underlying):
m_Underlying(a_Underlying)
{
}
@@ -423,13 +430,14 @@ protected:
/** Averages the values of the underlying 3 * 3 neighbors with custom weight. */
template <int WeightCenter, int WeightCardinal, int WeightDiagonal>
-class cProtIntGenWeightAvg :
+class cProtIntGenWeightAvg:
public cProtIntGen
{
- typedef cProtIntGen super;
+ using Super = cProtIntGen;
public:
- cProtIntGenWeightAvg(Underlying a_Underlying) :
+
+ cProtIntGenWeightAvg(Underlying a_Underlying):
m_Underlying(a_Underlying)
{
}
@@ -470,14 +478,15 @@ protected:
/** Replaces random values of the underlying data with random integers in the specified range [Min .. Min + Range). */
-class cProtIntGenRndChoice :
+class cProtIntGenRndChoice:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- cProtIntGenRndChoice(int a_Seed, int a_ChancePct, int a_Min, int a_Range, Underlying a_Underlying) :
- super(a_Seed),
+
+ cProtIntGenRndChoice(int a_Seed, int a_ChancePct, int a_Min, int a_Range, Underlying a_Underlying):
+ Super(a_Seed),
m_ChancePct(a_ChancePct),
m_Min(a_Min),
m_Range(a_Range),
@@ -497,9 +506,9 @@ public:
int BaseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++)
{
- if (((super::m_Noise.IntNoise2DInt(BaseZ, a_MinX + static_cast<int>(x)) / 13) % 101) < m_ChancePct)
+ if (((Super::m_Noise.IntNoise2DInt(BaseZ, a_MinX + static_cast<int>(x)) / 13) % 101) < m_ChancePct)
{
- a_Values[x + a_SizeX * z] = m_Min + (super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7) % m_Range;
+ a_Values[x + a_SizeX * z] = m_Min + (Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7) % m_Range;
}
} // for x
} // for z
@@ -517,14 +526,15 @@ protected:
/** Adds a random value in range [-a_HalfRange, +a_HalfRange] to each of the underlying values. */
-class cProtIntGenAddRnd :
+class cProtIntGenAddRnd:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- cProtIntGenAddRnd(int a_Seed, int a_HalfRange, Underlying a_Underlying) :
- super(a_Seed),
+
+ cProtIntGenAddRnd(int a_Seed, int a_HalfRange, Underlying a_Underlying):
+ Super(a_Seed),
m_Range(a_HalfRange * 2 + 1),
m_HalfRange(a_HalfRange),
m_Underlying(a_Underlying)
@@ -543,7 +553,7 @@ public:
int NoiseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++)
{
- int noiseVal = ((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % m_Range) - m_HalfRange;
+ int noiseVal = ((Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % m_Range) - m_HalfRange;
a_Values[x + z * a_SizeX] += noiseVal;
}
}
@@ -560,14 +570,15 @@ protected:
/** Replaces random underlying values with the average of the neighbors. */
-class cProtIntGenRndAvg :
+class cProtIntGenRndAvg:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- cProtIntGenRndAvg(int a_Seed, int a_AvgChancePct, Underlying a_Underlying) :
- super(a_Seed),
+
+ cProtIntGenRndAvg(int a_Seed, int a_AvgChancePct, Underlying a_Underlying):
+ Super(a_Seed),
m_AvgChancePct(a_AvgChancePct),
m_Underlying(a_Underlying)
{
@@ -590,7 +601,7 @@ public:
for (size_t x = 0; x < a_SizeX; x++)
{
size_t idxLower = x + 1 + lowerSizeX * (z + 1);
- if (((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 100) > m_AvgChancePct)
+ if (((Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 100) > m_AvgChancePct)
{
// Average the 4 neighbors:
a_Values[x + z * a_SizeX] = (
@@ -617,14 +628,15 @@ protected:
/** Replaces random underlying values with a random value in between the max and min of the neighbors. */
-class cProtIntGenRndBetween :
+class cProtIntGenRndBetween:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- cProtIntGenRndBetween(int a_Seed, int a_AvgChancePct, Underlying a_Underlying) :
- super(a_Seed),
+
+ cProtIntGenRndBetween(int a_Seed, int a_AvgChancePct, Underlying a_Underlying):
+ Super(a_Seed),
m_AvgChancePct(a_AvgChancePct),
m_Underlying(a_Underlying)
{
@@ -647,12 +659,12 @@ public:
for (size_t x = 0; x < a_SizeX; x++)
{
size_t idxLower = x + 1 + lowerSizeX * (z + 1);
- if (((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 100) > m_AvgChancePct)
+ if (((Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 100) > m_AvgChancePct)
{
// Chose a value in between the min and max neighbor:
int min = std::min(std::min(lowerData[idxLower - 1], lowerData[idxLower + 1]), std::min(lowerData[idxLower - lowerSizeX], lowerData[idxLower + lowerSizeX]));
int max = std::max(std::max(lowerData[idxLower - 1], lowerData[idxLower + 1]), std::max(lowerData[idxLower - lowerSizeX], lowerData[idxLower + lowerSizeX]));
- a_Values[x + z * a_SizeX] = min + ((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ + 10) / 7) % (max - min + 1));
+ a_Values[x + z * a_SizeX] = min + ((Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ + 10) / 7) % (max - min + 1));
}
else
{
@@ -673,13 +685,14 @@ protected:
/** Converts land biomes at the edge of an ocean into the respective beach biome. */
-class cProtIntGenBeaches :
+class cProtIntGenBeaches:
public cProtIntGen
{
- typedef cProtIntGen super;
+ using Super = cProtIntGen;
public:
- cProtIntGenBeaches(Underlying a_Underlying) :
+
+ cProtIntGenBeaches(Underlying a_Underlying):
m_Underlying(a_Underlying)
{
}
@@ -772,17 +785,18 @@ protected:
/** Generates the underlying numbers and then randomly changes some ocean group pixels into random land
biome group pixels, based on the predefined chance. */
-class cProtIntGenAddIslands :
+class cProtIntGenAddIslands:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- typedef std::shared_ptr<cProtIntGen> Underlying;
+ using Underlying = std::shared_ptr<cProtIntGen>;
- cProtIntGenAddIslands(int a_Seed, int a_Chance, Underlying a_Underlying) :
- super(a_Seed),
+
+ cProtIntGenAddIslands(int a_Seed, int a_Chance, Underlying a_Underlying):
+ Super(a_Seed),
m_Chance(a_Chance),
m_Underlying(a_Underlying)
{
@@ -798,7 +812,7 @@ public:
{
if (a_Values[x + z * a_SizeX] == bgOcean)
{
- int rnd = super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), a_MinZ + static_cast<int>(z)) / 7;
+ int rnd = Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), a_MinZ + static_cast<int>(z)) / 7;
if (rnd % 1000 < m_Chance)
{
a_Values[x + z * a_SizeX] = (rnd / 1003) % bgLandOceanMax;
@@ -820,13 +834,14 @@ protected:
/** A filter that adds an edge biome group between two biome groups that need an edge between them. */
-class cProtIntGenBiomeGroupEdges :
+class cProtIntGenBiomeGroupEdges:
public cProtIntGen
{
- typedef cProtIntGen super;
+ using Super = cProtIntGen;
public:
- cProtIntGenBiomeGroupEdges(Underlying a_Underlying) :
+
+ cProtIntGenBiomeGroupEdges(Underlying a_Underlying):
m_Underlying(a_Underlying)
{
}
@@ -917,14 +932,15 @@ protected:
/** Turns biome group indices into real biomes.
For each pixel, takes its biome group and chooses a random biome from that group; replaces the value with
that biome. */
-class cProtIntGenBiomes :
+class cProtIntGenBiomes:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- cProtIntGenBiomes(int a_Seed, Underlying a_Underlying) :
- super(a_Seed),
+
+ cProtIntGenBiomes(int a_Seed, Underlying a_Underlying):
+ Super(a_Seed),
m_Underlying(a_Underlying)
{
}
@@ -1017,7 +1033,7 @@ public:
const cBiomesInGroups & Biomes = (val > bgfRare) ?
rareBiomesInGroups[(val & (bgfRare - 1)) % ARRAYCOUNT(rareBiomesInGroups)] :
biomesInGroups[static_cast<size_t>(val) % ARRAYCOUNT(biomesInGroups)];
- int rnd = (super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7);
+ int rnd = (Super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7);
a_Values[x + IdxZ] = Biomes.Biomes[rnd % Biomes.Count];
}
}
@@ -1041,17 +1057,18 @@ protected:
/** Randomly replaces pixels of one value to another value, using the given chance. */
-class cProtIntGenReplaceRandomly :
+class cProtIntGenReplaceRandomly:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- typedef std::shared_ptr<cProtIntGen> Underlying;
+ using Underlying = std::shared_ptr<cProtIntGen>;
- cProtIntGenReplaceRandomly(int a_Seed, int a_From, int a_To, int a_Chance, Underlying a_Underlying) :
- super(a_Seed),
+
+ cProtIntGenReplaceRandomly(int a_Seed, int a_From, int a_To, int a_Chance, Underlying a_Underlying):
+ Super(a_Seed),
m_From(a_From),
m_To(a_To),
m_Chance(a_Chance),
@@ -1074,7 +1091,7 @@ public:
size_t idx = x + idxZ;
if (a_Values[idx] == m_From)
{
- int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
+ int rnd = Super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
if (rnd % 1000 < m_Chance)
{
a_Values[idx] = m_To;
@@ -1109,9 +1126,10 @@ regular river or frozen river, based on the biome. */
class cProtIntGenMixRivers:
public cProtIntGen
{
- typedef cProtIntGen super;
+ using Super = cProtIntGen;
public:
+
cProtIntGenMixRivers(Underlying a_Biomes, Underlying a_Rivers):
m_Biomes(a_Biomes),
m_Rivers(a_Rivers)
@@ -1173,11 +1191,12 @@ data changes from one pixel to its neighbor. */
class cProtIntGenRiver:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
+
cProtIntGenRiver(int a_Seed, Underlying a_Underlying):
- super(a_Seed),
+ Super(a_Seed),
m_Underlying(a_Underlying)
{
}
@@ -1229,11 +1248,12 @@ The biome is only placed if at least 3 of its neighbors are ocean and only with
class cProtIntGenAddToOcean:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
+
cProtIntGenAddToOcean(int a_Seed, int a_Chance, int a_ToValue, Underlying a_Underlying):
- super(a_Seed),
+ Super(a_Seed),
m_Chance(a_Chance),
m_ToValue(a_ToValue),
m_Underlying(a_Underlying)
@@ -1288,7 +1308,7 @@ public:
// If at least 3 ocean neighbors and the chance is right, change:
if (
(NumOceanNeighbors >= 3) &&
- ((super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7) % 1000 < m_Chance)
+ ((Super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7) % 1000 < m_Chance)
)
{
a_Values[x + z * a_SizeX] = m_ToValue;
@@ -1316,14 +1336,15 @@ protected:
/** Changes random pixels of the underlying data to the specified value. */
-class cProtIntGenSetRandomly :
+class cProtIntGenSetRandomly:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
- cProtIntGenSetRandomly(int a_Seed, int a_Chance, int a_ToValue, Underlying a_Underlying) :
- super(a_Seed),
+
+ cProtIntGenSetRandomly(int a_Seed, int a_Chance, int a_ToValue, Underlying a_Underlying):
+ Super(a_Seed),
m_Chance(a_Chance),
m_ToValue(a_ToValue),
m_Underlying(a_Underlying)
@@ -1341,7 +1362,7 @@ public:
{
for (size_t x = 0; x < a_SizeX; x++)
{
- int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
+ int rnd = Super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
if (rnd % 1000 < m_Chance)
{
a_Values[x + z * a_SizeX] = m_ToValue;
@@ -1368,11 +1389,12 @@ protected:
class cProtIntGenRareBiomeGroups:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
+
cProtIntGenRareBiomeGroups(int a_Seed, int a_Chance, Underlying a_Underlying):
- super(a_Seed),
+ Super(a_Seed),
m_Chance(a_Chance),
m_Underlying(a_Underlying)
{
@@ -1389,7 +1411,7 @@ public:
{
for (size_t x = 0; x < a_SizeX; x++)
{
- int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
+ int rnd = Super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
if (rnd % 1000 < m_Chance)
{
size_t idx = x + a_SizeX * z;
@@ -1416,11 +1438,12 @@ that have their alterations set. */
class cProtIntGenAlternateBiomes:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
+
cProtIntGenAlternateBiomes(int a_Seed, Underlying a_Alterations, Underlying a_BaseBiomes):
- super(a_Seed),
+ Super(a_Seed),
m_Alterations(a_Alterations),
m_BaseBiomes(a_BaseBiomes)
{
@@ -1481,11 +1504,12 @@ protected:
class cProtIntGenBiomeEdges:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
+
cProtIntGenBiomeEdges(int a_Seed, Underlying a_Underlying):
- super(a_Seed),
+ Super(a_Seed),
m_Underlying(a_Underlying)
{
}
@@ -1640,11 +1664,12 @@ have their alterations set. */
class cProtIntGenMBiomes:
public cProtIntGenWithNoise
{
- typedef cProtIntGenWithNoise super;
+ using Super = cProtIntGenWithNoise;
public:
+
cProtIntGenMBiomes(int a_Seed, Underlying a_Alteration, Underlying a_Underlying):
- super(a_Seed),
+ Super(a_Seed),
m_Underlying(a_Underlying),
m_Alteration(a_Alteration)
{
diff --git a/src/Generating/Ravines.cpp b/src/Generating/Ravines.cpp
index f1d5fdb23..a9574a8b7 100644
--- a/src/Generating/Ravines.cpp
+++ b/src/Generating/Ravines.cpp
@@ -33,16 +33,16 @@ struct cRavDefPoint
}
} ;
-typedef std::vector<cRavDefPoint> cRavDefPoints;
+using cRavDefPoints = std::vector<cRavDefPoint>;
-class cStructGenRavines::cRavine :
+class cStructGenRavines::cRavine:
public cGridStructGen::cStructure
{
- typedef cGridStructGen::cStructure super;
+ using Super = cGridStructGen::cStructure;
cRavDefPoints m_Points;
@@ -81,7 +81,7 @@ protected:
// cStructGenRavines:
cStructGenRavines::cStructGenRavines(int a_Seed, int a_Size) :
- super(a_Seed, a_Size, a_Size, a_Size, a_Size, a_Size * 2, a_Size * 2, 100),
+ Super(a_Seed, a_Size, a_Size, a_Size, a_Size, a_Size * 2, a_Size * 2, 100),
m_Size(a_Size)
{
}
@@ -103,7 +103,7 @@ cGridStructGen::cStructurePtr cStructGenRavines::CreateStructure(int a_GridX, in
// cStructGenRavines::cRavine
cStructGenRavines::cRavine::cRavine(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_Size, cNoise & a_Noise) :
- super(a_GridX, a_GridZ, a_OriginX, a_OriginZ)
+ Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ)
{
// Calculate the ravine shape-defining points:
GenerateBaseDefPoints(a_OriginX, a_OriginZ, a_Size, a_Noise);
diff --git a/src/Generating/Ravines.h b/src/Generating/Ravines.h
index bcfdcc0d2..d1d0e0076 100644
--- a/src/Generating/Ravines.h
+++ b/src/Generating/Ravines.h
@@ -15,18 +15,19 @@
-class cStructGenRavines :
+class cStructGenRavines:
public cGridStructGen
{
- typedef cGridStructGen super;
+ using Super = cGridStructGen;
public:
+
cStructGenRavines(int a_Seed, int a_Size);
protected:
class cRavine; // fwd: Ravines.cpp
- int m_Size; // Max size, in blocks, of the ravines generated
+ int m_Size; // Max size, in blocks, of the ravines generated
// cGridStructGen overrides:
diff --git a/src/Generating/RoughRavines.cpp b/src/Generating/RoughRavines.cpp
index a65f57268..fe425757f 100644
--- a/src/Generating/RoughRavines.cpp
+++ b/src/Generating/RoughRavines.cpp
@@ -15,20 +15,21 @@
////////////////////////////////////////////////////////////////////////////////
// cRoughRavine:
-class cRoughRavine :
+class cRoughRavine:
public cGridStructGen::cStructure
{
- typedef cGridStructGen::cStructure super;
+ using Super = cGridStructGen::cStructure;
public:
+
cRoughRavine(
int a_Seed, size_t a_Size,
float a_CenterWidth, float a_Roughness,
float a_FloorHeightEdge1, float a_FloorHeightEdge2, float a_FloorHeightCenter,
float a_CeilingHeightEdge1, float a_CeilingHeightEdge2, float a_CeilingHeightCenter,
int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ
- ) :
- super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
+ ):
+ Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Seed(a_Seed + 100),
m_Noise(a_Seed + 100),
m_Roughness(a_Roughness)
@@ -72,7 +73,7 @@ protected:
m_Bottom = a_Bottom;
}
};
- typedef std::vector<sRavineDefPoint> sRavineDefPoints;
+ using sRavineDefPoints = std::vector<sRavineDefPoint>;
int m_Seed;
@@ -231,7 +232,7 @@ cRoughRavines::cRoughRavines(
float a_MaxCeilingHeightCenter, float a_MinCeilingHeightCenter,
int a_GridSize, int a_MaxOffset
) :
- super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 64),
+ Super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 64),
m_MaxSize(a_MaxSize),
m_MinSize(a_MinSize),
m_MaxCenterWidth(a_MaxCenterWidth),
diff --git a/src/Generating/RoughRavines.h b/src/Generating/RoughRavines.h
index b326d7345..88b2f2e6d 100644
--- a/src/Generating/RoughRavines.h
+++ b/src/Generating/RoughRavines.h
@@ -14,12 +14,13 @@
-class cRoughRavines :
+class cRoughRavines:
public cGridStructGen
{
- typedef cGridStructGen super;
+ using Super = cGridStructGen;
public:
+
cRoughRavines(
int a_Seed,
int a_MaxSize, int a_MinSize,
diff --git a/src/Generating/TwoHeights.cpp b/src/Generating/TwoHeights.cpp
index dd05fe835..15c48eb26 100644
--- a/src/Generating/TwoHeights.cpp
+++ b/src/Generating/TwoHeights.cpp
@@ -17,8 +17,10 @@
class cTwoHeights:
public cTerrainShapeGen
{
- typedef cTerrainShapeGen super;
+ using Super = cTerrainShapeGen;
+
public:
+
cTwoHeights(int a_Seed, cBiomeGenPtr a_BiomeGen):
m_Seed(a_Seed),
m_Choice(a_Seed),
diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp
index 340d9adb8..21d6e30d4 100644
--- a/src/Generating/VillageGen.cpp
+++ b/src/Generating/VillageGen.cpp
@@ -37,16 +37,18 @@ per-village density setting, the cVillage class itself implements the cPiecePool
calls to the underlying cVillagePiecePool, after processing the density check.
*/
-class cVillagePiecePool :
+class cVillagePiecePool:
public cPrefabPiecePool
{
- typedef cPrefabPiecePool super;
+ using Super = cPrefabPiecePool;
+
public:
+
cVillagePiecePool(
const cPrefab::sDef * a_PieceDefs, size_t a_NumPieceDefs,
const cPrefab::sDef * a_StartingPieceDefs, size_t a_NumStartingPieceDefs
- ) :
- super(a_PieceDefs, a_NumPieceDefs, a_StartingPieceDefs, a_NumStartingPieceDefs)
+ ):
+ Super(a_PieceDefs, a_NumPieceDefs, a_StartingPieceDefs, a_NumStartingPieceDefs)
{
AddRoadPieces();
}
@@ -107,13 +109,14 @@ public:
-class cVillageGen::cVillage :
+class cVillageGen::cVillage:
public cGridStructGen::cStructure,
protected cPiecePool
{
- typedef cGridStructGen::cStructure super;
+ using Super = cGridStructGen::cStructure;
public:
+
cVillage(
int a_Seed,
int a_GridX, int a_GridZ,
@@ -123,8 +126,8 @@ public:
int a_Density,
cVillagePiecePool & a_Prefabs,
cTerrainHeightGenPtr a_HeightGen
- ) :
- super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
+ ):
+ Super(a_GridX, a_GridZ, a_OriginX, a_OriginZ),
m_Seed(a_Seed),
m_Noise(a_Seed),
m_MaxSize(a_MaxSize),
@@ -339,7 +342,7 @@ cVillageGen::cVillageGen(
int a_SeaLevel,
const AStringVector & a_PrefabsToLoad
) :
- super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 100),
+ Super(a_Seed, a_GridSize, a_GridSize, a_MaxOffset, a_MaxOffset, a_MaxSize, a_MaxSize, 100),
m_RandNoise(a_Seed + 1000),
m_MaxDepth(a_MaxDepth),
m_MaxSize(a_MaxSize),
diff --git a/src/Generating/VillageGen.h b/src/Generating/VillageGen.h
index 9de8552b1..42c5b7bb0 100644
--- a/src/Generating/VillageGen.h
+++ b/src/Generating/VillageGen.h
@@ -23,11 +23,13 @@ class cVillagePiecePool;
-class cVillageGen :
+class cVillageGen:
public cGridStructGen
{
- typedef cGridStructGen super;
+ using Super = cGridStructGen;
+
public:
+
/** Creates a new instance of the generator with the specified parameters. */
cVillageGen(
int a_Seed,