diff options
author | Strangerke | 2013-10-25 23:37:41 +0200 |
---|---|---|
committer | Strangerke | 2013-10-25 23:37:41 +0200 |
commit | f10130c414b340d765d89840dc56cbb8bd43b93a (patch) | |
tree | cc37554568e9bb7787e16b7c2a392bda9893f17e | |
parent | da2ddbb8f482003a471b4f27eb222d4f9a23ea7b (diff) | |
download | scummvm-rg350-f10130c414b340d765d89840dc56cbb8bd43b93a.tar.gz scummvm-rg350-f10130c414b340d765d89840dc56cbb8bd43b93a.tar.bz2 scummvm-rg350-f10130c414b340d765d89840dc56cbb8bd43b93a.zip |
AVALANCHE: Fix CID 1109674 - Uninitialized variables in Avalanche.cpp
-rw-r--r-- | engines/avalanche/avalanche.cpp | 62 | ||||
-rw-r--r-- | engines/avalanche/avalanche.h | 1 |
2 files changed, 53 insertions, 10 deletions
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 43e99945dc..9c83c2c9f5 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -41,17 +41,9 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription * TimeDate time; _system->getTimeAndDate(time); _rnd->setSeed(time.tm_sec + time.tm_min + time.tm_hour); - - // Needed because of Lucerna::load_also() - for (int i = 0; i < 31; i++) { - for (int j = 0; j < 2; j++) - _also[i][j] = nullptr; - } - - _totalTime = 0; _showDebugLines = false; - - memset(_fxPal, 0, 16 * 16 * 3); + + initVariables(); } AvalancheEngine::~AvalancheEngine() { @@ -82,6 +74,56 @@ AvalancheEngine::~AvalancheEngine() { } } +void AvalancheEngine::initVariables() { + // Needed because of Lucerna::load_also() + for (int i = 0; i < 31; i++) { + _also[i][0] = nullptr; + _also[i][1] = nullptr; + } + + _totalTime = 0; + + memset(_fxPal, 0, 16 * 16 * 3); + + for (int i = 0; i < 15; i++) { + _peds[i]._direction = kDirNone; + _peds[i]._x = 0; + _peds[i]._y = 0; + _magics[i]._operation = kMagicNothing; + _magics[i]._data = 0; + } + + for (int i = 0; i < 7; i++) { + _portals[i]._operation = kMagicNothing; + _portals[i]._data = 0; + } + + for (int i = 0; i < 30; i++) { + _fields[i]._x1 = 0; + _fields[i]._y1 = 0; + _fields[i]._x2 = 0; + _fields[i]._y2 = 0; + } + + _fieldNum = 0; + _cp = 0; + _ledStatus = 177; + _alive = false; + _subjectNum = 0; + _him = kPeoplePardon; + _her = kPeoplePardon; + _it = Parser::kPardon; + _roomTime = 0; + _doingSpriteRun = false; + _isLoaded = false; + _soundFx = true; + _spludwickAtHome = false; + _passedCwytalotInHerts = false; + _holdTheDawn = false; + _lastRoom = 0; + _lastRoomNotMap = 0; +} + Common::ErrorCode AvalancheEngine::initialize() { _graphics = new GraphicManager(this); _parser = new Parser(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index cff0970d22..3cc342ca8c 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -316,6 +316,7 @@ private: Common::String readAlsoStringFromFile(Common::File &file); void runAvalot(); void init(); + void initVariables(); void setup(); void scram(Common::String &str); void unScramble(); |