[Scummvm-cvs-logs] SF.net SVN: scummvm:[45411] scummvm/trunk/engines/groovie

jvprat at users.sourceforge.net jvprat at users.sourceforge.net
Mon Oct 26 20:06:37 CET 2009


Revision: 45411
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45411&view=rev
Author:   jvprat
Date:     2009-10-26 19:06:36 +0000 (Mon, 26 Oct 2009)

Log Message:
-----------
Groovie: Fix some styling issues pointed by cppcheck

Modified Paths:
--------------
    scummvm/trunk/engines/groovie/cell.cpp
    scummvm/trunk/engines/groovie/script.cpp
    scummvm/trunk/engines/groovie/vdx.cpp

Modified: scummvm/trunk/engines/groovie/cell.cpp
===================================================================
--- scummvm/trunk/engines/groovie/cell.cpp	2009-10-26 18:09:21 UTC (rev 45410)
+++ scummvm/trunk/engines/groovie/cell.cpp	2009-10-26 19:06:36 UTC (rev 45411)
@@ -525,17 +525,15 @@
 
 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 @@
 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 @@
 	}
 
 	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 @@
 		} 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);

Modified: scummvm/trunk/engines/groovie/script.cpp
===================================================================
--- scummvm/trunk/engines/groovie/script.cpp	2009-10-26 18:09:21 UTC (rev 45410)
+++ scummvm/trunk/engines/groovie/script.cpp	2009-10-26 19:06:36 UTC (rev 45411)
@@ -827,13 +827,12 @@
 
 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_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_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_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_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;

Modified: scummvm/trunk/engines/groovie/vdx.cpp
===================================================================
--- scummvm/trunk/engines/groovie/vdx.cpp	2009-10-26 18:09:21 UTC (rev 45410)
+++ scummvm/trunk/engines/groovie/vdx.cpp	2009-10-26 19:06:36 UTC (rev 45411)
@@ -168,8 +168,7 @@
 			default:
 				error("Groovie::VDX: Invalid resource type: %d", currRes);
 		}
-		if (vdxData)
-			delete vdxData;
+		delete vdxData;
 		vdxData = 0;
 	}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list