HOPKINS: Fix several Cppcheck warning

This commit is contained in:
Strangerke 2013-03-27 00:51:35 +01:00
parent 02f939c282
commit 9f9e665d8e
5 changed files with 17 additions and 8 deletions

View File

@ -58,6 +58,7 @@ ComputerManager::ComputerManager(HopkinsEngine *vm) {
_minBreakoutMoveSpeed = 0;
_maxBreakoutMoveSpeed = 0;
_lastBreakoutMoveSpeed = 0;
_breakoutHiscore = 0;
}
/**

View File

@ -125,6 +125,8 @@ Globals::Globals(HopkinsEngine *vm) {
_freezeCharacterFl = false;
_optionDialogFl = false;
_introSpeechOffFl = false;
_cityMapEnabledFl = false;
_baseMapColor = 50;
}

View File

@ -89,6 +89,8 @@ GraphicsManager::GraphicsManager(HopkinsEngine *vm) {
MANU_SCROLL = false;
_scrollSpeed = 32;
}
_noFadingFl = false;
}
GraphicsManager::~GraphicsManager() {

View File

@ -1987,7 +1987,6 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) {
int clipX2 = x2;
int clipY2 = y2;
int superRouteIdx = 0;
if (x2 <= 14)
clipX2 = 15;
if (y2 <= 14)
@ -2036,11 +2035,6 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) {
}
arrDelta[DIR_LEFT] = delta;
int curRouteDataIdx = 0;
int curRouteLineIdx = 0;
int curLineDataIdx = 0;
int curLineIdx = 0;
if (arrLineIdx[DIR_UP] == -1)
arrDelta[DIR_UP] = INVALID_LINE_VALUE;
if (arrLineIdx[DIR_RIGHT] == -1)
@ -2050,6 +2044,8 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) {
if (arrLineIdx[DIR_LEFT] == -1)
arrDelta[DIR_LEFT] = INVALID_LINE_VALUE;
if (arrLineIdx[DIR_UP] != -1 || arrLineIdx[DIR_RIGHT] != -1 || arrLineIdx[DIR_DOWN] != -1 || arrLineIdx[DIR_LEFT] != -1) {
int curLineDataIdx = 0;
int curLineIdx = 0;
if (arrLineIdx[DIR_DOWN] != -1 && arrDelta[DIR_UP] >= arrDelta[DIR_DOWN] && arrDelta[DIR_RIGHT] >= arrDelta[DIR_DOWN] && arrDelta[DIR_LEFT] >= arrDelta[DIR_DOWN]) {
curLineIdx = arrLineIdx[DIR_DOWN];
curLineDataIdx = arrDataIdx[DIR_DOWN];
@ -2069,6 +2065,10 @@ RouteItem *LinesManager::cityMapCarRoute(int x1, int y1, int x2, int y2) {
arrDataIdx[i] = 0;
arrDelta[i] = INVALID_LINE_VALUE;
}
int superRouteIdx = 0;
int curRouteDataIdx = 0;
int curRouteLineIdx = 0;
if (checkCollisionLine(x1, y1, &arrDataIdx[DIR_UP], &arrLineIdx[DIR_UP], 0, _lastLine)) {
curRouteLineIdx = arrLineIdx[DIR_UP];
curRouteDataIdx = arrDataIdx[DIR_UP];

View File

@ -718,7 +718,9 @@ void ObjectsManager::SCBOB(int idx) {
if ((oldBottom > hid->_y) && (oldBottom < hid->_yOffset +hid->_height + hid->_y)) {
if ((oldRight >= hid->_x && oldRight <= cachedRight)
|| (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= hid->_x)
// CHECKME: The original was doing the test two times. This looks like an
// original bug
// || (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= hid->_x)
|| (cachedRight >= _bob[i]._oldWidth && _bob[i]._oldWidth >= hid->_x)
|| (_bob[i]._oldWidth >= hid->_x && oldRight <= cachedRight)
|| (_bob[i]._oldWidth <= hid->_x && oldRight >= cachedRight))
@ -827,7 +829,9 @@ void ObjectsManager::checkHidingItem() {
if (bottom > hid->_y && bottom < (hid->_yOffset + hid->_height + hid->_y)) {
if ((right >= hid->_x && right <= hidingRight)
|| (hidingRight >= spr->_destX && hid->_x <= spr->_destX)
// CHECKME: The original was doing the test two times. This looks like an
// original bug
// || (hidingRight >= spr->_destX && hid->_x <= spr->_destX)
|| (hidingRight >= spr->_destX && hid->_x <= spr->_destX)
|| (hid->_x <= spr->_destX && right <= hidingRight)
|| (hid->_x >= spr->_destX && right >= hidingRight))