4#ifndef GALAXYGENERATOR_H
5#define GALAXYGENERATOR_H
28 return Create(s_defaultGenerator, s_defaultVersion);
38 const std::string &
GetName()
const {
return m_name; }
41 bool IsDefault()
const {
return m_name == s_defaultGenerator && m_version == s_defaultVersion; }
47 template <
typename T,
typename Cache>
75 const std::string m_name;
78 std::list<SectorGeneratorStage *> m_sectorStage;
79 std::list<StarSystemGeneratorStage *> m_starSystemStage;
82 static std::string s_defaultGenerator;
83 static Version s_defaultVersion;
89 return GenerateSector(galaxy, path, cache);
95 return GenerateStarSystem(galaxy, path, cache);
nlohmann::json Json
Definition Json.h:8
Definition GalaxyGenerator.h:98
GalaxyGeneratorStage()
Definition GalaxyGenerator.h:106
void AssignToGalaxyGenerator(GalaxyGenerator *galaxyGenerator)
Definition GalaxyGenerator.h:110
virtual ~GalaxyGeneratorStage()
Definition GalaxyGenerator.h:100
virtual void FromJson(const Json &jsonObj, RefCountedPtr< Galaxy > galaxy)
Definition GalaxyGenerator.h:103
GalaxyGenerator * m_galaxyGenerator
Definition GalaxyGenerator.h:112
virtual void ToJson(Json &jsonObj, RefCountedPtr< Galaxy > galaxy)
Definition GalaxyGenerator.h:102
Definition GalaxyGenerator.h:17
static Version GetDefaultGeneratorVersion()
Definition GalaxyGenerator.h:33
static std::string GetDefaultGeneratorName()
Definition GalaxyGenerator.h:32
void FromJson(const Json &jsonObj, RefCountedPtr< Galaxy > galaxy)
Definition GalaxyGenerator.cpp:132
static Version GetLastVersion(const std::string &name)
Definition GalaxyGenerator.cpp:36
bool IsDefault() const
Definition GalaxyGenerator.h:41
GalaxyGenerator * AddSectorStage(SectorGeneratorStage *sectorGenerator)
Definition GalaxyGenerator.cpp:157
int Version
Definition GalaxyGenerator.h:19
static RefCountedPtr< Galaxy > CreateFromJson(const Json &jsonObj)
Definition GalaxyGenerator.cpp:86
const std::string & GetName() const
Definition GalaxyGenerator.h:38
virtual ~GalaxyGenerator()
Definition GalaxyGenerator.cpp:149
static RefCountedPtr< Galaxy > Create()
Definition GalaxyGenerator.h:26
static const Version LAST_VERSION
Definition GalaxyGenerator.h:20
Version GetVersion() const
Definition GalaxyGenerator.h:39
RefCountedPtr< T > Generate(RefCountedPtr< Galaxy > galaxy, const SystemPath &path, Cache *cache)
static void Uninit()
Definition GalaxyGenerator.cpp:29
static void Init(const std::string &name=std::string("legacy"), Version version=LAST_VERSION)
Definition GalaxyGenerator.cpp:20
void ToJson(Json &jsonObj, RefCountedPtr< Galaxy > galaxy)
Definition GalaxyGenerator.cpp:103
GalaxyGenerator * AddStarSystemStage(StarSystemGeneratorStage *starSystemGenerator)
Definition GalaxyGenerator.cpp:164
Definition RefCounted.h:36
Definition RefCounted.h:11
Definition GalaxyGenerator.h:115
virtual ~SectorGeneratorStage()
Definition GalaxyGenerator.h:117
virtual bool Apply(Random &rng, RefCountedPtr< Galaxy > galaxy, RefCountedPtr< Sector > sector, GalaxyGenerator::SectorConfig *config)=0
Definition GalaxyGenerator.h:122
virtual ~StarSystemGeneratorStage()
Definition GalaxyGenerator.h:124
virtual bool Apply(Random &rng, RefCountedPtr< Galaxy > galaxy, RefCountedPtr< StarSystem::GeneratorAPI > system, GalaxyGenerator::StarSystemConfig *config)=0
Definition SystemPath.h:13
Definition GalaxyGenerator.h:53
bool isCustomOnly
Definition GalaxyGenerator.h:54
SectorConfig()
Definition GalaxyGenerator.h:56
Definition GalaxyGenerator.h:60
StarSystemConfig()
Definition GalaxyGenerator.h:63
bool isCustomOnly
Definition GalaxyGenerator.h:61