aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/scicore/decompress0.cpp
diff options
context:
space:
mode:
authorJordi Vilalta Prat2009-02-28 23:46:50 +0000
committerJordi Vilalta Prat2009-02-28 23:46:50 +0000
commit7050c7b03f0f7b107df62488fd4dc2f37b704d3b (patch)
tree102ee5f2a5cecb29f1de285d0ea9f004477a37f7 /engines/sci/scicore/decompress0.cpp
parent8e39ac9f12fb95ffda80116389d03f050beabd90 (diff)
downloadscummvm-rg350-7050c7b03f0f7b107df62488fd4dc2f37b704d3b.tar.gz
scummvm-rg350-7050c7b03f0f7b107df62488fd4dc2f37b704d3b.tar.bz2
scummvm-rg350-7050c7b03f0f7b107df62488fd4dc2f37b704d3b.zip
SCI: Use the ResourceType enum instead of integers where it makes sense
svn-id: r38988
Diffstat (limited to 'engines/sci/scicore/decompress0.cpp')
-rw-r--r--engines/sci/scicore/decompress0.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/engines/sci/scicore/decompress0.cpp b/engines/sci/scicore/decompress0.cpp
index 6b3775ff5c..1e9c263845 100644
--- a/engines/sci/scicore/decompress0.cpp
+++ b/engines/sci/scicore/decompress0.cpp
@@ -244,11 +244,13 @@ int decompress0(Resource *result, Common::ReadStream &stream, int sci_version) {
return SCI_ERROR_IO_ERROR;
result->number = result->id & 0x07ff;
- result->type = result->id >> 11;
+ uint8 type = result->id >> 11;
- if ((result->number > sci_max_resource_nr[sci_version]) || (result->type > sci_invalid_resource))
+ if ((result->number > sci_max_resource_nr[sci_version]) || (type > kResourceTypeInvalid))
return SCI_ERROR_DECOMPRESSION_INSANE;
+ result->type = (ResourceType)type;
+
compressedLength = stream.readUint16LE();
result->size = stream.readUint16LE();
compressionMethod = stream.readUint16LE();
@@ -280,7 +282,7 @@ int decompress0(Resource *result, Common::ReadStream &stream, int sci_version) {
#ifdef _SCI_DECOMPRESS_DEBUG
fprintf(stderr, "Resource %s.%03hi encrypted with method %hi at %.2f%%"
" ratio\n",
- sci_resource_types[result->type], result->number, compressionMethod,
+ getResourceTypeName(result->type), result->number, compressionMethod,
(result->size == 0) ? -1.0 :
(100.0 * compressedLength / result->size));
fprintf(stderr, " compressedLength = 0x%hx, actualLength=0x%hx\n",
@@ -324,7 +326,7 @@ int decompress0(Resource *result, Common::ReadStream &stream, int sci_version) {
default:
fprintf(stderr, "Resource %s.%03hi: Compression method %hi not "
- "supported!\n", sci_resource_types[result->type], result->number,
+ "supported!\n", getResourceTypeName(result->type), result->number,
compressionMethod);
free(result->data);
result->data = 0; // So that we know that it didn't work