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:
@@ -27,4 +27,4 @@ void PropFile_from_string (char *d, PROPERTY_HANDLER handler);
|
||||
void PropFile_from_file (uio_Stream *f, PROPERTY_HANDLER handler);
|
||||
void PropFile_from_filename (uio_DirHandle *path, const char *fname, PROPERTY_HANDLER handler);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -134,9 +134,30 @@ process_resource_desc (const char *key, const char *value)
|
||||
void *
|
||||
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
|
||||
NullFreeRes (void *data)
|
||||
{
|
||||
@@ -152,6 +173,9 @@ InitResourceSystem (void)
|
||||
_set_current_index_header (ndx);
|
||||
|
||||
InstallResTypeVectors ("UNKNOWNRES", UseDescriptorAsRes, NullFreeRes);
|
||||
InstallResTypeVectors ("STRING", UseDescriptorAsRes, NullFreeRes);
|
||||
InstallResTypeVectors ("INT32", DescriptorToInt, NullFreeRes);
|
||||
InstallResTypeVectors ("BOOLEAN", DescriptorToBoolean, NullFreeRes);
|
||||
InstallGraphicResTypes ();
|
||||
InstallStringTableResType ();
|
||||
InstallAudioResTypes ();
|
||||
|
||||
Reference in New Issue
Block a user