Groovie: Fix some styling issues pointed by cppcheck

svn-id: r45411
This commit is contained in:
Jordi Vilalta Prat 2009-10-26 19:06:36 +00:00
parent 49d4e3c467
commit c7476aa16f
3 changed files with 11 additions and 20 deletions

View File

@ -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);

View File

@ -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;

View File

@ -168,8 +168,7 @@ bool VDXPlayer::playFrameInternal() {
default:
error("Groovie::VDX: Invalid resource type: %d", currRes);
}
if (vdxData)
delete vdxData;
delete vdxData;
vdxData = 0;
}