Added a routine to interrogate resource types.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3099 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2008-11-24 00:09:54 +00:00
parent 5407575ef4
commit d1832e6f66
2 changed files with 26 additions and 0 deletions
+1
View File
@@ -67,6 +67,7 @@ BOOLEAN FreeResource (RESOURCE res);
COUNT CountResourceTypes (void);
DWORD res_GetIntResource (RESOURCE res);
BOOLEAN res_GetBooleanResource (RESOURCE res);
const char *res_GetResourceType (RESOURCE res);
void LoadResourceIndex (uio_DirHandle *dir, const char *filename);
+25
View File
@@ -73,6 +73,31 @@ err:
return NULL;
}
const char *
res_GetResourceType (RESOURCE res)
{
RESOURCE_INDEX resourceIndex;
ResourceDesc *desc;
if (res == NULL_RESOURCE)
{
log_add (log_Warning, "Trying to get type of null resource");
return NULL;
}
resourceIndex = _get_current_index_header ();
desc = lookupResourceDesc (resourceIndex, res);
if (desc == NULL)
{
log_add (log_Warning, "Trying to get type of undefined resource '%s'",
res);
return NULL;
}
return desc->vtable->resType;
}
// Get a resource by its resource ID.
void *
res_GetResource (RESOURCE res)