From 5a34f40d80ea1a339b599bc11db549a6bd86912f Mon Sep 17 00:00:00 2001 From: kwolekr Date: Mon, 3 Feb 2014 22:42:10 -0500 Subject: 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. --- src/emerge.h | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/emerge.h') diff --git a/src/emerge.h b/src/emerge.h index 17097327b..14a2728ba 100644 --- a/src/emerge.h +++ b/src/emerge.h @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irr_v3d.h" #include "util/container.h" #include "map.h" // for ManualMapVoxelManipulator +#include "mapgen.h" // for MapgenParams #define MGPARAMS_SET_MGNAME 1 #define MGPARAMS_SET_SEED 2 @@ -37,9 +38,8 @@ with this program; if not, write to the Free Software Foundation, Inc., infostream << "EmergeThread: " x << std::endl; } class EmergeThread; -class Mapgen; -struct MapgenParams; -struct MapgenFactory; +//class Mapgen; +//struct MapgenFactory; class Biome; class BiomeDefManager; class Decoration; @@ -90,7 +90,7 @@ public: bool threads_active; //settings - MapgenParams *params; + MapgenParams params; bool mapgen_debug_info; u16 qlimit_total; u16 qlimit_diskonly; @@ -98,10 +98,6 @@ public: u32 gennotify; - MapgenParams *luaoverride_params; - u32 luaoverride_params_modified; - u32 luaoverride_flagmask; - //block emerge queue data structures JMutex queuemutex; std::map blocks_enqueued; @@ -115,19 +111,18 @@ public: EmergeManager(IGameDef *gamedef); ~EmergeManager(); - void initMapgens(MapgenParams *mgparams); - MapgenParams *setMapgenType(MapgenParams *mgparams, std::string newname); + void initMapgens(); Mapgen *getCurrentMapgen(); Mapgen *createMapgen(std::string mgname, int mgid, MapgenParams *mgparams); - MapgenParams *createMapgenParams(std::string mgname); + MapgenSpecificParams *createMapgenParams(std::string mgname); void startThreads(); void stopThreads(); bool enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate); void registerMapgen(std::string name, MapgenFactory *mgfactory); - MapgenParams *getParamsFromSettings(Settings *settings); - void setParamsToSettings(Settings *settings); + void loadParamsFromSettings(Settings *settings); + void saveParamsToSettings(Settings *settings); //mapgen helper methods Biome *getBiomeAtPoint(v3s16 p); -- cgit v1.2.3