From dcca83dd2aff06add53564d62f0282368f85a532 Mon Sep 17 00:00:00 2001 From: dak180 Date: Mon, 20 Dec 2010 12:16:45 -0500 Subject: [PATCH] 68 warnings on the wall, take some down, grind them to dust (with help from per), 40 warnings on the wall. --- lib/script/script.cpp | 2 +- lib/sound/playlist.cpp | 2 +- src/display.cpp | 8 +++----- src/hci.cpp | 4 +--- src/keyedit.cpp | 4 +--- src/keymap.cpp | 2 +- src/move.cpp | 2 +- src/multiplay.cpp | 8 ++------ src/multistruct.cpp | 4 +--- src/scores.cpp | 7 ++----- src/scriptai.cpp | 3 +-- src/structure.cpp | 2 +- 12 files changed, 16 insertions(+), 32 deletions(-) diff --git a/lib/script/script.cpp b/lib/script/script.cpp index ede85e8df..18f6346e1 100644 --- a/lib/script/script.cpp +++ b/lib/script/script.cpp @@ -175,7 +175,7 @@ BOOL scriptGetVarIndex(SCRIPT_CODE *psCode, char *pID, UDWORD *pIndex) these aren't currently checked for, but it's a lot clearer what's going on if they're all here */ BOOL scriptTypeIsPointer(INTERP_TYPE type) { - ASSERT( ((type < ST_MAXTYPE) || (type >= VAL_REF)), "scriptTypeIsPointer: invalid type: %d", type ); + ASSERT((_scr_user_types)type < ST_MAXTYPE || type >= VAL_REF, "Invalid type: %d", type); // any value or'ed with VAL_REF is a pointer if (type >= VAL_REF) return true; switch (type) { diff --git a/lib/sound/playlist.cpp b/lib/sound/playlist.cpp index 6fbd39c64..f2cfada73 100644 --- a/lib/sound/playlist.cpp +++ b/lib/sound/playlist.cpp @@ -78,7 +78,7 @@ bool PlayList_Read(const char* path) } // Find the end of the songList - for (; *last; last = &(*last)->next); + for (; *last; last = &(*last)->next) {} while (!PHYSFS_eof(fileHandle)) { diff --git a/src/display.cpp b/src/display.cpp index 62aacfaf8..5f2cf572a 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -944,12 +944,10 @@ void processMouseClickInput(void) // can't build if res extractors arent available. if (item == MT_RESOURCE) { - for (i=0;(ibuttonID!=cnt) ; - psProxDisp2 = psProxDisp2->psNext); + for (psProxDisp2 = apsProxDisp[selectedPlayer]; psProxDisp2 && psProxDisp2->buttonID != cnt; psProxDisp2 = psProxDisp2->psNext) {} if(psProxDisp == NULL) // value was unused. { diff --git a/src/keyedit.cpp b/src/keyedit.cpp index bf4817dc0..405bead2d 100644 --- a/src/keyedit.cpp +++ b/src/keyedit.cpp @@ -549,9 +549,7 @@ BOOL saveKeyMap(void) WRITE(&psMapping->action, sizeof(KEY_ACTION)); // action // function to map to! - for (count = 0; keyMapSaveTable[count] != NULL - && keyMapSaveTable[count] != psMapping->function; - count++); + for (count = 0; keyMapSaveTable[count] != NULL && keyMapSaveTable[count] != psMapping->function; count++) {} if(keyMapSaveTable[count] == NULL) { debug( LOG_FATAL, "can't find keymapped function %s in the keymap save table at %d!", name, count ); diff --git a/src/keymap.cpp b/src/keymap.cpp index ac7fea8b6..a345fd2e1 100644 --- a/src/keymap.cpp +++ b/src/keymap.cpp @@ -730,7 +730,7 @@ SDWORD i; break; } - if(keyToProcess->subKeyCode == KEY_MAXSCAN) + if (keyToProcess->subKeyCode == (KEY_CODE)KEY_MAXSCAN) { continue; } diff --git a/src/move.cpp b/src/move.cpp index c61ea2dba..87c2a3f80 100644 --- a/src/move.cpp +++ b/src/move.cpp @@ -2655,7 +2655,7 @@ void moveUpdateDroid(DROID *psDroid) updateDroidOrientation(psDroid); } - if( (psDroid->inFire && psDroid->type != DROID_PERSON) && psDroid->visible[selectedPlayer]) + if( (psDroid->inFire && psDroid->droidType != DROID_PERSON) && psDroid->visible[selectedPlayer]) { pos.x = psDroid->pos.x + (18-rand()%36); pos.z = psDroid->pos.y + (18-rand()%36); diff --git a/src/multiplay.cpp b/src/multiplay.cpp index 0bb4263ad..1c68b1899 100644 --- a/src/multiplay.cpp +++ b/src/multiplay.cpp @@ -404,9 +404,7 @@ DROID_TEMPLATE *IdToTemplate(UDWORD tempId,UDWORD player) // Check if we know which player this is from, in that case, assume it is a player template if (player != ANYPLAYER && player < MAX_PLAYERS) { - for (psTempl = apsDroidTemplates[player]; // follow templates - (psTempl && (psTempl->multiPlayerID != tempId )); - psTempl = psTempl->psNext); + for (psTempl = apsDroidTemplates[player]; psTempl && (psTempl->multiPlayerID != tempId); psTempl = psTempl->psNext) {} // follow templates return psTempl; } @@ -531,9 +529,7 @@ Vector3i cameraToHome(UDWORD player,BOOL scroll) UDWORD x,y; STRUCTURE *psBuilding; - for (psBuilding = apsStructLists[player]; - psBuilding && (psBuilding->pStructureType->type != REF_HQ); - psBuilding= psBuilding->psNext); + for (psBuilding = apsStructLists[player]; psBuilding && (psBuilding->pStructureType->type != REF_HQ); psBuilding= psBuilding->psNext) {} if(psBuilding) { diff --git a/src/multistruct.cpp b/src/multistruct.cpp index 682c3aefb..d91fd09d8 100644 --- a/src/multistruct.cpp +++ b/src/multistruct.cpp @@ -105,9 +105,7 @@ BOOL recvBuildFinished(NETQUEUE queue) // The building wasn't started, so we'll have to just plonk it down in the map. // Find the structures stats - for (typeindex=0; // Find structure target - (typeindexpsNext,numUnits++); - - for(psDroid = mission.apsDroidLists[selectedPlayer]; - psDroid; psDroid = psDroid->psNext,numUnits++); + for(psDroid = apsDroidLists[selectedPlayer], numUnits = 0; psDroid; psDroid = psDroid->psNext, numUnits++) {} + for(psDroid = mission.apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext, numUnits++) {} maxi = MAX(missionData.unitsBuilt, missionData.strBuilt); maxi = MAX(maxi, numUnits); diff --git a/src/scriptai.cpp b/src/scriptai.cpp index 51668a917..5ca5149d5 100644 --- a/src/scriptai.cpp +++ b/src/scriptai.cpp @@ -1535,8 +1535,7 @@ BOOL scrSkLocateEnemy(void) || psStruct->pStructureType->type == REF_CYBORG_FACTORY || psStruct->pStructureType->type == REF_VTOL_FACTORY ); - psStruct=psStruct->psNext); - + psStruct = psStruct->psNext) {} // set the x and y accordingly.. if(psStruct) diff --git a/src/structure.cpp b/src/structure.cpp index 9c760b89c..25a3e5eef 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -2768,7 +2768,7 @@ static BOOL structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl, for(psFlag = apsFlagPosLists[psFact->psAssemblyPoint->player]; !( (psFlag->factoryInc == psFact->psAssemblyPoint->factoryInc) // correct fact. &&(psFlag->factoryType == factoryType)); // correct type - psFlag = psFlag->psNext); + psFlag = psFlag->psNext) {} if (isVtolDroid(psNewDroid)) {