[Scummvm-cvs-logs] scummvm master -> f10130c414b340d765d89840dc56cbb8bd43b93a

Strangerke Strangerke at scummvm.org
Fri Oct 25 23:38:42 CEST 2013


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
da2ddbb8f4 AVALANCHE: Fix 3 issues reported by Coverity.
f10130c414 AVALANCHE: Fix CID 1109674 - Uninitialized variables in Avalanche.cpp


Commit: da2ddbb8f482003a471b4f27eb222d4f9a23ea7b
    https://github.com/scummvm/scummvm/commit/da2ddbb8f482003a471b4f27eb222d4f9a23ea7b
Author: Strangerke (strangerke at scummvm.org)
Date: 2013-10-25T13:40:09-07:00

Commit Message:
AVALANCHE: Fix 3 issues reported by Coverity.

Changed paths:
    engines/avalanche/background.cpp
    engines/avalanche/graphics.cpp
    engines/avalanche/parser.cpp



diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp
index c84c049..4d71550 100644
--- a/engines/avalanche/background.cpp
+++ b/engines/avalanche/background.cpp
@@ -37,6 +37,7 @@ const int16 Background::kOnDisk = -1;
 Background::Background(AvalancheEngine *vm) {
 	_vm = vm;
 	_spriteNum = 0;
+	_nextBell = 0;
 }
 
 Background::~Background() {
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 25b01d6..d7c32cb 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -49,6 +49,7 @@ const MouseHotspotType GraphicManager::kMouseHotSpots[9] = {
 
 GraphicManager::GraphicManager(AvalancheEngine *vm) {
 	_vm = vm;
+	setDialogColor(kColorBlack, kColorWhite);
 }
 
 GraphicManager::~GraphicManager() {
diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp
index 297f27f..b4cb64f 100644
--- a/engines/avalanche/parser.cpp
+++ b/engines/avalanche/parser.cpp
@@ -1013,7 +1013,7 @@ bool Parser::isHolding() {
 
 	bool holdingResult = false;
 
-	if (_thing > 100)
+	if (_thing >= 100)
 		_vm->_dialogs->displayText("Be reasonable!");
 	else if (_thing <= kObjectNum) {
 		if (!_vm->_objects[_thing - 1])


Commit: f10130c414b340d765d89840dc56cbb8bd43b93a
    https://github.com/scummvm/scummvm/commit/f10130c414b340d765d89840dc56cbb8bd43b93a
Author: Strangerke (strangerke at scummvm.org)
Date: 2013-10-25T14:37:41-07:00

Commit Message:
AVALANCHE: Fix CID 1109674 - Uninitialized variables in Avalanche.cpp

Changed paths:
    engines/avalanche/avalanche.cpp
    engines/avalanche/avalanche.h



diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index 43e9994..9c83c2c 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 cff0970..3cc342c 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();






More information about the Scummvm-git-logs mailing list