diff options
author | Max Horn | 2010-06-15 12:31:37 +0000 |
---|---|---|
committer | Max Horn | 2010-06-15 12:31:37 +0000 |
commit | 7a5ce0eddd01d29d14543679aef8892e08829a63 (patch) | |
tree | 589763e2bc7c9177a21d8afba51f024791720afc /engines | |
parent | 2b24a1a2adcd112a6f3d878c9172ec570a6077d9 (diff) | |
download | scummvm-rg350-7a5ce0eddd01d29d14543679aef8892e08829a63.tar.gz scummvm-rg350-7a5ce0eddd01d29d14543679aef8892e08829a63.tar.bz2 scummvm-rg350-7a5ce0eddd01d29d14543679aef8892e08829a63.zip |
SCI: Make Resource::_id protected
svn-id: r49842
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/resource.cpp | 8 | ||||
-rw-r--r-- | engines/sci/resource.h | 16 |
2 files changed, 11 insertions, 13 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 00da600b26..e23d8fd080 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -133,7 +133,7 @@ const char *getResourceTypeName(ResourceType restype) { } //-- Resource main functions -- -Resource::Resource() { +Resource::Resource(ResourceId id) : _id(id) { data = NULL; size = 0; _fileOffset = 0; @@ -1485,9 +1485,8 @@ void MacResourceForkResourceSource::scanSource() { void ResourceManager::addResource(ResourceId resId, ResourceSource *src, uint32 offset, uint32 size) { // Adding new resource only if it does not exist if (_resMap.contains(resId) == false) { - Resource *res = new Resource; + Resource *res = new Resource(resId); _resMap.setVal(resId, res); - res->_id = resId; res->_source = src; res->_fileOffset = offset; res->size = size; @@ -1501,11 +1500,10 @@ Resource *ResourceManager::updateResource(ResourceId resId, ResourceSource *src, if (_resMap.contains(resId)) { res = _resMap.getVal(resId); } else { - res = new Resource; + res = new Resource(resId); _resMap.setVal(resId, res); } - res->_id = resId; res->_status = kResStatusNoMalloc; res->_source = src; res->_headerSize = 0; diff --git a/engines/sci/resource.h b/engines/sci/resource.h index e030db4bc4..43408b0ffe 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -184,20 +184,19 @@ class Resource { friend class AudioVolumeResourceSource; friend class MacResourceForkResourceSource; +// NOTE : Currently most member variables lack the underscore prefix and have +// public visibility to let the rest of the engine compile without changes. public: - Resource(); - ~Resource(); - void unalloc(); - -// NOTE : Currently all member data has the same name and public visibility -// to let the rest of the engine compile without changes -public: - ResourceId _id; byte *data; uint32 size; byte *_header; uint32 _headerSize; +public: + Resource(ResourceId id); + ~Resource(); + void unalloc(); + inline ResourceType getType() const { return _id.getType(); } /** @@ -208,6 +207,7 @@ public: uint32 getAudioCompressionType() const; protected: + ResourceId _id; // TODO: _id could almost be made const, only readResourceInfo() modifies it... int32 _fileOffset; /**< Offset in file */ ResourceStatus _status; uint16 _lockers; /**< Number of places where this resource was locked */ |