class
cPlanetRecordKeeps all the information related to a planet.
This does not represent the planet visually (that is the Simulator::
Planet records are uniquely identified with a PlanetID, which can be retrieved using GetID(). You can get the record from an ID using cStarManager::
Base classes
Public static variables
Public static functions
- static auto GetTypeIconKey(cPlanetRecord* record) -> const ResourceKey&
- Returns the key to the icon that is displayed in planet tooltip.
- static auto GenerateTerrainKey() -> ResourceKey
- Generates a
.prop
file ResourceKey that is currently unused in game packages, so that the planet terrain can be saved there. - static auto GetPerihelion(cPlanetRecord* pRecord, MoonPerihelionType moonType) -> float
- Returns the distance of the perihelion, which is the planet's closest point to the parent object in its orbit (the parent object is either a sun, or another planet if this planet is a moon).
- static auto Create(PlanetID planetId, cPlanetRecordPtr& dst) -> void
- static auto FillPlanetDataForTechLevel(cPlanetRecord* planetRecord, TechLevel techLevel) -> void
- Generates the civilization/tribe data, including cities, for a planet record.
- static auto CalculateSpiceProduction(cPlanetRecord* planetRecord, int removeSpice = 0) -> int
- Calculates the current total spice of a planet, which is the sum of the production of all its cities.
- static auto CalculateDeltaSpiceProduction(float baseValue, float maxOutput, float extraFactor, bool isHomeWorld, bool useSuperpowerMultiplier, bool useStorageMultiplier, float finalFactor, int numCities, bool limitOutput) -> float
- Method that calculates how much spice is being produced on a single planet, based on difficulty tunings and number of cities.
- static auto HasControlledCity(cPlanetRecord* planetRecord, cEmpire* empire, bool requireMoreThanOneTurret = false) -> bool
- Return true if the planet ahs any city controlled by the specified empire.
- static auto AssignTerrainT0(cPlanetRecord* planetRecord) -> void
- Generates a terrain file for this planet, assigning it a random source terrain file for T0 planets.
- static auto AssignTerrainNonT0(cPlanetRecord* planetRecord) -> void
- Generates a terrain file for this planet, assigning it a random source terrain file for non-T0 planets.
Public functions
- auto GetStarRecord() const -> cStarRecord*
- auto GetStarID() const -> StarID
- auto GetID() const -> PlanetID
- auto GetTechLevel() const -> TechLevel
- auto IsMoon() const -> bool
- auto IsDestroyed() const -> bool
- auto SetGeneratedTerrainKey(const ResourceKey& key) -> void
- auto GetGeneratedTerrainKey() -> ResourceKey&
- auto GetTerrainScriptSource() -> ResourceKey
- auto GetCitizenSpeciesKey() -> const ResourceKey&
- Return the key of the sentient species that inhabits this planet.
Public variables
- eastl::string16 mName
- PlanetType mType
- The type of the planet, which determines whether it is a gas giant, asteroid belt, or regular rocky planet.
- int mFlags
- cEllipticalOrbit mOrbit
- The orbit this planet follows around its star.
- bool mbRotationIsNull
- If true, the planet does not rotate around itself (i.e. there are no "days").
-
Math::
Vector3 mRotationAxis - Axis of rotation for planet days, that is, in which axis the planet spins around itself.
- float mRotationPeriod
- How much time, in real seconds, the planet takes to make a full spin around itself (that is, how long an astronomical day is for this planet).
-
int8_
t mPlanetRing - char field_AD
- float mAtmosphereScore
- float mTemperatureScore
- float mWaterScore
- eastl::vector<ResourceKey> mPlantSpecies
- IDs of the plant species that inhabit this planet.
- eastl::vector<ResourceKey> mAnimalSpecies
- IDs of the animal species that inhabit this planet.
- eastl::vector<cCommodityNodeData*> mCommodityNodes
- eastl::vector<int> field_F8
- int field_10C
- eastl::vector<int> field_110
- int mNumDefenderUFOs
- float mTimeLastBuiltUFOs
- float mTimeCalledReinforcements
- bool mbHomeWorld
- eastl::vector<cPlanetObjectData> mPlanetObjects
-
eastl::vector<uint32_
t> mTerrainStampsToRemove - eastl::vector<cCivData*> mCivData
- eastl::vector<cTribeData*> mTribeData
- PlanetID mKey
- ResourceKey field_188
- TechLevel mTechLevel
- ResourceKey mSpiceGen
- ID of the spice file of this planet in GroupIDs::
SpaceTrading_; all zeros if it hasn't been assigned yet. - ResourceKey mGeneratedTerrainKey
Function documentation
static const ResourceKey& Simulator:: cPlanetRecord:: GetTypeIconKey(cPlanetRecord* record)
Returns the key to the icon that is displayed in planet tooltip.
This depends on tech level, and whether it has an adventure.
static float Simulator:: cPlanetRecord:: GetPerihelion(cPlanetRecord* pRecord,
MoonPerihelionType moonType)
Returns the distance of the perihelion, which is the planet's closest point to the parent object in its orbit (the parent object is either a sun, or another planet if this planet is a moon).
Parameters | |
---|---|
pRecord | The planet |
moonType | Only used for moons (planets orbiting other planets), determines how the perihelion is calculated |
static void Simulator:: cPlanetRecord:: FillPlanetDataForTechLevel(cPlanetRecord* planetRecord,
TechLevel techLevel)
Generates the civilization/tribe data, including cities, for a planet record.
Parameters | |
---|---|
planetRecord | |
techLevel |
The number and type of cities will depend on whether it is Empire or Civilization level. For Empire level, the owner star of the planet must belong to an empire.
static int Simulator:: cPlanetRecord:: CalculateSpiceProduction(cPlanetRecord* planetRecord,
int removeSpice = 0)
Calculates the current total spice of a planet, which is the sum of the production of all its cities.
Parameters | |
---|---|
planetRecord | |
removeSpice | |
Returns | The total spice production of the planet. |
If 'removeSpice' is not 0, that amount of spice will be removed from the planet.
static float Simulator:: cPlanetRecord:: CalculateDeltaSpiceProduction(float baseValue,
float maxOutput,
float extraFactor,
bool isHomeWorld,
bool useSuperpowerMultiplier,
bool useStorageMultiplier,
float finalFactor,
int numCities,
bool limitOutput)
Method that calculates how much spice is being produced on a single planet, based on difficulty tunings and number of cities.
Parameters | |
---|---|
baseValue | Base value of the computation (e.g. cCityData:: |
maxOutput | Maximum output value, only applied if limitOutput is true |
extraFactor | Extra multilpier for the base value |
isHomeWorld | |
useSuperpowerMultiplier | |
useStorageMultiplier | |
finalFactor | Extra multiplied applied to the final output value |
numCities | |
limitOutput | If true, the output value will be capped at maxOutput |
This method is called every X ticks to update the total spice held on each city.
static bool Simulator:: cPlanetRecord:: HasControlledCity(cPlanetRecord* planetRecord,
cEmpire* empire,
bool requireMoreThanOneTurret = false)
Return true if the planet ahs any city controlled by the specified empire.
Parameters | |
---|---|
planetRecord | |
empire | |
requireMoreThanOneTurret |
If 'requireMoreThanOneTurret' is true, then it will only return true if the controlled city has more than one turret.
static void Simulator:: cPlanetRecord:: AssignTerrainT0(cPlanetRecord* planetRecord)
Generates a terrain file for this planet, assigning it a random source terrain file for T0 planets.
Parameters | |
---|---|
planetRecord |
The method will generate a random ID, call SetGeneratedTerrainKey(), and call ITerrainResourceManager::LoadPlanetInfo() (which returns a random planet, based on the generated terrain key), until it finds a source terrain with temperature score lower than 0.33 or higher than 0.66. The planet record temperature and atmosphere scores will be set to the final terrain ones.
static void Simulator:: cPlanetRecord:: AssignTerrainNonT0(cPlanetRecord* planetRecord)
Generates a terrain file for this planet, assigning it a random source terrain file for non-T0 planets.
Parameters | |
---|---|
planetRecord |
The method will generate a random ID, call SetGeneratedTerrainKey(), and call ITerrainResourceManager::LoadPlanetInfo() (which returns a random planet, based on the generated terrain key). The planet record temperature and atmosphere scores will be set to the final terrain ones.
const ResourceKey& Simulator:: cPlanetRecord:: GetCitizenSpeciesKey()
Return the key of the sentient species that inhabits this planet.
Only for tribe or greater tech level.