1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Mapgen: Refactor mapgen creation and management

- Move mapgen creation logic out of EmergeManager and into Mapgen
- Internally represent mapgen type as an enum value, instead of a string
- Remove the need for a MapgenFactory per mapgen
This commit is contained in:
kwolekr 2016-06-14 00:10:55 -04:00
parent 70e2c1c7d4
commit 92705306bf
12 changed files with 160 additions and 164 deletions

View file

@ -23,10 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapgen.h"
struct MapgenSinglenodeParams : public MapgenSpecificParams {
MapgenSinglenodeParams() {}
~MapgenSinglenodeParams() {}
void readParams(const Settings *settings) {}
void writeParams(Settings *settings) const {}
};
@ -39,19 +38,11 @@ public:
MapgenSinglenode(int mapgenid, MapgenParams *params, EmergeManager *emerge);
~MapgenSinglenode();
virtual MapgenType getType() const { return MAPGEN_SINGLENODE; }
void makeChunk(BlockMakeData *data);
int getSpawnLevelAtPoint(v2s16 p);
};
struct MapgenFactorySinglenode : public MapgenFactory {
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
return new MapgenSinglenode(mgid, params, emerge);
};
MapgenSpecificParams *createMapgenParams() {
return new MapgenSinglenodeParams();
};
};
#endif