ResourceKey struct

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

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");

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