diff options
author | Bastien Bouclet | 2016-02-06 15:29:07 +0100 |
---|---|---|
committer | Bastien Bouclet | 2016-02-07 15:27:03 +0100 |
commit | ae93f2426763e7965caf5484682d7ad98ffbf4b0 (patch) | |
tree | 63cc4278aadde5f6eecff5341b83e261bed76042 /engines | |
parent | cddb5cd53a8fb5bb64c15a02950b05f5898f7e34 (diff) | |
download | scummvm-rg350-ae93f2426763e7965caf5484682d7ad98ffbf4b0.tar.gz scummvm-rg350-ae93f2426763e7965caf5484682d7ad98ffbf4b0.tar.bz2 scummvm-rg350-ae93f2426763e7965caf5484682d7ad98ffbf4b0.zip |
MOHAWK: Turn MystAreaDrag::ValueList into a Common::Array
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mohawk/myst_areas.cpp | 21 | ||||
-rw-r--r-- | engines/mohawk/myst_areas.h | 5 |
2 files changed, 10 insertions, 16 deletions
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp index 298fc56cdb..00c1629ede 100644 --- a/engines/mohawk/myst_areas.cpp +++ b/engines/mohawk/myst_areas.cpp @@ -702,16 +702,15 @@ MystAreaDrag::MystAreaDrag(MohawkEngine_Myst *vm, Common::SeekableReadStream *rl debugCN(kDebugResource, "Type 11 _mouseDragOpcode: %d\n", _mouseDragOpcode); debugCN(kDebugResource, "Type 11 _mouseUpOpcode: %d\n", _mouseUpOpcode); - for (byte i = 0; i < 3; i++) { + for (byte i = 0; i < ARRAYSIZE(_lists); i++) { debugC(kDebugResource, "\tList %d:", i); - _lists[i].listCount = rlstStream->readUint16LE(); - debugC(kDebugResource, "\t%d values", _lists[i].listCount); + uint16 listCount = rlstStream->readUint16LE(); + debugC(kDebugResource, "\t%d values", listCount); - _lists[i].list = new uint16[_lists[i].listCount]; - for (uint16 j = 0; j < _lists[i].listCount; j++) { - _lists[i].list[j] = rlstStream->readUint16LE(); - debugC(kDebugResource, "\tValue %d: %d", j, _lists[i].list[j]); + for (uint16 j = 0; j < listCount; j++) { + _lists[i].push_back(rlstStream->readUint16LE()); + debugC(kDebugResource, "\tValue %d: %d", j, _lists[i][j]); } } @@ -726,8 +725,6 @@ MystAreaDrag::MystAreaDrag(MohawkEngine_Myst *vm, Common::SeekableReadStream *rl } MystAreaDrag::~MystAreaDrag() { - for (byte i = 0; i < 3; i++) - delete[] _lists[i].list; } void MystAreaDrag::handleMouseDown() { @@ -771,15 +768,15 @@ void MystAreaDrag::setPositionClipping(const Common::Point &mouse, Common::Point } uint16 MystAreaDrag::getList1(uint16 index) { - return (index < _lists[0].listCount) ? _lists[0].list[index] : 0; + return (index < _lists[0].size()) ? _lists[0][index] : 0; } uint16 MystAreaDrag::getList2(uint16 index) { - return (index < _lists[1].listCount) ? _lists[1].list[index] : 0; + return (index < _lists[1].size()) ? _lists[1][index] : 0; } uint16 MystAreaDrag::getList3(uint16 index) { - return (index < _lists[2].listCount) ? _lists[2].list[index] : 0; + return (index < _lists[2].size()) ? _lists[2][index] : 0; } MystVideoInfo::MystVideoInfo(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) : diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h index 2b16b6e502..80bfb3b146 100644 --- a/engines/mohawk/myst_areas.h +++ b/engines/mohawk/myst_areas.h @@ -189,10 +189,7 @@ public: Common::Point _pos; protected: - struct ValueList { - uint16 listCount; - uint16 *list; - }; + typedef Common::Array<uint16> ValueList; void setPositionClipping(const Common::Point &mouse, Common::Point &dest); |