summaryrefslogtreecommitdiff
path: root/src/mapgen.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-02-03 22:42:10 -0500
committerkwolekr <kwolekr@minetest.net>2014-02-03 22:50:14 -0500
commit5a34f40d80ea1a339b599bc11db549a6bd86912f (patch)
tree07ead9e3ff4732479af41b739a26b5dc8182c5fd /src/mapgen.h
parenta439343844cf821e4922e23f1638b92e2cfb14ac (diff)
downloadminetest-5a34f40d80ea1a339b599bc11db549a6bd86912f.tar.gz
minetest-5a34f40d80ea1a339b599bc11db549a6bd86912f.tar.bz2
minetest-5a34f40d80ea1a339b599bc11db549a6bd86912f.zip
Huge overhaul of the entire MapgenParams system
MapgenParams is no longer a polymorphic class, eliminating the need for messy and bug-prone reallocations. Separation between the common and mapgen-specific parameters is now strongly defined. Mapgen parameters objects are now properly encapsulated within the proper subsystems.
Diffstat (limited to 'src/mapgen.h')
-rw-r--r--src/mapgen.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/mapgen.h b/src/mapgen.h
index aa66982c3..4cee3c2aa 100644
--- a/src/mapgen.h
+++ b/src/mapgen.h
@@ -28,17 +28,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "noise.h"
#include "settings.h"
+#define DEFAULT_MAPGEN "v6"
+
/////////////////// Mapgen flags
#define MG_TREES 0x01
#define MG_CAVES 0x02
#define MG_DUNGEONS 0x04
-#define MGV6_JUNGLES 0x08
-#define MGV6_BIOME_BLEND 0x10
-#define MG_FLAT 0x20
-#define MG_NOLIGHT 0x40
-#define MGV7_MOUNTAINS 0x80
-#define MGV7_RIDGES 0x100
-#define MGV6_NOMUDFLOW 0x200
+#define MG_FLAT 0x08
+#define MG_NOLIGHT 0x10
/////////////////// Ore generation flags
// Use absolute value of height to determine ore placement
@@ -101,6 +98,12 @@ enum OreType {
};
+struct MapgenSpecificParams {
+ virtual void readParams(Settings *settings) = 0;
+ virtual void writeParams(Settings *settings) = 0;
+ virtual ~MapgenSpecificParams() {}
+};
+
struct MapgenParams {
std::string mg_name;
int chunksize;
@@ -108,17 +111,16 @@ struct MapgenParams {
int water_level;
u32 flags;
+ MapgenSpecificParams *sparams;
+
MapgenParams() {
mg_name = "v6";
seed = 0;
water_level = 1;
chunksize = 5;
- flags = MG_TREES | MG_CAVES | MGV6_BIOME_BLEND;
+ flags = MG_TREES | MG_CAVES;
+ sparams = NULL;
}
-
- virtual bool readParams(Settings *settings) { return true; }
- virtual void writeParams(Settings *settings) {}
- virtual ~MapgenParams() {}
};
class Mapgen {
@@ -156,7 +158,7 @@ public:
struct MapgenFactory {
virtual Mapgen *createMapgen(int mgid, MapgenParams *params,
EmergeManager *emerge) = 0;
- virtual MapgenParams *createMapgenParams() = 0;
+ virtual MapgenSpecificParams *createMapgenParams() = 0;
virtual ~MapgenFactory() {}
};