diff options
author | Kari Salminen | 2008-08-09 22:38:03 +0000 |
---|---|---|
committer | Kari Salminen | 2008-08-09 22:38:03 +0000 |
commit | ef3b72d5e4a7b1772799224fe94ade279ea2fb5a (patch) | |
tree | 0ec32a1b33518a8ab941e8ab5477b0cc188d2e8d /engines/cine | |
parent | 983a4f21e51814d4f2a65480c6e571ca5a6fb0c3 (diff) | |
download | scummvm-rg350-ef3b72d5e4a7b1772799224fe94ade279ea2fb5a.tar.gz scummvm-rg350-ef3b72d5e4a7b1772799224fe94ade279ea2fb5a.tar.bz2 scummvm-rg350-ef3b72d5e4a7b1772799224fe94ade279ea2fb5a.zip |
Converted zoneData and zoneQuery tables from plain array types to Common::Array. Should help catch out of bounds access errors that may cause memory corruption.
svn-id: r33727
Diffstat (limited to 'engines/cine')
-rw-r--r-- | engines/cine/cine.cpp | 8 | ||||
-rw-r--r-- | engines/cine/main_loop.cpp | 4 | ||||
-rw-r--r-- | engines/cine/various.cpp | 4 | ||||
-rw-r--r-- | engines/cine/various.h | 4 |
4 files changed, 13 insertions, 7 deletions
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index ab1f5ac5e9..6c5069038a 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -132,6 +132,14 @@ void CineEngine::initialize() { animDataTable.resize(NUM_MAX_ANIMDATA); freeAnimDataTable(); + // Resize zone data table to its correct size and reset all its elements + zoneData.resize(NUM_MAX_ZONE); + Common::set_to(zoneData.begin(), zoneData.end(), 0); + + // Resize zone query table to its correct size and reset all its elements + zoneQuery.resize(NUM_MAX_ZONE); + Common::set_to(zoneQuery.begin(), zoneQuery.end(), 0); + _timerDelayMultiplier = 12; // Set default speed setupOpcodes(); diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index 7ad6a53a14..684e33f9c0 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -341,9 +341,7 @@ void CineEngine::mainLoop(int bootScriptIdx) { // Clear the zoneQuery table (Operation Stealth specific) if (g_cine->getGameType() == Cine::GType_OS) { - for (uint i = 0; i < NUM_MAX_ZONE; i++) { - zoneQuery[i] = 0; - } + Common::set_to(zoneQuery.begin(), zoneQuery.end(), 0); } if (g_cine->getGameType() == Cine::GType_OS) { diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index c2ead98d13..a8660d7fdc 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -126,8 +126,8 @@ CommandeType objectListCommand[20]; int16 objListTab[20]; uint16 exitEngine; -uint16 zoneData[NUM_MAX_ZONE]; -uint16 zoneQuery[NUM_MAX_ZONE]; //!< Only exists in Operation Stealth +Common::Array<uint16> zoneData; +Common::Array<uint16> zoneQuery; //!< Only exists in Operation Stealth /*! \brief Move the player character using the keyboard * \param x Negative values move left, positive right, zero not at all diff --git a/engines/cine/various.h b/engines/cine/various.h index 3892786f5f..c38017ceaa 100644 --- a/engines/cine/various.h +++ b/engines/cine/various.h @@ -129,8 +129,8 @@ struct SelectedObjStruct { }; #define NUM_MAX_ZONE 16 -extern uint16 zoneData[NUM_MAX_ZONE]; -extern uint16 zoneQuery[NUM_MAX_ZONE]; +extern Common::Array<uint16> zoneData; +extern Common::Array<uint16> zoneQuery; void addMessage(byte param1, int16 param2, int16 param3, int16 param4, int16 param5); |