aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen/mg_biome.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapgen/mg_biome.h')
-rw-r--r--src/mapgen/mg_biome.h65
1 files changed, 33 insertions, 32 deletions
diff --git a/src/mapgen/mg_biome.h b/src/mapgen/mg_biome.h
index ba3319976..be4cfea4d 100644
--- a/src/mapgen/mg_biome.h
+++ b/src/mapgen/mg_biome.h
@@ -36,13 +36,11 @@ 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;
@@ -75,17 +73,16 @@ 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;
@@ -94,8 +91,7 @@ struct BiomeParams
};
// WARNING: this class is not thread-safe
-class BiomeGen
-{
+class BiomeGen {
public:
virtual ~BiomeGen() = default;
@@ -132,6 +128,7 @@ protected:
v3s16 m_csize;
};
+
////
//// BiomeGen implementations
////
@@ -140,14 +137,12 @@ 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)
{
}
@@ -160,11 +155,10 @@ 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; }
@@ -190,28 +184,34 @@ 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,14 +231,15 @@ 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;
+
};