Merge branch 'master' of github.com:Warzone2100/warzone2100

* 'master' of github.com:Warzone2100/warzone2100:
  68 warnings on the wall, take some down, grind them to dust (with help from per), 40 warnings on the wall.
master
buginator 2010-12-20 17:35:49 -05:00
commit 1b28712974
12 changed files with 16 additions and 32 deletions

View File

@ -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 */ 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) 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 // any value or'ed with VAL_REF is a pointer
if (type >= VAL_REF) return true; if (type >= VAL_REF) return true;
switch (type) { switch (type) {

View File

@ -78,7 +78,7 @@ bool PlayList_Read(const char* path)
} }
// Find the end of the songList // Find the end of the songList
for (; *last; last = &(*last)->next); for (; *last; last = &(*last)->next) {}
while (!PHYSFS_eof(fileHandle)) while (!PHYSFS_eof(fileHandle))
{ {

View File

@ -944,12 +944,10 @@ void processMouseClickInput(void)
// can't build if res extractors arent available. // can't build if res extractors arent available.
if (item == MT_RESOURCE) if (item == MT_RESOURCE)
{ {
for (i=0;(i<numStructureStats)&&(asStructureStats[i].type != REF_RESOURCE_EXTRACTOR);i++); // find resource stat for (i = 0; i < numStructureStats && asStructureStats[i].type != REF_RESOURCE_EXTRACTOR; i++) {} // find resource stat
if (i < numStructureStats && apStructTypeLists[selectedPlayer][i] != AVAILABLE) // check if you can build it!
{ {
if( (i < numStructureStats) && (apStructTypeLists[selectedPlayer][i] != AVAILABLE)) // check if you can build it! item = MT_BLOCKING; // don't allow build pointer.
{
item = MT_BLOCKING; // don't allow build pointer.
}
} }
} }

View File

@ -6229,9 +6229,7 @@ BOOL intAddProximityButton(PROXIMITY_DISPLAY *psProxDisp, UDWORD inc)
{ {
for(cnt = IDPROX_START;cnt<IDPROX_END;cnt++) for(cnt = IDPROX_START;cnt<IDPROX_END;cnt++)
{ // go down the prox msgs and see if it's free. { // go down the prox msgs and see if it's free.
for (psProxDisp2 = apsProxDisp[selectedPlayer]; for (psProxDisp2 = apsProxDisp[selectedPlayer]; psProxDisp2 && psProxDisp2->buttonID != cnt; psProxDisp2 = psProxDisp2->psNext) {}
psProxDisp2 &&(psProxDisp2->buttonID!=cnt) ;
psProxDisp2 = psProxDisp2->psNext);
if(psProxDisp == NULL) // value was unused. if(psProxDisp == NULL) // value was unused.
{ {

View File

@ -549,9 +549,7 @@ BOOL saveKeyMap(void)
WRITE(&psMapping->action, sizeof(KEY_ACTION)); // action WRITE(&psMapping->action, sizeof(KEY_ACTION)); // action
// function to map to! // function to map to!
for (count = 0; keyMapSaveTable[count] != NULL for (count = 0; keyMapSaveTable[count] != NULL && keyMapSaveTable[count] != psMapping->function; count++) {}
&& keyMapSaveTable[count] != psMapping->function;
count++);
if(keyMapSaveTable[count] == NULL) if(keyMapSaveTable[count] == NULL)
{ {
debug( LOG_FATAL, "can't find keymapped function %s in the keymap save table at %d!", name, count ); debug( LOG_FATAL, "can't find keymapped function %s in the keymap save table at %d!", name, count );

View File

@ -730,7 +730,7 @@ SDWORD i;
break; break;
} }
if(keyToProcess->subKeyCode == KEY_MAXSCAN) if (keyToProcess->subKeyCode == (KEY_CODE)KEY_MAXSCAN)
{ {
continue; continue;
} }

View File

@ -2655,7 +2655,7 @@ void moveUpdateDroid(DROID *psDroid)
updateDroidOrientation(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.x = psDroid->pos.x + (18-rand()%36);
pos.z = psDroid->pos.y + (18-rand()%36); pos.z = psDroid->pos.y + (18-rand()%36);

View File

@ -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 // Check if we know which player this is from, in that case, assume it is a player template
if (player != ANYPLAYER && player < MAX_PLAYERS) if (player != ANYPLAYER && player < MAX_PLAYERS)
{ {
for (psTempl = apsDroidTemplates[player]; // follow templates for (psTempl = apsDroidTemplates[player]; psTempl && (psTempl->multiPlayerID != tempId); psTempl = psTempl->psNext) {} // follow templates
(psTempl && (psTempl->multiPlayerID != tempId ));
psTempl = psTempl->psNext);
return psTempl; return psTempl;
} }
@ -531,9 +529,7 @@ Vector3i cameraToHome(UDWORD player,BOOL scroll)
UDWORD x,y; UDWORD x,y;
STRUCTURE *psBuilding; STRUCTURE *psBuilding;
for (psBuilding = apsStructLists[player]; for (psBuilding = apsStructLists[player]; psBuilding && (psBuilding->pStructureType->type != REF_HQ); psBuilding= psBuilding->psNext) {}
psBuilding && (psBuilding->pStructureType->type != REF_HQ);
psBuilding= psBuilding->psNext);
if(psBuilding) if(psBuilding)
{ {

View File

@ -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. // The building wasn't started, so we'll have to just plonk it down in the map.
// Find the structures stats // Find the structures stats
for (typeindex=0; // Find structure target for (typeindex = 0; typeindex < numStructureStats && asStructureStats[typeindex].ref != type; typeindex++) {} // Find structure target
(typeindex<numStructureStats ) && (asStructureStats[typeindex].ref != type);
typeindex++);
// Check for similar buildings, to avoid overlaps // Check for similar buildings, to avoid overlaps
if (TileHasStructure(mapTile(map_coord(pos.x), map_coord(pos.y)))) if (TileHasStructure(mapTile(map_coord(pos.x), map_coord(pos.y))))

View File

@ -523,12 +523,9 @@ void fillUpStats( void )
infoBars[STAT_STR_BLOWN_UP].percent = PERCENT(length,STAT_BAR_WIDTH); infoBars[STAT_STR_BLOWN_UP].percent = PERCENT(length,STAT_BAR_WIDTH);
/* Finally the force information - need amount of droids as well*/ /* Finally the force information - need amount of droids as well*/
for(psDroid = apsDroidLists[selectedPlayer],numUnits = 0; for(psDroid = apsDroidLists[selectedPlayer], numUnits = 0; psDroid; psDroid = psDroid->psNext, numUnits++) {}
psDroid; psDroid = psDroid->psNext,numUnits++);
for(psDroid = mission.apsDroidLists[selectedPlayer];
psDroid; psDroid = psDroid->psNext,numUnits++);
for(psDroid = mission.apsDroidLists[selectedPlayer]; psDroid; psDroid = psDroid->psNext, numUnits++) {}
maxi = MAX(missionData.unitsBuilt, missionData.strBuilt); maxi = MAX(missionData.unitsBuilt, missionData.strBuilt);
maxi = MAX(maxi, numUnits); maxi = MAX(maxi, numUnits);

View File

@ -1535,8 +1535,7 @@ BOOL scrSkLocateEnemy(void)
|| psStruct->pStructureType->type == REF_CYBORG_FACTORY || psStruct->pStructureType->type == REF_CYBORG_FACTORY
|| psStruct->pStructureType->type == REF_VTOL_FACTORY || psStruct->pStructureType->type == REF_VTOL_FACTORY
); );
psStruct=psStruct->psNext); psStruct = psStruct->psNext) {}
// set the x and y accordingly.. // set the x and y accordingly..
if(psStruct) if(psStruct)

View File

@ -2768,7 +2768,7 @@ static BOOL structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
for(psFlag = apsFlagPosLists[psFact->psAssemblyPoint->player]; for(psFlag = apsFlagPosLists[psFact->psAssemblyPoint->player];
!( (psFlag->factoryInc == psFact->psAssemblyPoint->factoryInc) // correct fact. !( (psFlag->factoryInc == psFact->psAssemblyPoint->factoryInc) // correct fact.
&&(psFlag->factoryType == factoryType)); // correct type &&(psFlag->factoryType == factoryType)); // correct type
psFlag = psFlag->psNext); psFlag = psFlag->psNext) {}
if (isVtolDroid(psNewDroid)) if (isVtolDroid(psNewDroid))
{ {