Skip to content

Commit

Permalink
Rename GroupIDs::SpaceTrading to avoid name collisions (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
emd4600 authored Nov 13, 2023
1 parent 552571a commit 8f5dfa3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Spore ModAPI/Spore/CommonIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ namespace GroupIDs

/// Where space tools .prop files are stored
SpaceTools = 0x30608F0B,
/// Where trading configuration of space items are stored
SpaceTrading = 0x034D97FA,
/// Where trading configuration of space items are stored. Check Simulator::cSpaceTrading
SpaceTrading_ = 0x034D97FA,

TribalTools = 0xF37C24E6,
TribePlans = 0x72D02C25,
Expand Down
10 changes: 9 additions & 1 deletion Spore ModAPI/Spore/Simulator/SubSystem/SpaceTrading.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <EASTL\vector.h>
#include <EASTL\fixed_vector.h>

// Check Simulator::cSpaceTrading
#define SpaceTrading (*Simulator::cSpaceTrading::Get())
#define cNPCStorePtr eastl::intrusive_ptr<Simulator::cNPCStore>

Expand All @@ -35,6 +36,13 @@ namespace Simulator
};
ASSERT_SIZE(cNPCStore, 0xC0);

/// Singleton class for everything related to space stage trading, such as obtaining tradable items
/// or generating NPC stores. This class manages the objects in the GroupIDs::SpaceTrading_ folder.
/// Example usage:
/// ```cpp
/// // Get 3 red spice
/// SpaceTrading.ObtainTradingObject({ id("spice1"), TypeIDs::prop, GroupIDs::SpaceTrading_ }, 3);
/// ```
class cSpaceTrading
/* 00h */ : public cStrategy
/* 1Ch */ , public App::IMessageListener
Expand All @@ -51,7 +59,7 @@ namespace Simulator
static bool IsRare(const ResourceKey& key);

/// Gives the specified trading object to the player, adding it to its inventory.
/// The key must be a `.prop` file in GroupIDs::SpaceTrading group.
/// The key must be a `.prop` file in GroupIDs::SpaceTrading_ group.
/// If the item is a rare, it will show an event log, give a badge if necessary, and emit the SimulatorMessages::kMsgSpaceRareFound message.
/// @param key The key of the item
/// @param amount Quantity to give
Expand Down
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/Simulator/cPlanetRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ namespace Simulator
/* 184h */ PlanetID mKey;
/* 188h */ ResourceKey field_188;
/* 194h */ TechLevel mTechLevel;
/// ID of the spice file of this planet in GroupIDs::SpaceTrading; all zeros if it hasn't been assigned yet
/// ID of the spice file of this planet in GroupIDs::SpaceTrading_; all zeros if it hasn't been assigned yet
/* 198h */ ResourceKey mSpiceGen;
/* 1A4h */ ResourceKey mGeneratedTerrainKey;
};
Expand Down

0 comments on commit 8f5dfa3

Please sign in to comment.