diff options
author | Jordi Vilalta Prat | 2009-10-26 19:06:36 +0000 |
---|---|---|
committer | Jordi Vilalta Prat | 2009-10-26 19:06:36 +0000 |
commit | c7476aa16ffe54020f5fea7ad74e76f2e67584cf (patch) | |
tree | 0cfc05ff8da2c89d03a61a8596e5c34b897331a6 /engines | |
parent | 49d4e3c46719e08c26d025e3adad3a39c6a8ba71 (diff) | |
download | scummvm-rg350-c7476aa16ffe54020f5fea7ad74e76f2e67584cf.tar.gz scummvm-rg350-c7476aa16ffe54020f5fea7ad74e76f2e67584cf.tar.bz2 scummvm-rg350-c7476aa16ffe54020f5fea7ad74e76f2e67584cf.zip |
Groovie: Fix some styling issues pointed by cppcheck
svn-id: r45411
Diffstat (limited to 'engines')
-rw-r--r-- | engines/groovie/cell.cpp | 12 | ||||
-rw-r--r-- | engines/groovie/script.cpp | 16 | ||||
-rw-r--r-- | engines/groovie/vdx.cpp | 3 |
3 files changed, 11 insertions, 20 deletions
diff --git a/engines/groovie/cell.cpp b/engines/groovie/cell.cpp index c257ac108e..57061c17de 100644 --- a/engines/groovie/cell.cpp +++ b/engines/groovie/cell.cpp @@ -525,17 +525,15 @@ int CellGame::getBoardWeight(int8 color1, int8 color2) { void CellGame::chooseBestMove(int8 color) { int moveIndex = 0; - int curWeight; - int bestWeight; if (_flag2) { - bestWeight = 32767; + int bestWeight = 32767; for (int i = 0; i < _stack_index; ++i) { _board[53] = _stack_startXY[i]; _board[54] = _stack_endXY[i]; _board[55] = _stack_pass[i]; makeMove(color); - curWeight = countCellsOnTempBoard(color); + int curWeight = countCellsOnTempBoard(color); if (curWeight <= bestWeight) { if (curWeight < bestWeight) moveIndex = 0; @@ -669,9 +667,6 @@ int8 CellGame::calcBestWeight(int8 color1, int8 color2, uint16 depth, int bestWe int16 CellGame::doGame(int8 color, int depth) { bool canMove; int type; - int8 currBoardWeight; - int8 w1; - int8 w2; countAllCells(); if (_board[color + 48] >= 49 - _board[49] - _board[50] - _board[51] - _board[52]) { @@ -685,6 +680,7 @@ int16 CellGame::doGame(int8 color, int depth) { } if (canMove) { + int8 w1, w2; if (_board[color + 48] - _board[49] - _board[50] - _board[51] - _board[52] == 0) depth = 0; _coeff3 = 0; @@ -704,7 +700,7 @@ int16 CellGame::doGame(int8 color, int depth) { } else { w2 = getBoardWeight(color, color); } - currBoardWeight = 2 * (2 * _board[color + 48] - _board[49] - _board[50] - _board[51] - _board[52]); + int8 currBoardWeight = 2 * (2 * _board[color + 48] - _board[49] - _board[50] - _board[51] - _board[52]); while (1) { if (type) canMove = canMoveFunc2(color); diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index 3c6734fc39..1d56b51b5b 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -827,13 +827,12 @@ void Script::o_sleep() { void Script::o_strcmpnejmp() { // 0x1A uint16 varnum = readScript8or16bits(); - uint8 val; uint8 result = 1; debugScript(1, false, "STRCMP-NEJMP: var[0x%04X..],", varnum); do { - val = readScriptChar(true, true, true); + uint8 val = readScriptChar(true, true, true); if (_variables[varnum] != val) { result = 0; @@ -949,12 +948,11 @@ void Script::o_copybgtofg() { // 0x22 void Script::o_strcmpeqjmp() { // 0x23 uint16 varnum = readScript8or16bits(); - uint8 val; uint8 result = 1; debugScript(1, false, "STRCMP-EQJMP: var[0x%04X..],", varnum); do { - val = readScriptChar(true, true, true); + uint8 val = readScriptChar(true, true, true); if (_variables[varnum] != val) { result = 0; @@ -1125,12 +1123,11 @@ void Script::o_loadstringvar() { void Script::o_chargreatjmp() { uint16 varnum = readScript8or16bits(); - uint8 val; uint8 result = 0; debugScript(1, false, "CHARGREAT-JMP: var[0x%04X..],", varnum); do { - val = readScriptChar(true, true, true); + uint8 val = readScriptChar(true, true, true); if (val < _variables[varnum]) { result = 1; @@ -1155,12 +1152,11 @@ void Script::o_bf7off() { void Script::o_charlessjmp() { uint16 varnum = readScript8or16bits(); - uint8 val; uint8 result = 0; debugScript(1, false, "CHARLESS-JMP: var[0x%04X..],", varnum); do { - val = readScriptChar(true, true, true); + uint8 val = readScriptChar(true, true, true); if (val > _variables[varnum]) { result = 1; @@ -1223,14 +1219,14 @@ void Script::o_obscureswap() { } void Script::o_printstring() { - char stringstorage[15], newchar; + char stringstorage[15]; uint8 counter = 0; debugScript(1, true, "PRINTSTRING"); memset(stringstorage, 0, 15); do { - newchar = readScriptChar(true, true, true) + 0x30; + char newchar = readScriptChar(true, true, true) + 0x30; if (newchar < 0x30 || newchar > 0x39) { // If character is invalid, chuck a space in if (newchar < 0x41 || newchar > 0x7A) { newchar = 0x20; diff --git a/engines/groovie/vdx.cpp b/engines/groovie/vdx.cpp index 6e0762a9fe..0c754473fe 100644 --- a/engines/groovie/vdx.cpp +++ b/engines/groovie/vdx.cpp @@ -168,8 +168,7 @@ bool VDXPlayer::playFrameInternal() { default: error("Groovie::VDX: Invalid resource type: %d", currRes); } - if (vdxData) - delete vdxData; + delete vdxData; vdxData = 0; } |