Basic, non-typesafe implementation of primitive resource types.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2972 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2008-05-14 22:34:06 +00:00
parent 47a7575e97
commit f183008374
2 changed files with 26 additions and 2 deletions
+25 -1
View File
@@ -134,9 +134,30 @@ process_resource_desc (const char *key, const char *value)
void * void *
UseDescriptorAsRes (const char *descriptor) UseDescriptorAsRes (const char *descriptor)
{ {
return descriptor; return (void *)descriptor;
} }
void *
DescriptorToInt (const char *descriptor)
{
intptr_t value = atoi(descriptor);
return (void *) value;
}
void *
DescriptorToBoolean (const char *descriptor)
{
if (!stricmp(descriptor, "true"))
{
return (void *)(1);
}
else
{
return (void *)(0);
}
}
BOOLEAN BOOLEAN
NullFreeRes (void *data) NullFreeRes (void *data)
{ {
@@ -152,6 +173,9 @@ InitResourceSystem (void)
_set_current_index_header (ndx); _set_current_index_header (ndx);
InstallResTypeVectors ("UNKNOWNRES", UseDescriptorAsRes, NullFreeRes); InstallResTypeVectors ("UNKNOWNRES", UseDescriptorAsRes, NullFreeRes);
InstallResTypeVectors ("STRING", UseDescriptorAsRes, NullFreeRes);
InstallResTypeVectors ("INT32", DescriptorToInt, NullFreeRes);
InstallResTypeVectors ("BOOLEAN", DescriptorToBoolean, NullFreeRes);
InstallGraphicResTypes (); InstallGraphicResTypes ();
InstallStringTableResType (); InstallStringTableResType ();
InstallAudioResTypes (); InstallAudioResTypes ();