diff options
author | Bastien Bouclet | 2016-02-06 16:46:02 +0100 |
---|---|---|
committer | Bastien Bouclet | 2016-02-07 15:27:03 +0100 |
commit | 316dc9c829767f339f66861f016faa4b2bca60df (patch) | |
tree | e044260748e8f1913d7e2467cb90d7921f2c35d7 /engines | |
parent | a3064b9027569c44a24d84b4e4a6da4abcdadee5 (diff) | |
download | scummvm-rg350-316dc9c829767f339f66861f016faa4b2bca60df.tar.gz scummvm-rg350-316dc9c829767f339f66861f016faa4b2bca60df.tar.bz2 scummvm-rg350-316dc9c829767f339f66861f016faa4b2bca60df.zip |
MOHAWK: Turn ScriptResource::resourceList into a Common::Array
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mohawk/myst.cpp | 16 | ||||
-rw-r--r-- | engines/mohawk/myst.h | 3 |
2 files changed, 6 insertions, 13 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index f42822f2a7..0cc5a01250 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -795,18 +795,16 @@ void MohawkEngine_Myst::loadCard() { if (scriptResource.type == 3) { scriptResource.var = viewStream->readUint16LE(); debugC(kDebugView, "\t\t Var: %d", scriptResource.var); - scriptResource.count = viewStream->readUint16LE(); - debugC(kDebugView, "\t\t Resource List Count: %d", scriptResource.count); + uint16 count = viewStream->readUint16LE(); + debugC(kDebugView, "\t\t Resource List Count: %d", count); scriptResource.u0 = viewStream->readUint16LE(); debugC(kDebugView, "\t\t u0: %d", scriptResource.u0); - scriptResource.resource_list = new int16[scriptResource.count]; - for (uint16 j = 0; j < scriptResource.count; j++) { - scriptResource.resource_list[j] = viewStream->readSint16LE(); - debugC(kDebugView, "\t\t Resource List %d: %d", j, scriptResource.resource_list[j]); + for (uint16 j = 0; j < count; j++) { + scriptResource.resourceList.push_back(viewStream->readSint16LE()); + debugC(kDebugView, "\t\t Resource List %d: %d", j, scriptResource.resourceList[j]); } } else { - scriptResource.resource_list = nullptr; scriptResource.id = viewStream->readUint16LE(); debugC(kDebugView, "\t\t Id: %d", scriptResource.id); } @@ -875,10 +873,6 @@ void MohawkEngine_Myst::loadCard() { void MohawkEngine_Myst::unloadCard() { _view.conditionalImages.clear(); _view.soundList.clear(); - - for (uint16 i = 0; i < _view.scriptResources.size(); i++) - delete[] _view.scriptResources[i].resource_list; - _view.scriptResources.clear(); } diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h index 1e5ddd85da..12ec21b52c 100644 --- a/engines/mohawk/myst.h +++ b/engines/mohawk/myst.h @@ -137,9 +137,8 @@ struct MystView { uint16 id; // Not used by type 3 // TODO: Type 3 has more. Maybe use a union? uint16 var; // Used by type 3 only - uint16 count; // Used by type 3 only uint16 u0; // Used by type 3 only - int16 *resource_list; // Used by type 3 only + Common::Array<int16> resourceList; // Used by type 3 only }; Common::Array<ScriptResource> scriptResources; |