diff options
author | Paul Gilbert | 2017-11-14 21:06:12 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-11-14 21:06:12 -0500 |
commit | 74612b40f79e3ffd12c4e21323052a4204f66013 (patch) | |
tree | 574254aa6704b8e65c323536d8dc73179b74d99c | |
parent | e83ede4f07e4547cc9bd93462cfffb4db0a17170 (diff) | |
download | scummvm-rg350-74612b40f79e3ffd12c4e21323052a4204f66013.tar.gz scummvm-rg350-74612b40f79e3ffd12c4e21323052a4204f66013.tar.bz2 scummvm-rg350-74612b40f79e3ffd12c4e21323052a4204f66013.zip |
XEEN: Fix some Coverity warnings
-rw-r--r-- | engines/xeen/character.cpp | 7 | ||||
-rw-r--r-- | engines/xeen/combat.cpp | 6 | ||||
-rw-r--r-- | engines/xeen/detection.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/dialogs_automap.cpp | 3 |
4 files changed, 10 insertions, 8 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp index 510301584f..ac02f2d59e 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 d34399e902..38c994e3a3 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 3c619e9877..0866d5f107 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 16ce225515..079b3e65d7 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); |