aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen/mg_biome.h
diff options
context:
space:
mode:
authorElias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com>2020-11-04 16:44:42 +0100
committerGitHub <noreply@github.com>2020-11-04 16:44:42 +0100
commit5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (patch)
treec980d614fec4a5495798be3e79e033229062c3cd /src/mapgen/mg_biome.h
parent28f6a79706b088c37268a59d90878220dc4ef9c7 (diff)
parent3af10766fd2b58b068e970266724d7eb10e9316b (diff)
downloaddragonfireclient-5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc.tar.xz
Merge branch 'master' into master
Diffstat (limited to 'src/mapgen/mg_biome.h')
-rw-r--r--src/mapgen/mg_biome.h65
1 files changed, 32 insertions, 33 deletions
diff --git a/src/mapgen/mg_biome.h b/src/mapgen/mg_biome.h
index be4cfea4d..ba3319976 100644
--- a/src/mapgen/mg_biome.h
+++ b/src/mapgen/mg_biome.h
@@ -36,11 +36,13 @@ typedef u16 biome_t;
#define BIOME_NONE ((biome_t)0)
-enum BiomeType {
+enum BiomeType
+{
BIOMETYPE_NORMAL,
};
-class Biome : public ObjDef, public NodeResolver {
+class Biome : public ObjDef, public NodeResolver
+{
public:
ObjDef *clone() const;
@@ -73,16 +75,17 @@ public:
virtual void resolveNodeNames();
};
-
////
//// BiomeGen
////
-enum BiomeGenType {
+enum BiomeGenType
+{
BIOMEGEN_ORIGINAL,
};
-struct BiomeParams {
+struct BiomeParams
+{
virtual void readParams(const Settings *settings) = 0;
virtual void writeParams(Settings *settings) const = 0;
virtual ~BiomeParams() = default;
@@ -91,7 +94,8 @@ struct BiomeParams {
};
// WARNING: this class is not thread-safe
-class BiomeGen {
+class BiomeGen
+{
public:
virtual ~BiomeGen() = default;
@@ -128,7 +132,6 @@ protected:
v3s16 m_csize;
};
-
////
//// BiomeGen implementations
////
@@ -137,12 +140,14 @@ protected:
// Original biome algorithm (Whittaker's classification + surface height)
//
-struct BiomeParamsOriginal : public BiomeParams {
+struct BiomeParamsOriginal : public BiomeParams
+{
BiomeParamsOriginal() :
- np_heat(50, 50, v3f(1000.0, 1000.0, 1000.0), 5349, 3, 0.5, 2.0),
- np_humidity(50, 50, v3f(1000.0, 1000.0, 1000.0), 842, 3, 0.5, 2.0),
- np_heat_blend(0, 1.5, v3f(8.0, 8.0, 8.0), 13, 2, 1.0, 2.0),
- np_humidity_blend(0, 1.5, v3f(8.0, 8.0, 8.0), 90003, 2, 1.0, 2.0)
+ np_heat(50, 50, v3f(1000.0, 1000.0, 1000.0), 5349, 3, 0.5, 2.0),
+ np_humidity(50, 50, v3f(1000.0, 1000.0, 1000.0), 842, 3, 0.5,
+ 2.0),
+ np_heat_blend(0, 1.5, v3f(8.0, 8.0, 8.0), 13, 2, 1.0, 2.0),
+ np_humidity_blend(0, 1.5, v3f(8.0, 8.0, 8.0), 90003, 2, 1.0, 2.0)
{
}
@@ -155,10 +160,11 @@ struct BiomeParamsOriginal : public BiomeParams {
NoiseParams np_humidity_blend;
};
-class BiomeGenOriginal : public BiomeGen {
+class BiomeGenOriginal : public BiomeGen
+{
public:
- BiomeGenOriginal(BiomeManager *biomemgr,
- BiomeParamsOriginal *params, v3s16 chunksize);
+ BiomeGenOriginal(BiomeManager *biomemgr, BiomeParamsOriginal *params,
+ v3s16 chunksize);
virtual ~BiomeGenOriginal();
BiomeGenType getType() const { return BIOMEGEN_ORIGINAL; }
@@ -184,34 +190,28 @@ private:
Noise *noise_humidity_blend;
};
-
////
//// BiomeManager
////
-class BiomeManager : public ObjDefManager {
+class BiomeManager : public ObjDefManager
+{
public:
BiomeManager(Server *server);
virtual ~BiomeManager() = default;
BiomeManager *clone() const;
- const char *getObjectTitle() const
- {
- return "biome";
- }
+ const char *getObjectTitle() const { return "biome"; }
- static Biome *create(BiomeType type)
- {
- return new Biome;
- }
+ static Biome *create(BiomeType type) { return new Biome; }
BiomeGen *createBiomeGen(BiomeGenType type, BiomeParams *params, v3s16 chunksize)
{
switch (type) {
case BIOMEGEN_ORIGINAL:
- return new BiomeGenOriginal(this,
- (BiomeParamsOriginal *)params, chunksize);
+ return new BiomeGenOriginal(
+ this, (BiomeParamsOriginal *)params, chunksize);
default:
return NULL;
}
@@ -231,15 +231,14 @@ public:
// For BiomeGen type 'BiomeGenOriginal'
float getHeatAtPosOriginal(v3s16 pos, NoiseParams &np_heat,
- NoiseParams &np_heat_blend, u64 seed) const;
+ 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;
+ NoiseParams &np_humidity_blend, u64 seed) const;
+ const Biome *getBiomeFromNoiseOriginal(
+ float heat, float humidity, v3s16 pos) const;
private:
- BiomeManager() {};
+ BiomeManager(){};
Server *m_server;
-
};