1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add Generator Element Management framework

Add BiomeManager, OreManager, DecorationManager, and SchematicManager
This commit is contained in:
kwolekr 2014-11-12 23:01:13 -05:00
parent f25cc0dbae
commit 7616537bc0
22 changed files with 620 additions and 464 deletions

View file

@ -20,13 +20,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef MAPGEN_HEADER
#define MAPGEN_HEADER
#include "irrlichttypes_bloated.h"
#include "util/container.h" // UniqueQueue
#include "gamedef.h"
#include "nodedef.h"
#include "mapnode.h"
#include "noise.h"
#include "settings.h"
#include "util/string.h"
#include "util/container.h"
#define DEFAULT_MAPGEN "v6"
@ -39,11 +36,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define NUM_GEN_NOTIFY 6
class Settings;
class ManualMapVoxelManipulator;
class INodeDefManager;
extern FlagDesc flagdesc_mapgen[];
extern FlagDesc flagdesc_gennotify[];
class BiomeDefManager;
class Biome;
class EmergeManager;
class MapBlock;
@ -53,7 +52,6 @@ struct BlockMakeData;
class VoxelArea;
class Map;
enum MapgenObject {
MGOBJ_VMANIP,
MGOBJ_HEIGHTMAP,
@ -131,10 +129,37 @@ public:
struct MapgenFactory {
virtual Mapgen *createMapgen(int mgid, MapgenParams *params,
EmergeManager *emerge) = 0;
EmergeManager *emerge) = 0;
virtual MapgenSpecificParams *createMapgenParams() = 0;
virtual ~MapgenFactory() {}
};
#endif
class GenElement {
public:
uint32_t id;
std::string name;
};
class GenElementManager {
public:
static const char *ELEMENT_TITLE;
static const size_t ELEMENT_LIMIT = -1;
GenElementManager() {}
virtual ~GenElementManager();
virtual GenElement *create(int type) = 0;
virtual u32 add(GenElement *elem);
virtual GenElement *get(u32 id);
virtual GenElement *update(u32 id, GenElement *elem);
virtual GenElement *remove(u32 id);
virtual GenElement *getByName(const char *name);
virtual GenElement *getByName(std::string &name);
protected:
std::vector<GenElement *> m_elements;
};
#endif