ResourceKey struct
#include <Spore/ResourceKey.h>
A structure used to point a resource in the game, made by three IDs: instance, group and type.
Contents
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 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
- uint32_t instanceID
- uint32_t typeID
- uint32_t groupID
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");