diff options
author | ngosang <diegodelasheras@gmail.com> | 2015-01-26 12:44:49 +0100 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2015-03-07 15:53:39 -0500 |
commit | f6e4c5d9cf459e8278a76a2beaee59732e841458 (patch) | |
tree | 6748d30881ddd5b5679d89b4ea5838fb5598fe18 /src/mapgen.h | |
parent | 9da99efca226c377d3bc2914561edffd812a9c1a (diff) | |
download | hax-minetest-server-f6e4c5d9cf459e8278a76a2beaee59732e841458.tar.gz hax-minetest-server-f6e4c5d9cf459e8278a76a2beaee59732e841458.zip |
Respect game mapgen flags and save world noise params
Diffstat (limited to 'src/mapgen.h')
-rw-r--r-- | src/mapgen.h | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/mapgen.h b/src/mapgen.h index 01710786b..c9aee5ef5 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -95,12 +95,13 @@ private: }; struct MapgenSpecificParams { - virtual void readParams(Settings *settings) = 0; - virtual void writeParams(Settings *settings) = 0; + virtual void readParams(const Settings *settings) = 0; + virtual void writeParams(Settings *settings) const = 0; virtual ~MapgenSpecificParams() {} }; -struct MapgenParams { +class MapgenParams { +public: std::string mg_name; s16 chunksize; u64 seed; @@ -112,17 +113,19 @@ struct MapgenParams { MapgenSpecificParams *sparams; - MapgenParams() - { - mg_name = DEFAULT_MAPGEN; - seed = 0; - water_level = 1; - chunksize = 5; - flags = MG_TREES | MG_CAVES | MG_LIGHT; - sparams = NULL; - np_biome_heat = NoiseParams(50, 50, v3f(500.0, 500.0, 500.0), 5349, 3, 0.5, 2.0); - np_biome_humidity = NoiseParams(50, 50, v3f(500.0, 500.0, 500.0), 842, 3, 0.5, 2.0); - } + MapgenParams() : + mg_name(DEFAULT_MAPGEN), + chunksize(5), + seed(0), + water_level(1), + flags(MG_TREES | MG_CAVES | MG_LIGHT), + np_biome_heat(NoiseParams(50, 50, v3f(500.0, 500.0, 500.0), 5349, 3, 0.5, 2.0)), + np_biome_humidity(NoiseParams(50, 50, v3f(500.0, 500.0, 500.0), 842, 3, 0.5, 2.0)), + sparams(NULL) + {} + + void load(const Settings &settings); + void save(Settings &settings) const; }; class Mapgen { |