[Scummvm-git-logs] scummvm master -> 74612b40f79e3ffd12c4e21323052a4204f66013

dreammaster dreammaster at scummvm.org
Wed Nov 15 03:06:14 CET 2017


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

Summary:
74612b40f7 XEEN: Fix some Coverity warnings


Commit: 74612b40f79e3ffd12c4e21323052a4204f66013
    https://github.com/scummvm/scummvm/commit/74612b40f79e3ffd12c4e21323052a4204f66013
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-11-14T21:06:12-05:00

Commit Message:
XEEN: Fix some Coverity warnings

Changed paths:
    engines/xeen/character.cpp
    engines/xeen/combat.cpp
    engines/xeen/detection.cpp
    engines/xeen/dialogs_automap.cpp


diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 5103015..ac02f2d 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -1462,6 +1462,7 @@ uint Character::nextExperienceLevel() const {
 		shift = 10;
 	} else {
 		base = 0;
+		assert(_level._permanent > 0);
 		shift = _level._permanent - 1;
 	}
 
@@ -1709,8 +1710,10 @@ int Character::makeItem(int p1, int itemIndex, int p3) {
 
 		case 3:
 			mult = p1 == 7 || vm->getRandomNumber(1, 100) > 70 ? 1 : 0;
-			v16 = vm->getRandomNumber(Res.MAKE_ITEM_ARR4[mult][p1][0],
-				Res.MAKE_ITEM_ARR4[mult][p1][1]);
+			v16 = vm->getRandomNumber(Res.MAKE_ITEM_ARR4[mult][p1 - 1][0],
+				Res.MAKE_ITEM_ARR4[mult][p1 - 1][1]);
+			if (mult)
+				v16 += 9;
 			break;
 
 		case 4:
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index d34399e..38c994e 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -885,8 +885,8 @@ void Combat::doMonsterTurn(int monsterId) {
 						switch (_combatParty[idx]->worstCondition()) {
 						case PARALYZED:
 						case UNCONSCIOUS:
-							if (flag)
-								skip = true;
+							//if (flag)
+							//	skip = true;
 							break;
 						case DEAD:
 						case STONED:
@@ -1326,7 +1326,7 @@ void Combat::attack(Character &c, RangeType rangeType) {
 			divisor = 8;
 			break;
 		default:
-			break;
+			error("Invalid class");
 		}
 
 		int numberOfAttacks = c.getCurrentLevel() / divisor + 1;
diff --git a/engines/xeen/detection.cpp b/engines/xeen/detection.cpp
index 3c619e9..0866d5f 100644
--- a/engines/xeen/detection.cpp
+++ b/engines/xeen/detection.cpp
@@ -119,7 +119,7 @@ bool XeenMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGame
 		*engine = new Xeen::WorldOfXeen::WorldOfXeenEngine(syst, gd);
 		break;
 	default:
-		break;
+		error("Invalid game");
 	}
 
 	return gd != 0;
diff --git a/engines/xeen/dialogs_automap.cpp b/engines/xeen/dialogs_automap.cpp
index 16ce225..079b3e6 100644
--- a/engines/xeen/dialogs_automap.cpp
+++ b/engines/xeen/dialogs_automap.cpp
@@ -85,7 +85,7 @@ void AutoMapDialog::execute() {
 
 		if (map._isOutdoors) {
 			// Draw outdoors map
-			for (int yp = 38, yDiff = pt.y + 7; pt.y < 166; --yDiff, yp += 8) {
+			for (int yp = 38, yDiff = pt.y + 7; yp < 166; --yDiff, yp += 8) {
 				for (int xp = 80, xDiff = pt.x - 7; xp < 240; xp += 10, ++xDiff) {
 					v = map.mazeLookup(Common::Point(xDiff, yDiff), 0);
 
@@ -106,7 +106,6 @@ void AutoMapDialog::execute() {
 				}
 			}
 
-
 			for (int yp = 38, yDiff = pt.y + 7; yp < 166; yp += 8, --yDiff) {
 				for (int xp = 80, xDiff = -7; xp < 240; xp += 10, ++xDiff) {
 					v = map.mazeLookup(Common::Point(xDiff, yDiff), 8);





More information about the Scummvm-git-logs mailing list