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
This commit is contained in:
Kari Salminen 2008-08-09 22:38:03 +00:00
parent 983a4f21e5
commit ef3b72d5e4
4 changed files with 13 additions and 7 deletions

View File

@ -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();

View File

@ -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) {

View File

@ -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

View File

@ -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);