Skip to content

Commit

Permalink
Add cPlanetRecord::CalculateDeltaSpiceProduction()
Browse files Browse the repository at this point in the history
  • Loading branch information
emd4600 committed Jul 28, 2024
1 parent c994dda commit b4eee23
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ namespace Simulator
DefineAddress(GetPerihelion, SelectAddress(0xC70190, 0xC70FC0));
DefineAddress(FillPlanetDataForTechLevel, SelectAddress(0xB96820, 0xB97090));
DefineAddress(CalculateSpiceProduction, SelectAddress(0xC6F920, 0xC70760));
DefineAddress(CalculateDeltaSpiceProduction, SelectAddress(0xC71200, 0xC720A0));
}

namespace Addresses(cCivData) {
Expand Down
6 changes: 6 additions & 0 deletions Spore ModAPI/SourceCode/Simulator/Planets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,11 @@ namespace Simulator

auto_STATIC_METHOD(cPlanetRecord, int, CalculateSpiceProduction,
Args(cPlanetRecord* planetRecord, int removeSpice), Args(planetRecord, removeSpice));

auto_STATIC_METHOD(cPlanetRecord, float, CalculateDeltaSpiceProduction,
Args(float baseValue, float maxOutput, float extraFactor, bool isHomeWorld,
bool useSuperpowerMultiplier, bool useStorageMultiplier, float finalFactor, int numCities, bool limitOutput),
Args(baseValue, maxOutput, extraFactor, isHomeWorld, useSuperpowerMultiplier, useStorageMultiplier, finalFactor, numCities, limitOutput));

}
#endif
19 changes: 18 additions & 1 deletion Spore ModAPI/Spore/Simulator/cPlanetRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,30 @@ namespace Simulator
/// @param techLevel
static void FillPlanetDataForTechLevel(cPlanetRecord* planetRecord, TechLevel techLevel);

/// Calculates the current spice production of a planet, which is the sum of the
/// Calculates the current total spice of a planet, which is the sum of the
/// production of all its cities. If 'removeSpice' is not 0, that amount of spice will be
/// removed from the planet.
/// @param planetRecord
/// @param removeSpice
/// @returns The total spice production of the planet.
static int CalculateSpiceProduction(cPlanetRecord* planetRecord, int removeSpice = 0);

/// Method that calculates how much spice is being produced on a single planet, based on difficulty tunings
/// and number of cities. This method is called every X ticks to update the total spice held on each city.
/// @param baseValue Base value of the computation (e.g. cCityData::mSpiceProduction)
/// @param maxOutput Maximum output value, only applied if `limitOutput` is true
/// @param extraFactor Extra multilpier for the base value
/// @param isHomeWorld
/// @param useSuperpowerMultiplier
/// @param useStorageMultiplier
/// @param finalFactor Extra multiplied applied to the final output value
/// @param numCities
/// @param limitOutput If true, the output value will be capped at `maxOutput`
/// @returns
static float CalculateDeltaSpiceProduction(
float baseValue, float maxOutput, float extraFactor, bool isHomeWorld,
bool useSuperpowerMultiplier, bool useStorageMultiplier, float finalFactor, int numCities, bool limitOutput);

public:
/* 18h */ eastl::string16 mName;
/// The type of the planet, which determines whether it is a gas giant, asteroid belt, or regular rocky planet.
Expand Down Expand Up @@ -261,6 +277,7 @@ namespace Simulator
DeclareAddress(GetPerihelion); // 0xC70190 0xC70FC0
DeclareAddress(FillPlanetDataForTechLevel); // 0xB96820 0xB97090
DeclareAddress(CalculateSpiceProduction); // 0xC6F920 0xC70760
DeclareAddress(CalculateDeltaSpiceProduction); // 0xC71200 0xC720A0
}

inline ResourceKey cPlanetRecord::GenerateTerrainKey()
Expand Down

0 comments on commit b4eee23

Please sign in to comment.