Skip to content

Commit 2e3e0d3

Browse files
committed
Add cPlanetRecord::GetTypeIconKey() and cPlanetRecord::HasControlledCity()
1 parent ef40d11 commit 2e3e0d3

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,8 @@ namespace Simulator
840840
DefineAddress(CalculateSpiceProduction, SelectAddress(0xC6F920, 0xC70760));
841841
DefineAddress(CalculateDeltaSpiceProduction, SelectAddress(0xC71200, 0xC720A0));
842842
DefineAddress(GetTerrainScriptSource, SelectAddress(0xB8D690, 0xB8DEB0));
843+
DefineAddress(HasControlledCity, SelectAddress(0xC6F4B0, 0xC702F0));
844+
DefineAddress(GetTypeIconKey, SelectAddress(0xE2EBE0, 0xE2EB70));
843845
}
844846

845847
namespace Addresses(cCivData) {

Spore ModAPI/SourceCode/Simulator/Planets.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,11 @@ namespace Simulator
8585
STATIC_CALL(GetAddress(cPlanetRecord, GetTerrainScriptSource), void, Args(ResourceKey&), Args(key));
8686
return key;
8787
}
88+
89+
auto_STATIC_METHOD(cPlanetRecord, bool, HasControlledCity,
90+
Args(cPlanetRecord* planetRecord, cEmpire* empire, bool requireMoreThanOneTurret),
91+
Args(planetRecord, empire, requireMoreThanOneTurret));
92+
93+
auto_METHOD_(cPlanetRecord, const ResourceKey&, GetTypeIconKey);
8894
}
8995
#endif

Spore ModAPI/Spore/CommonIDs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ namespace GroupIDs
270270
AssetBrowserSort = 0xC5296FA9,
271271
AssetBrowserGraphics = 0xCA14DE92,
272272

273+
GameEntryImages = 0x199B485,
274+
EditorPlannerImages = 0x355BA26,
275+
273276
Achievements = 0x05BEFD27,
274277
AchievementImages = 0x260EB59C,
275278

Spore ModAPI/Spore/Simulator/cPlanetRecord.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
namespace Simulator
3333
{
3434
class cStarRecord;
35+
class cEmpire;
3536

3637
struct cWallData
3738
{
@@ -187,13 +188,17 @@ namespace Simulator
187188
void SetGeneratedTerrainKey(const ResourceKey& key);
188189
ResourceKey& GetGeneratedTerrainKey();
189190

191+
ResourceKey GetTerrainScriptSource();
192+
193+
/// Returns the key to the icon that is displayed in planet tooltip.
194+
/// This depends on tech level, and whether it has an adventure.
195+
const ResourceKey& GetTypeIconKey();
196+
190197
/// Generates a `.prop` file ResourceKey that is currently unused in game packages, so that
191198
/// the planet terrain can be saved there.
192199
/// @returns
193200
static ResourceKey GenerateTerrainKey();
194201

195-
ResourceKey GetTerrainScriptSource() const;
196-
197202
/// Returns the distance of the perihelion, which is the planet's closest point to the parent object
198203
/// in its orbit (the parent object is either a sun, or another planet if this planet is a moon).
199204
/// @param pRecord The planet
@@ -234,6 +239,14 @@ namespace Simulator
234239
float baseValue, float maxOutput, float extraFactor, bool isHomeWorld,
235240
bool useSuperpowerMultiplier, bool useStorageMultiplier, float finalFactor, int numCities, bool limitOutput);
236241

242+
/// Return true if the planet ahs any city controlled by the specified empire.
243+
/// If 'requireMoreThanOneTurret' is true, then it will only return true if the controlled city
244+
/// has more than one turret.
245+
/// @param planetRecord
246+
/// @param empire
247+
/// @param requireMoreThanOneTurret
248+
static bool HasControlledCity(cPlanetRecord* planetRecord, cEmpire* empire, bool requireMoreThanOneTurret = false);
249+
237250
public:
238251
/* 18h */ eastl::string16 mName;
239252
/// The type of the planet, which determines whether it is a gas giant, asteroid belt, or regular rocky planet.
@@ -296,6 +309,8 @@ namespace Simulator
296309
DeclareAddress(CalculateSpiceProduction); // 0xC6F920 0xC70760
297310
DeclareAddress(CalculateDeltaSpiceProduction); // 0xC71200 0xC720A0
298311
DeclareAddress(GetTerrainScriptSource); // 0xB8D690 0xB8DEB0
312+
DeclareAddress(HasControlledCity); // 0xC6F4B0 0xC702F0
313+
DeclareAddress(GetTypeIconKey); // 0xE2EBE0 0xE2EB70
299314
}
300315

301316
inline ResourceKey cPlanetRecord::GenerateTerrainKey()

0 commit comments

Comments
 (0)