1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-16 18:01:40 +00:00

Fix broken BiomeGen abstraction (#11107)

This commit is contained in:
sfan5 2021-03-23 15:43:26 +01:00 committed by GitHub
parent c9eba8440d
commit 2da1eee394
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 92 additions and 187 deletions

View file

@ -97,6 +97,15 @@ public:
virtual BiomeGenType getType() const = 0;
// Clone this BiomeGen and set a the new BiomeManager to be used by the copy
virtual BiomeGen *clone(BiomeManager *biomemgr) const = 0;
// Check that the internal chunk size is what the mapgen expects, just to be sure.
inline void assertChunkSize(v3s16 expect) const
{
FATAL_ERROR_IF(m_csize != expect, "Chunk size mismatches");
}
// Calculates the biome at the exact position provided. This function can
// be called at any time, but may be less efficient than the latter methods,
// depending on implementation.
@ -158,12 +167,18 @@ struct BiomeParamsOriginal : public BiomeParams {
class BiomeGenOriginal : public BiomeGen {
public:
BiomeGenOriginal(BiomeManager *biomemgr,
BiomeParamsOriginal *params, v3s16 chunksize);
const BiomeParamsOriginal *params, v3s16 chunksize);
virtual ~BiomeGenOriginal();
BiomeGenType getType() const { return BIOMEGEN_ORIGINAL; }
BiomeGen *clone(BiomeManager *biomemgr) const;
// Slower, meant for Script API use
float calcHeatAtPoint(v3s16 pos) const;
float calcHumidityAtPoint(v3s16 pos) const;
Biome *calcBiomeAtPoint(v3s16 pos) const;
void calcBiomeNoise(v3s16 pmin);
biome_t *getBiomes(s16 *heightmap, v3s16 pmin);
@ -176,7 +191,7 @@ public:
float *humidmap;
private:
BiomeParamsOriginal *m_params;
const BiomeParamsOriginal *m_params;
Noise *noise_heat;
Noise *noise_humidity;
@ -229,14 +244,6 @@ public:
virtual void clear();
// For BiomeGen type 'BiomeGenOriginal'
float getHeatAtPosOriginal(v3s16 pos, NoiseParams &np_heat,
NoiseParams &np_heat_blend, u64 seed) const;
float getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity,
NoiseParams &np_humidity_blend, u64 seed) const;
const Biome *getBiomeFromNoiseOriginal(float heat, float humidity,
v3s16 pos) const;
private:
BiomeManager() {};