From f6e4c5d9cf459e8278a76a2beaee59732e841458 Mon Sep 17 00:00:00 2001 From: ngosang Date: Mon, 26 Jan 2015 12:44:49 +0100 Subject: Respect game mapgen flags and save world noise params --- src/mapgen.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'src/mapgen.h') 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 { -- cgit v1.2.3