Pioneer
StarSystemGenerator.h
Go to the documentation of this file.
1 // Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details
2 // Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3 
4 #ifndef STARSYSTEM_GENERATOR_H
5 #define STARSYSTEM_GENERATOR_H
6 
7 #include "GalaxyGenerator.h"
8 #include "StarSystem.h"
9 
11 public:
13 };
14 
16 protected:
17  struct StarTypeInfo {
18  int mass[2]; // min,max % sol for stars, unused for planets
19  int radius[2]; // min,max % sol radii for stars, % earth radii for planets
21  };
22  static const fixed starMetallicities[];
23  static const StarTypeInfo starTypeInfo[];
24 
25  void PickAtmosphere(SystemBody *sbody);
26  void PickRings(SystemBody *sbody, bool forceRings = false);
27  fixed CalcHillRadius(SystemBody *sbody) const;
28 };
29 
31 public:
33 
34 private:
35  void CustomGetKidsOf(RefCountedPtr<StarSystem::GeneratorAPI> system, SystemBody *parent, const std::vector<CustomSystemBody *> &children, int *outHumanInfestedness, Random &rand);
36 };
37 
39 public:
41 
42 private:
43  void MakePlanetsAround(RefCountedPtr<StarSystem::GeneratorAPI> system, SystemBody *primary, Random &rand);
44  void MakeRandomStar(SystemBody *sbody, Random &rand);
45  void MakeStarOfType(SystemBody *sbody, SystemBody::BodyType type, Random &rand);
46  void MakeStarOfTypeLighterThan(SystemBody *sbody, SystemBody::BodyType type, fixed maxMass, Random &rand);
47  void MakeBinaryPair(SystemBody *a, SystemBody *b, fixed minDist, Random &rand);
48 
49  int CalcSurfaceTemp(const SystemBody *primary, fixed distToPrimary, fixed albedo, fixed greenhouse);
50  const SystemBody *FindStarAndTrueOrbitalRange(const SystemBody *planet, fixed &orbMin_, fixed &orbMax_) const;
51  void PickPlanetType(SystemBody *sbody, Random &rand);
52 };
53 
55 public:
57 
58 private:
59  void SetSysPolit(RefCountedPtr<Galaxy> galaxy, RefCountedPtr<StarSystem::GeneratorAPI> system, const fixed &human_infestedness);
60  void SetCommodityLegality(RefCountedPtr<StarSystem::GeneratorAPI> system);
61  void SetEconType(RefCountedPtr<StarSystem::GeneratorAPI> system);
62 
63  void PopulateAddStations(SystemBody *sbody, StarSystem::GeneratorAPI *system);
64  void PositionSettlementOnPlanet(SystemBody *sbody, std::vector<double> &prevOrbits);
65  void PopulateStage1(SystemBody *sbody, StarSystem::GeneratorAPI *system, fixed &outTotalPop);
66 };
67 
68 #endif
Definition: StarSystemGenerator.h:54
virtual bool Apply(Random &rng, RefCountedPtr< Galaxy > galaxy, RefCountedPtr< StarSystem::GeneratorAPI > system, GalaxyGenerator::StarSystemConfig *config)
Definition: StarSystemGenerator.cpp:1729
Definition: Random.h:27
Definition: StarSystemGenerator.h:30
virtual bool Apply(Random &rng, RefCountedPtr< Galaxy > galaxy, RefCountedPtr< StarSystem::GeneratorAPI > system, GalaxyGenerator::StarSystemConfig *config)
Definition: StarSystemGenerator.cpp:501
Definition: StarSystemGenerator.h:10
virtual bool Apply(Random &rng, RefCountedPtr< Galaxy > galaxy, RefCountedPtr< StarSystem::GeneratorAPI > system, GalaxyGenerator::StarSystemConfig *config)
Definition: StarSystemGenerator.cpp:185
Definition: GalaxyGenerator.h:122
Definition: StarSystemGenerator.h:15
fixed CalcHillRadius(SystemBody *sbody) const
Definition: StarSystemGenerator.cpp:358
static const StarTypeInfo starTypeInfo[]
Definition: StarSystemGenerator.h:23
void PickAtmosphere(SystemBody *sbody)
Definition: StarSystemGenerator.cpp:200
static const fixed starMetallicities[]
Definition: StarSystemGenerator.h:22
void PickRings(SystemBody *sbody, bool forceRings=false)
Definition: StarSystemGenerator.cpp:293
Definition: StarSystemGenerator.h:38
virtual bool Apply(Random &rng, RefCountedPtr< Galaxy > galaxy, RefCountedPtr< StarSystem::GeneratorAPI > system, GalaxyGenerator::StarSystemConfig *config)
Definition: StarSystemGenerator.cpp:1159
Definition: StarSystem.h:157
Definition: SystemBody.h:19
BodyType
Definition: SystemBody.h:23
Definition: GalaxyGenerator.h:60
Definition: StarSystemGenerator.h:17
int radius[2]
Definition: StarSystemGenerator.h:19
int tempMin
Definition: StarSystemGenerator.h:20
int mass[2]
Definition: StarSystemGenerator.h:18
int tempMax
Definition: StarSystemGenerator.h:20