summaryrefslogtreecommitdiffstats
path: root/src/Generating
diff options
context:
space:
mode:
Diffstat (limited to 'src/Generating')
-rw-r--r--src/Generating/BioGen.cpp101
-rw-r--r--src/Generating/BioGen.h43
-rw-r--r--src/Generating/ComposableGenerator.cpp4
-rw-r--r--src/Generating/ComposableGenerator.h2
-rw-r--r--src/Generating/CompositedHeiGen.h2
-rw-r--r--src/Generating/DistortedHeightmap.cpp2
-rw-r--r--src/Generating/HeiGen.cpp4
-rw-r--r--src/Generating/Noise3DGenerator.cpp2
-rw-r--r--src/Generating/StructGen.cpp2
-rw-r--r--src/Generating/VillageGen.cpp2
10 files changed, 77 insertions, 87 deletions
diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp
index 4439fd901..c84cb559d 100644
--- a/src/Generating/BioGen.cpp
+++ b/src/Generating/BioGen.cpp
@@ -18,8 +18,9 @@
////////////////////////////////////////////////////////////////////////////////
// cBioGenConstant:
-void cBioGenConstant::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenConstant::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
+ UNUSED(a_ChunkCoords);
for (size_t i = 0; i < ARRAYCOUNT(a_BiomeMap); i++)
{
a_BiomeMap[i] = m_Biome;
@@ -59,17 +60,15 @@ void cBioGenConstant::InitializeBiomeGen(cIniFile & a_IniFile)
cBioGenCache::cBioGenCache(cBiomeGenPtr a_BioGenToCache, size_t a_CacheSize) :
m_BioGenToCache(a_BioGenToCache),
m_CacheSize(a_CacheSize),
- m_CacheOrder(new size_t[a_CacheSize]),
- m_CacheData(new sCacheData[a_CacheSize]),
m_NumHits(0),
m_NumMisses(0),
m_TotalChain(0)
{
+ m_CacheData.resize(m_CacheSize);
+ m_CacheOrder.resize(m_CacheSize);
for (size_t i = 0; i < m_CacheSize; i++)
{
m_CacheOrder[i] = i;
- m_CacheData[i].m_ChunkX = 0x7fffffff;
- m_CacheData[i].m_ChunkZ = 0x7fffffff;
}
}
@@ -77,19 +76,7 @@ cBioGenCache::cBioGenCache(cBiomeGenPtr a_BioGenToCache, size_t a_CacheSize) :
-cBioGenCache::~cBioGenCache()
-{
- delete[] m_CacheData;
- m_CacheData = nullptr;
- delete[] m_CacheOrder;
- m_CacheOrder = nullptr;
-}
-
-
-
-
-
-void cBioGenCache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenCache::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
if (((m_NumHits + m_NumMisses) % 1024) == 10)
{
@@ -99,10 +86,7 @@ void cBioGenCache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a
for (size_t i = 0; i < m_CacheSize; i++)
{
- if (
- (m_CacheData[m_CacheOrder[i]].m_ChunkX != a_ChunkX) ||
- (m_CacheData[m_CacheOrder[i]].m_ChunkZ != a_ChunkZ)
- )
+ if (m_CacheData[m_CacheOrder[i]].m_Coords != a_ChunkCoords)
{
continue;
}
@@ -126,7 +110,7 @@ void cBioGenCache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a
// Not in the cache:
m_NumMisses++;
- m_BioGenToCache->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap);
+ m_BioGenToCache->GenBiomes(a_ChunkCoords, a_BiomeMap);
// Insert it as the first item in the MRU order:
size_t Idx = m_CacheOrder[m_CacheSize - 1];
@@ -136,8 +120,7 @@ void cBioGenCache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a
} // for i - m_CacheOrder[]
m_CacheOrder[0] = Idx;
memcpy(m_CacheData[Idx].m_BiomeMap, a_BiomeMap, sizeof(a_BiomeMap));
- m_CacheData[Idx].m_ChunkX = a_ChunkX;
- m_CacheData[Idx].m_ChunkZ = a_ChunkZ;
+ m_CacheData[Idx].m_Coords = a_ChunkCoords;
}
@@ -170,12 +153,12 @@ cBioGenMulticache::cBioGenMulticache(cBiomeGenPtr a_BioGenToCache, size_t a_SubC
-void cBioGenMulticache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenMulticache::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
const size_t coefficient = 3;
- const size_t cacheIdx = (static_cast<size_t>(a_ChunkX) + coefficient * static_cast<size_t>(a_ChunkZ)) % m_NumSubCaches;
+ const size_t cacheIdx = (static_cast<size_t>(a_ChunkCoords.m_ChunkX) + coefficient * static_cast<size_t>(a_ChunkCoords.m_ChunkZ)) % m_NumSubCaches;
- m_Caches[cacheIdx]->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap);
+ m_Caches[cacheIdx]->GenBiomes(a_ChunkCoords, a_BiomeMap);
}
@@ -277,14 +260,14 @@ void cBiomeGenList::InitializeBiomes(const AString & a_Biomes)
////////////////////////////////////////////////////////////////////////////////
// cBioGenCheckerboard:
-void cBioGenCheckerboard::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenCheckerboard::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
for (int z = 0; z < cChunkDef::Width; z++)
{
- int Base = (cChunkDef::Width * a_ChunkZ + z) / m_BiomeSize;
+ int Base = (cChunkDef::Width * a_ChunkCoords.m_ChunkZ + z) / m_BiomeSize;
for (int x = 0; x < cChunkDef::Width; x++)
{
- int Add = cChunkDef::Width * a_ChunkX + x;
+ int Add = cChunkDef::Width * a_ChunkCoords.m_ChunkX + x;
size_t BiomeIdx = static_cast<size_t>((((Base + Add / m_BiomeSize) % m_BiomesCount) + m_BiomesCount) % m_BiomesCount); // Need to add and modulo twice because of negative numbers
a_BiomeMap[x + cChunkDef::Width * z] = m_Biomes[BiomeIdx];
}
@@ -311,10 +294,10 @@ void cBioGenCheckerboard::InitializeBiomeGen(cIniFile & a_IniFile)
////////////////////////////////////////////////////////////////////////////////
// cBioGenVoronoi :
-void cBioGenVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenVoronoi::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
- int BaseZ = cChunkDef::Width * a_ChunkZ;
- int BaseX = cChunkDef::Width * a_ChunkX;
+ int BaseZ = cChunkDef::Width * a_ChunkCoords.m_ChunkZ;
+ int BaseX = cChunkDef::Width * a_ChunkCoords.m_ChunkX;
for (int z = 0; z < cChunkDef::Width; z++)
{
int AbsoluteZ = BaseZ + z;
@@ -349,10 +332,10 @@ void cBioGenVoronoi::InitializeBiomeGen(cIniFile & a_IniFile)
////////////////////////////////////////////////////////////////////////////////
// cBioGenDistortedVoronoi:
-void cBioGenDistortedVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenDistortedVoronoi::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
- int BaseZ = cChunkDef::Width * a_ChunkZ;
- int BaseX = cChunkDef::Width * a_ChunkX;
+ int BaseZ = cChunkDef::Width * a_ChunkCoords.m_ChunkZ;
+ int BaseX = cChunkDef::Width * a_ChunkCoords.m_ChunkX;
// Distortions for linear interpolation:
int DistortX[cChunkDef::Width + 1][cChunkDef::Width + 1];
@@ -444,24 +427,24 @@ void cBioGenMultiStepMap::InitializeBiomeGen(cIniFile & a_IniFile)
-void cBioGenMultiStepMap::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenMultiStepMap::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
- DecideOceanLandMushroom(a_ChunkX, a_ChunkZ, a_BiomeMap);
- AddRivers(a_ChunkX, a_ChunkZ, a_BiomeMap);
- ApplyTemperatureHumidity(a_ChunkX, a_ChunkZ, a_BiomeMap);
+ DecideOceanLandMushroom(a_ChunkCoords, a_BiomeMap);
+ AddRivers(a_ChunkCoords, a_BiomeMap);
+ ApplyTemperatureHumidity(a_ChunkCoords, a_BiomeMap);
}
-void cBioGenMultiStepMap::DecideOceanLandMushroom(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenMultiStepMap::DecideOceanLandMushroom(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
// Distorted Voronoi over 3 biomes, with mushroom having only a special occurence.
// Prepare a distortion lookup table, by distorting a 5x5 area and using that as 1:4 zoom (linear interpolate):
- int BaseZ = cChunkDef::Width * a_ChunkZ;
- int BaseX = cChunkDef::Width * a_ChunkX;
+ int BaseZ = cChunkDef::Width * a_ChunkCoords.m_ChunkZ;
+ int BaseX = cChunkDef::Width * a_ChunkCoords.m_ChunkX;
int DistortX[cChunkDef::Width + 1][cChunkDef::Width + 1];
int DistortZ[cChunkDef::Width + 1][cChunkDef::Width + 1];
int DistortSize = m_OceanCellSize / 2;
@@ -558,11 +541,11 @@ void cBioGenMultiStepMap::DecideOceanLandMushroom(int a_ChunkX, int a_ChunkZ, cC
-void cBioGenMultiStepMap::AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenMultiStepMap::AddRivers(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
for (int z = 0; z < cChunkDef::Width; z++)
{
- float NoiseCoordZ = static_cast<float>(a_ChunkZ * cChunkDef::Width + z) / m_RiverCellSize;
+ float NoiseCoordZ = static_cast<float>(a_ChunkCoords.m_ChunkZ * cChunkDef::Width + z) / m_RiverCellSize;
for (int x = 0; x < cChunkDef::Width; x++)
{
if (cChunkDef::GetBiome(a_BiomeMap, x, z) != biInvalidBiome)
@@ -571,7 +554,7 @@ void cBioGenMultiStepMap::AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::Biome
continue;
}
- float NoiseCoordX = static_cast<float>(a_ChunkX * cChunkDef::Width + x) / m_RiverCellSize;
+ float NoiseCoordX = static_cast<float>(a_ChunkCoords.m_ChunkX * cChunkDef::Width + x) / m_RiverCellSize;
double Noise = m_Noise1.CubicNoise2D( NoiseCoordX, NoiseCoordZ);
Noise += 0.5 * m_Noise3.CubicNoise2D(2 * NoiseCoordX, 2 * NoiseCoordZ);
@@ -589,11 +572,11 @@ void cBioGenMultiStepMap::AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::Biome
-void cBioGenMultiStepMap::ApplyTemperatureHumidity(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenMultiStepMap::ApplyTemperatureHumidity(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
IntMap TemperatureMap;
IntMap HumidityMap;
- BuildTemperatureHumidityMaps(a_ChunkX, a_ChunkZ, TemperatureMap, HumidityMap);
+ BuildTemperatureHumidityMaps(a_ChunkCoords, TemperatureMap, HumidityMap);
FreezeWaterBiomes(a_BiomeMap, TemperatureMap);
DecideLandBiomes(a_BiomeMap, TemperatureMap, HumidityMap);
@@ -620,17 +603,17 @@ void cBioGenMultiStepMap::Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX
-void cBioGenMultiStepMap::BuildTemperatureHumidityMaps(int a_ChunkX, int a_ChunkZ, IntMap & a_TemperatureMap, IntMap & a_HumidityMap)
+void cBioGenMultiStepMap::BuildTemperatureHumidityMaps(cChunkCoords a_ChunkCoords, IntMap & a_TemperatureMap, IntMap & a_HumidityMap)
{
// Linear interpolation over 8x8 blocks; use double for better precision:
DblMap TemperatureMap;
DblMap HumidityMap;
for (int z = 0; z < 17; z += 8)
{
- float NoiseCoordZ = static_cast<float>(a_ChunkZ * cChunkDef::Width + z) / m_LandBiomesSize;
+ float NoiseCoordZ = static_cast<float>(a_ChunkCoords.m_ChunkZ * cChunkDef::Width + z) / m_LandBiomesSize;
for (int x = 0; x < 17; x += 8)
{
- float NoiseCoordX = static_cast<float>(a_ChunkX * cChunkDef::Width + x) / m_LandBiomesSize;
+ float NoiseCoordX = static_cast<float>(a_ChunkCoords.m_ChunkX * cChunkDef::Width + x) / m_LandBiomesSize;
double NoiseT = m_Noise1.CubicNoise2D( NoiseCoordX, NoiseCoordZ);
NoiseT += 0.5 * m_Noise2.CubicNoise2D(2 * NoiseCoordX, 2 * NoiseCoordZ);
@@ -760,10 +743,10 @@ cBioGenTwoLevel::cBioGenTwoLevel(int a_Seed) :
-void cBioGenTwoLevel::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
+void cBioGenTwoLevel::GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap)
{
- int BaseZ = cChunkDef::Width * a_ChunkZ;
- int BaseX = cChunkDef::Width * a_ChunkX;
+ int BaseZ = cChunkDef::Width * a_ChunkCoords.m_ChunkZ;
+ int BaseX = cChunkDef::Width * a_ChunkCoords.m_ChunkX;
// Distortions for linear interpolation:
int DistortX[cChunkDef::Width + 1][cChunkDef::Width + 1];
@@ -1022,10 +1005,10 @@ public:
)))));
}
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_Biomes) override
{
cIntGen<16, 16>::Values vals;
- m_Gen->GetInts(a_ChunkX * cChunkDef::Width, a_ChunkZ * cChunkDef::Width, vals);
+ m_Gen->GetInts(a_ChunkCoords.m_ChunkX * cChunkDef::Width, a_ChunkCoords.m_ChunkZ * cChunkDef::Width, vals);
for (int z = 0; z < cChunkDef::Width; z++)
{
for (int x = 0; x < cChunkDef::Width; x++)
@@ -1126,10 +1109,10 @@ public:
)))));
}
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_Biomes) override
{
int vals[16 * 16];
- m_Gen->GetInts(a_ChunkX * cChunkDef::Width, a_ChunkZ * cChunkDef::Width, 16, 16, vals);
+ m_Gen->GetInts(a_ChunkCoords.m_ChunkX * cChunkDef::Width, a_ChunkCoords.m_ChunkZ * cChunkDef::Width, 16, 16, vals);
for (int z = 0; z < cChunkDef::Width; z++)
{
for (int x = 0; x < cChunkDef::Width; x++)
diff --git a/src/Generating/BioGen.h b/src/Generating/BioGen.h
index 104916761..c20babde0 100644
--- a/src/Generating/BioGen.h
+++ b/src/Generating/BioGen.h
@@ -33,7 +33,7 @@ protected:
EMCSBiome m_Biome;
// cBiomeGen overrides:
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
} ;
@@ -48,8 +48,10 @@ class cBioGenCache :
typedef cBiomeGen super;
public:
+
cBioGenCache(cBiomeGenPtr a_BioGenToCache, size_t a_CacheSize);
- virtual ~cBioGenCache() override;
+ virtual ~cBioGenCache() override = default;
+
protected:
@@ -57,22 +59,27 @@ protected:
struct sCacheData
{
- int m_ChunkX;
- int m_ChunkZ;
+ cChunkCoords m_Coords;
cChunkDef::BiomeMap m_BiomeMap;
+
+ /** Default constructor: Fill in bogus coords so that the item is not used in the cache until properly calculated. */
+ sCacheData():
+ m_Coords(0x7fffffff, 0x7fffffff)
+ {
+ }
} ;
// To avoid moving large amounts of data for the MRU behavior, we MRU-ize indices to an array of the actual data
- size_t m_CacheSize;
- size_t * m_CacheOrder; // MRU-ized order, indices into m_CacheData array
- sCacheData * m_CacheData; // m_CacheData[m_CacheOrder[0]] is the most recently used
+ size_t m_CacheSize;
+ std::vector<size_t> m_CacheOrder; // MRU-ized order, indices into m_CacheData array
+ std::vector<sCacheData> m_CacheData; // m_CacheData[m_CacheOrder[0]] is the most recently used
// Cache statistics
size_t m_NumHits;
size_t m_NumMisses;
size_t m_TotalChain; // Number of cache items walked to get to a hit (only added for hits)
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
} ;
@@ -104,7 +111,7 @@ protected:
cBiomeGenPtrs m_Caches;
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
};
@@ -141,7 +148,7 @@ protected:
int m_BiomeSize;
// cBiomeGen overrides:
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
} ;
@@ -164,7 +171,7 @@ protected:
cVoronoiMap m_Voronoi;
// cBiomeGen overrides:
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
EMCSBiome VoronoiBiome(int a_BlockX, int a_BlockZ);
@@ -198,7 +205,7 @@ protected:
int m_CellSize;
// cBiomeGen overrides:
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
/** Distorts the coords using a Perlin-like noise */
@@ -237,26 +244,26 @@ protected:
typedef double DblMap[17 * 17]; // x + 17 * z, expected trimmed into [0..1] range
// cBiomeGen overrides:
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
/** Step 1: Decides between ocean, land and mushroom, using a DistVoronoi with special conditions and post-processing for mushroom islands
Sets biomes to biOcean, -1 (i.e. land), biMushroomIsland or biMushroomShore. */
- void DecideOceanLandMushroom(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap);
+ void DecideOceanLandMushroom(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap);
/** Step 2: Add rivers to the land
Flips some "-1" biomes into biRiver. */
- void AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap);
+ void AddRivers(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap);
/** Step 3: Decide land biomes using a temperature / humidity map; freeze ocean / river in low temperatures.
Flips all remaining "-1" biomes into land biomes. Also flips some biOcean and biRiver into biFrozenOcean, biFrozenRiver, based on temp map. */
- void ApplyTemperatureHumidity(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap);
+ void ApplyTemperatureHumidity(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap);
/** Distorts the coords using a Perlin-like noise, with a specified cell-size */
void Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ, int a_CellSize);
/** Builds two Perlin-noise maps, one for temperature, the other for humidity. Trims both into [0..255] range */
- void BuildTemperatureHumidityMaps(int a_ChunkX, int a_ChunkZ, IntMap & a_TemperatureMap, IntMap & a_HumidityMap);
+ void BuildTemperatureHumidityMaps(cChunkCoords a_ChunkCoords, IntMap & a_TemperatureMap, IntMap & a_HumidityMap);
/** Flips all remaining "-1" biomes into land biomes using the two maps */
void DecideLandBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap, const IntMap & a_HumidityMap);
@@ -302,7 +309,7 @@ protected:
// cBiomeGen overrides:
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) override;
virtual void InitializeBiomeGen(cIniFile & a_IniFile) override;
/** Selects biome from the specified biome group, based on the specified index.
diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp
index 3bf2c4339..65278051a 100644
--- a/src/Generating/ComposableGenerator.cpp
+++ b/src/Generating/ComposableGenerator.cpp
@@ -145,7 +145,7 @@ void cComposableGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef:
{
if (m_BiomeGen != nullptr) // Quick fix for generator deinitializing before the world storage finishes loading
{
- m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap);
+ m_BiomeGen->GenBiomes({a_ChunkX, a_ChunkZ}, a_BiomeMap);
}
}
@@ -157,7 +157,7 @@ void cComposableGenerator::Generate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_C
{
if (a_ChunkDesc.IsUsingDefaultBiomes())
{
- m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, a_ChunkDesc.GetBiomeMap());
+ m_BiomeGen->GenBiomes(a_ChunkDesc.GetChunkCoords(), a_ChunkDesc.GetBiomeMap());
}
cChunkDesc::Shape shape;
diff --git a/src/Generating/ComposableGenerator.h b/src/Generating/ComposableGenerator.h
index 0bc5195e9..3007d9824 100644
--- a/src/Generating/ComposableGenerator.h
+++ b/src/Generating/ComposableGenerator.h
@@ -50,7 +50,7 @@ public:
virtual ~cBiomeGen() {} // Force a virtual destructor in descendants
/** Generates biomes for the given chunk */
- virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) = 0;
+ virtual void GenBiomes(cChunkCoords a_ChunkCoords, cChunkDef::BiomeMap & a_BiomeMap) = 0;
/** Reads parameters from the ini file, prepares generator for use. */
virtual void InitializeBiomeGen(cIniFile & a_IniFile) {}
diff --git a/src/Generating/CompositedHeiGen.h b/src/Generating/CompositedHeiGen.h
index 2db781e04..d7be3c8ac 100644
--- a/src/Generating/CompositedHeiGen.h
+++ b/src/Generating/CompositedHeiGen.h
@@ -35,7 +35,7 @@ public:
cChunkDesc::Shape shape;
m_ShapeGen->GenShape(a_ChunkX, a_ChunkZ, shape);
cChunkDesc desc({a_ChunkX, a_ChunkZ});
- m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, desc.GetBiomeMap()); // Need to initialize biomes for the composition gen
+ m_BiomeGen->GenBiomes({a_ChunkX, a_ChunkZ}, desc.GetBiomeMap()); // Need to initialize biomes for the composition gen
desc.SetHeightFromShape(shape);
m_CompositionGen->ComposeTerrain(desc, shape);
memcpy(a_HeightMap, desc.GetHeightMap(), sizeof(a_HeightMap));
diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp
index a230f1b2b..713a63145 100644
--- a/src/Generating/DistortedHeightmap.cpp
+++ b/src/Generating/DistortedHeightmap.cpp
@@ -299,7 +299,7 @@ void cDistortedHeightmap::UpdateDistortAmps(void)
{
for (int x = -1; x <= 1; x++)
{
- m_BiomeGen->GenBiomes(m_CurChunkX + x, m_CurChunkZ + z, Biomes[x + 1][z + 1]);
+ m_BiomeGen->GenBiomes({m_CurChunkX + x, m_CurChunkZ + z}, Biomes[x + 1][z + 1]);
} // for x
} // for z
diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp
index 20e8b966f..2f7af0a36 100644
--- a/src/Generating/HeiGen.cpp
+++ b/src/Generating/HeiGen.cpp
@@ -531,7 +531,7 @@ void cHeiGenBiomal::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMa
{
for (int x = -1; x <= 1; x++)
{
- m_BiomeGen->GenBiomes(a_ChunkX + x, a_ChunkZ + z, Biomes[x + 1][z + 1]);
+ m_BiomeGen->GenBiomes({a_ChunkX + x, a_ChunkZ + z}, Biomes[x + 1][z + 1]);
} // for x
} // for z
@@ -696,7 +696,7 @@ public:
cChunkDef::BiomeMap neighborBiomes[3][3];
for (int z = 0; z < 3; z++) for (int x = 0; x < 3; x++)
{
- m_BiomeGen->GenBiomes(a_ChunkX + x - 1, a_ChunkZ + z - 1, neighborBiomes[z][x]);
+ m_BiomeGen->GenBiomes({a_ChunkX + x - 1, a_ChunkZ + z - 1}, neighborBiomes[z][x]);
}
// Get the min and max heights based on the biomes:
diff --git a/src/Generating/Noise3DGenerator.cpp b/src/Generating/Noise3DGenerator.cpp
index 64f5ed05f..edef4001e 100644
--- a/src/Generating/Noise3DGenerator.cpp
+++ b/src/Generating/Noise3DGenerator.cpp
@@ -663,7 +663,7 @@ void cBiomalNoise3DComposable::CalcBiomeParamArrays(int a_ChunkX, int a_ChunkZ,
{
for (int x = 0; x < 3; x++)
{
- m_BiomeGen->GenBiomes(a_ChunkX + x - 1, a_ChunkZ + z - 1, neighborBiomes[x + 3 * z]);
+ m_BiomeGen->GenBiomes({a_ChunkX + x - 1, a_ChunkZ + z - 1}, neighborBiomes[x + 3 * z]);
}
}
diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp
index 266308983..35e9b8991 100644
--- a/src/Generating/StructGen.cpp
+++ b/src/Generating/StructGen.cpp
@@ -39,7 +39,7 @@ void cStructGenTrees::GenFinish(cChunkDesc & a_ChunkDesc)
// TODO: This may cause a lot of wasted calculations, instead of pulling data out of a single (cChunkDesc) cache
cChunkDesc::Shape workerShape;
- m_BiomeGen->GenBiomes (BaseX, BaseZ, WorkerDesc.GetBiomeMap());
+ m_BiomeGen->GenBiomes ({BaseX, BaseZ}, WorkerDesc.GetBiomeMap());
m_ShapeGen->GenShape (BaseX, BaseZ, workerShape);
WorkerDesc.SetHeightFromShape (workerShape);
m_CompositionGen->ComposeTerrain(WorkerDesc, workerShape);
diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp
index 5473965d6..48bf9e467 100644
--- a/src/Generating/VillageGen.cpp
+++ b/src/Generating/VillageGen.cpp
@@ -375,7 +375,7 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_GridX, int a_Gr
int ChunkX, ChunkZ;
cChunkDef::BlockToChunk(a_OriginX, a_OriginZ, ChunkX, ChunkZ);
cChunkDef::BiomeMap Biomes;
- m_BiomeGen->GenBiomes(ChunkX, ChunkZ, Biomes);
+ m_BiomeGen->GenBiomes({ChunkX, ChunkZ}, Biomes);
// Get a list of pools that support each biome within the chunk:
// If just one column's biome is not allowed, the pool is not used because it's likely that an unfriendly biome is too close