Pioneer
Loading...
Searching...
No Matches
StarSystemGenerator.h
Go to the documentation of this file.
1// Copyright © 2008-2024 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
11public:
13};
14
16public:
17 static void PickAtmosphere(SystemBody *sbody);
18 static void PickRings(SystemBodyData *sbody, bool forceRings = false);
19
20protected:
21 struct StarTypeInfo {
22 int mass[2]; // min,max % sol for stars, unused for planets
23 int radius[2]; // min,max % sol radii for stars, % earth radii for planets
25 };
26 static const fixed starMetallicities[];
27 static const StarTypeInfo starTypeInfo[];
28
30};
31
33public:
35
36 // returns true if the system is custom, false if the contents should be randomly generated
38
39private:
40 void CustomGetKidsOf(RefCountedPtr<StarSystem::GeneratorAPI> system, SystemBody *parent, const std::vector<CustomSystemBody *> &children, int *outHumanInfestedness);
41};
42
44public:
45 static constexpr uint32_t BODY_SATELLITE_SALT = 0xf5123a90;
46
48
49 // Calculate the min, max distances from the primary where satellites should be generated
50 // Returns the mass density of a 2d slice through the center of the shell
51 fixed CalcBodySatelliteShellDensity(Random &rand, SystemBody *primary, fixed &discMin, fixed &discMax);
52 SystemBody *MakeBodyInOrbitSlice(Random &rand, StarSystem::GeneratorAPI *system, SystemBody *primary, fixed min, fixed max, fixed discMax, fixed discDensity);
53 void PickPlanetType(SystemBody *sbody, Random &rand);
54
55private:
56 void MakePlanetsAround(RefCountedPtr<StarSystem::GeneratorAPI> system, SystemBody *primary, Random &rand);
57 void MakeRandomStar(SystemBody *sbody, Random &rand);
58 void MakeStarOfType(SystemBody *sbody, SystemBody::BodyType type, Random &rand);
59 void MakeStarOfTypeLighterThan(SystemBody *sbody, SystemBody::BodyType type, fixed maxMass, Random &rand);
60 void MakeBinaryPair(SystemBody *a, SystemBody *b, fixed minDist, Random &rand);
61
62 int CalcSurfaceTemp(const SystemBody *primary, fixed distToPrimary, fixed albedo, fixed greenhouse);
63 const SystemBody *FindStarAndTrueOrbitalRange(const SystemBody *planet, fixed &orbMin_, fixed &orbMax_) const;
64};
65
67public:
69
70private:
71 void SetSysPolit(RefCountedPtr<Galaxy> galaxy, RefCountedPtr<StarSystem::GeneratorAPI> system, const fixed &human_infestedness);
72 void SetCommodityLegality(RefCountedPtr<StarSystem::GeneratorAPI> system);
73 void SetEconType(RefCountedPtr<StarSystem::GeneratorAPI> system);
74
75 void PopulateAddStations(SystemBody *sbody, StarSystem::GeneratorAPI *system);
76 void PositionSettlementOnPlanet(SystemBody *sbody, std::vector<fixed> &prevOrbits);
77 void PopulateStage1(SystemBody *sbody, StarSystem::GeneratorAPI *system, fixed &outTotalPop);
78};
79
80#endif
Definition: CustomSystem.h:45
Definition: StarSystemGenerator.h:66
virtual bool Apply(Random &rng, RefCountedPtr< Galaxy > galaxy, RefCountedPtr< StarSystem::GeneratorAPI > system, GalaxyGenerator::StarSystemConfig *config)
Definition: StarSystemGenerator.cpp:1856
Definition: Random.h:29
Definition: RefCounted.h:36
Definition: StarSystemGenerator.h:32
bool ApplyToSystem(Random &rng, RefCountedPtr< StarSystem::GeneratorAPI > system, const CustomSystem *customSys)
Definition: StarSystemGenerator.cpp:442
virtual bool Apply(Random &rng, RefCountedPtr< Galaxy > galaxy, RefCountedPtr< StarSystem::GeneratorAPI > system, GalaxyGenerator::StarSystemConfig *config)
Definition: StarSystemGenerator.cpp:488
Definition: StarSystemGenerator.h:10
virtual bool Apply(Random &rng, RefCountedPtr< Galaxy > galaxy, RefCountedPtr< StarSystem::GeneratorAPI > system, GalaxyGenerator::StarSystemConfig *config)
Definition: StarSystemGenerator.cpp:191
Definition: GalaxyGenerator.h:122
Definition: StarSystemGenerator.h:15
fixedf< 48 > CalcHillRadius(SystemBody *sbody) const
Definition: StarSystemGenerator.cpp:363
static const StarTypeInfo starTypeInfo[]
Definition: StarSystemGenerator.h:27
static void PickAtmosphere(SystemBody *sbody)
Definition: StarSystemGenerator.cpp:206
static const fixed starMetallicities[]
Definition: StarSystemGenerator.h:26
static void PickRings(SystemBodyData *sbody, bool forceRings=false)
Definition: StarSystemGenerator.cpp:298
Definition: StarSystemGenerator.h:43
static constexpr uint32_t BODY_SATELLITE_SALT
Definition: StarSystemGenerator.h:45
fixed CalcBodySatelliteShellDensity(Random &rand, SystemBody *primary, fixed &discMin, fixed &discMax)
Definition: StarSystemGenerator.cpp:890
void PickPlanetType(SystemBody *sbody, Random &rand)
Definition: StarSystemGenerator.cpp:641
SystemBody * MakeBodyInOrbitSlice(Random &rand, StarSystem::GeneratorAPI *system, SystemBody *primary, fixed min, fixed max, fixed discMax, fixed discDensity)
Definition: StarSystemGenerator.cpp:1044
virtual bool Apply(Random &rng, RefCountedPtr< Galaxy > galaxy, RefCountedPtr< StarSystem::GeneratorAPI > system, GalaxyGenerator::StarSystemConfig *config)
Definition: StarSystemGenerator.cpp:1262
Definition: StarSystem.h:166
Definition: SystemBody.h:89
BodyType
Definition: SystemBody.h:25
Definition: SystemBody.h:137
Definition: GalaxyGenerator.h:60
Definition: StarSystemGenerator.h:21
int radius[2]
Definition: StarSystemGenerator.h:23
int tempMin
Definition: StarSystemGenerator.h:24
int mass[2]
Definition: StarSystemGenerator.h:22
int tempMax
Definition: StarSystemGenerator.h:24
vector3< T > max(const vector3< T > &lhs, const vector3< T > &rhs)
Definition: vector3.h:312
vector3< T > min(const vector3< T > &lhs, const vector3< T > &rhs)
Definition: vector3.h:320