the final rename
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#ifndef WORLD_WORLDGENERATORS_HPP_
|
||||
#define WORLD_WORLDGENERATORS_HPP_
|
||||
|
||||
#include "../voxels/WorldGenerator.hpp"
|
||||
#include "../content/Content.hpp"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
typedef WorldGenerator* (*gen_constructor) (const Content*);
|
||||
|
||||
|
||||
class WorldGenerators {
|
||||
static inline std::map<std::string, gen_constructor> generators;
|
||||
|
||||
public:
|
||||
template <typename T>
|
||||
static void addGenerator(std::string id);
|
||||
|
||||
static std::vector<std::string> getGeneratorsIDs();
|
||||
|
||||
static std::string getDefaultGeneratorID();
|
||||
|
||||
static std::unique_ptr<WorldGenerator> createGenerator(
|
||||
std::string id, const Content* content
|
||||
);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void WorldGenerators::addGenerator(std::string id) {
|
||||
generators[id] =
|
||||
[] (const Content* content)
|
||||
{
|
||||
return (WorldGenerator*) new T(content);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* WORLD_WORLDGENERATORS_HPP_ */
|
||||
Reference in New Issue
Block a user