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

@ -40,8 +40,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#include "nodedef.h"
#include "mg_biome.h"
#include "mg_decoration.h"
#include "mg_ore.h"
#include "mg_decoration.h"
#include "mg_schematic.h"
#include "mapgen_v5.h"
#include "mapgen_v6.h"
#include "mapgen_v7.h"
@ -88,8 +89,11 @@ EmergeManager::EmergeManager(IGameDef *gamedef) {
registerMapgen("v7", new MapgenFactoryV7());
registerMapgen("singlenode", new MapgenFactorySinglenode());
this->ndef = gamedef->getNodeDefManager();
this->biomedef = new BiomeDefManager(gamedef->getNodeDefManager()->getResolver());
this->ndef = gamedef->getNodeDefManager();
this->biomemgr = new BiomeManager(gamedef);
this->oremgr = new OreManager(gamedef);
this->decomgr = new DecorationManager(gamedef);
this->schemmgr = new SchematicManager(gamedef);
this->gennotify = 0;
// Note that accesses to this variable are not synchronized.
@ -141,21 +145,15 @@ EmergeManager::~EmergeManager() {
emergethread.clear();
mapgen.clear();
for (unsigned int i = 0; i < ores.size(); i++)
delete ores[i];
ores.clear();
for (unsigned int i = 0; i < decorations.size(); i++)
delete decorations[i];
decorations.clear();
for (std::map<std::string, MapgenFactory *>::iterator it = mglist.begin();
it != mglist.end(); ++it) {
std::map<std::string, MapgenFactory *>::iterator it;
for (it = mglist.begin(); it != mglist.end(); ++it)
delete it->second;
}
mglist.clear();
delete biomedef;
delete biomemgr;
delete oremgr;
delete decomgr;
delete schemmgr;
if (params.sparams) {
delete params.sparams;