diff options
author | Mattes D <github@xoft.cz> | 2020-04-13 18:38:06 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2020-04-16 22:07:48 +0200 |
commit | 9ee47e59995f858ec531b3ee467f131594e4ba1f (patch) | |
tree | f005d8af4a0362d7eab8a96a71aca0d73275f8e1 /src/Generating/IntGen.h | |
parent | Prevent crash when breeding (diff) | |
download | cuberite-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/IntGen.h')
-rw-r--r-- | src/Generating/IntGen.h | 235 |
1 files changed, 130 insertions, 105 deletions
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: |