ResourceKey struct
#include <Spore ModAPI/Spore/ResourceKey.h>
A structure used to point a resource in the game, made by three IDs: instance, group and type.
The groupID is used when hashing and comparing, allowing this class to be used in containers such as hash_map or sorted vectors.
Public static variables
-
static const uint32_
t kWildcardID
Public static functions
-
static auto Parse(ResourceKey& dst,
const char16_
t* pString, uint32_ t defaultTypeID = 0, uint32_ t defaultGroupID = 0) -> bool - Creates a ResourceKey from the given text, which is in the format "groupID!instanceID.typeID".
Constructors, destructors, conversion operators
- ResourceKey()
-
ResourceKey(uint32_
t nInstanceID, uint32_ t nTypeID, uint32_ t nGroupID)
Public functions
-
auto WithInstance(uint32_
t instanceId) -> ResourceKey - Returns a copy of this key with a different instance ID.
-
auto WithType(uint32_
t typeId) -> ResourceKey - Returns a copy of this key with a different type ID.
-
auto WithGroup(uint32_
t groupId) -> ResourceKey - Returns a copy of this key with a different group ID.
- auto operator==(const ResourceKey& b) const -> bool
- auto operator!=(const ResourceKey& b) const -> bool
- auto operator<(const ResourceKey& b) const -> bool
- auto operator>(const ResourceKey& b) const -> bool
Public variables
Function documentation
static bool ResourceKey:: Parse(ResourceKey& dst,
const char16_ t* pString,
uint32_ t defaultTypeID = 0,
uint32_ t defaultGroupID = 0)
Creates a ResourceKey from the given text, which is in the format "groupID!instanceID.typeID".
Parameters | |
---|---|
dst out | The ResourceKey that will be filled with the parsed information. |
pString in | The eastl::string to parse. |
defaultTypeID in | [Optional] The typeID that will be used if no extension is specified in the text. |
defaultGroupID in | [Optional] The groupID that will be used if no group is specified in the text. |
Returns | True if the text was successfully parsed, false if the given eastl::string was nullptr. |
The groupID and typeID can be ommited, however; if that happens, they will be replaced with the optional parameters nDefaultGroupID and nDefaultTypeID respectively.
The resulting uint32_ts will be the hashes of the eastl::strings separated by the '!' and '.' signs. The typeID can have a special treatment, however: before hashing it, it will check if there's a mapping for that extension in the ResourceManager class.
Examples: Parse(dstKey, "Properties.txt"); // this will be in the global (0x00000000) folder, with the appropiate mapping for the .txt extension) Parse(dstKey, "CreatureEditorBackground.rw4", 0, 0x40606000); // this will search in the editor_rigblocks~ (0x40606000) folder. Parse(dstKey, "CreatureGame!DifficultyTunning.prop");
ResourceKey ResourceKey:: WithInstance(uint32_ t instanceId)
Returns a copy of this key with a different instance ID.
Parameters | |
---|---|
instanceId |
ResourceKey ResourceKey:: WithType(uint32_ t typeId)
Returns a copy of this key with a different type ID.
Parameters | |
---|---|
typeId |
ResourceKey ResourceKey:: WithGroup(uint32_ t groupId)
Returns a copy of this key with a different group ID.
Parameters | |
---|---|
groupId |