Skip to content

Commit b4eee23

Browse files
committed
Add cPlanetRecord::CalculateDeltaSpiceProduction()
1 parent c994dda commit b4eee23

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,7 @@ namespace Simulator
811811
DefineAddress(GetPerihelion, SelectAddress(0xC70190, 0xC70FC0));
812812
DefineAddress(FillPlanetDataForTechLevel, SelectAddress(0xB96820, 0xB97090));
813813
DefineAddress(CalculateSpiceProduction, SelectAddress(0xC6F920, 0xC70760));
814+
DefineAddress(CalculateDeltaSpiceProduction, SelectAddress(0xC71200, 0xC720A0));
814815
}
815816

816817
namespace Addresses(cCivData) {

Spore ModAPI/SourceCode/Simulator/Planets.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,11 @@ namespace Simulator
6565

6666
auto_STATIC_METHOD(cPlanetRecord, int, CalculateSpiceProduction,
6767
Args(cPlanetRecord* planetRecord, int removeSpice), Args(planetRecord, removeSpice));
68+
69+
auto_STATIC_METHOD(cPlanetRecord, float, CalculateDeltaSpiceProduction,
70+
Args(float baseValue, float maxOutput, float extraFactor, bool isHomeWorld,
71+
bool useSuperpowerMultiplier, bool useStorageMultiplier, float finalFactor, int numCities, bool limitOutput),
72+
Args(baseValue, maxOutput, extraFactor, isHomeWorld, useSuperpowerMultiplier, useStorageMultiplier, finalFactor, numCities, limitOutput));
73+
6874
}
6975
#endif

Spore ModAPI/Spore/Simulator/cPlanetRecord.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,30 @@ namespace Simulator
199199
/// @param techLevel
200200
static void FillPlanetDataForTechLevel(cPlanetRecord* planetRecord, TechLevel techLevel);
201201

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

210+
/// Method that calculates how much spice is being produced on a single planet, based on difficulty tunings
211+
/// and number of cities. This method is called every X ticks to update the total spice held on each city.
212+
/// @param baseValue Base value of the computation (e.g. cCityData::mSpiceProduction)
213+
/// @param maxOutput Maximum output value, only applied if `limitOutput` is true
214+
/// @param extraFactor Extra multilpier for the base value
215+
/// @param isHomeWorld
216+
/// @param useSuperpowerMultiplier
217+
/// @param useStorageMultiplier
218+
/// @param finalFactor Extra multiplied applied to the final output value
219+
/// @param numCities
220+
/// @param limitOutput If true, the output value will be capped at `maxOutput`
221+
/// @returns
222+
static float CalculateDeltaSpiceProduction(
223+
float baseValue, float maxOutput, float extraFactor, bool isHomeWorld,
224+
bool useSuperpowerMultiplier, bool useStorageMultiplier, float finalFactor, int numCities, bool limitOutput);
225+
210226
public:
211227
/* 18h */ eastl::string16 mName;
212228
/// The type of the planet, which determines whether it is a gas giant, asteroid belt, or regular rocky planet.
@@ -261,6 +277,7 @@ namespace Simulator
261277
DeclareAddress(GetPerihelion); // 0xC70190 0xC70FC0
262278
DeclareAddress(FillPlanetDataForTechLevel); // 0xB96820 0xB97090
263279
DeclareAddress(CalculateSpiceProduction); // 0xC6F920 0xC70760
280+
DeclareAddress(CalculateDeltaSpiceProduction); // 0xC71200 0xC720A0
264281
}
265282

266283
inline ResourceKey cPlanetRecord::GenerateTerrainKey()

0 commit comments

Comments
 (0)