diff --git a/lib/script/evntsave.c b/lib/script/evntsave.c index 51336081a..5bb92d5ad 100644 --- a/lib/script/evntsave.c +++ b/lib/script/evntsave.c @@ -506,7 +506,7 @@ static BOOL eventSaveTriggerList(ACTIVE_TRIGGER *psList, char *pBuffer, UDWORD * // load a list of triggers -static BOOL eventLoadTriggerList(const SDWORD version, char *pBuffer, UDWORD *pSize) +static BOOL eventLoadTriggerList(WZ_DECL_UNUSED const SDWORD version, char *pBuffer, UDWORD *pSize) { UDWORD size, event, offset, time; char *pPos; diff --git a/lib/sound/audio.c b/lib/sound/audio.c index 63081ec3c..f871b940d 100644 --- a/lib/sound/audio.c +++ b/lib/sound/audio.c @@ -1117,7 +1117,7 @@ void audio_RemoveObj(const void* psObj) debug(LOG_MEMORY, "audio_RemoveObj: ***Warning! psOBJ %p was found %u times in the list of playing audio samples", psObj, count); } -static BOOL dummyCB(void *nada) +static BOOL dummyCB(WZ_DECL_UNUSED void* dummy) { return true; } diff --git a/src/multiint.c b/src/multiint.c index 4b6e8e066..157faf9fe 100644 --- a/src/multiint.c +++ b/src/multiint.c @@ -152,7 +152,6 @@ void runGameFind (void); void startGameFind (void); // Connection option functions -static BOOL OptionsInet (UDWORD); static void addConnections (UDWORD); void runConnectionScreen (void); BOOL startConnectionScreen (void); @@ -429,7 +428,7 @@ static void decideWRF(void) // //////////////////////////////////////////////////////////////////////////// // Connection Options Screen. -static BOOL OptionsInet(UDWORD parentID) //internet options +static BOOL OptionsInet(void) //internet options { W_EDBINIT sEdInit; W_FORMINIT sFormInit; @@ -556,7 +555,7 @@ void runConnectionScreen(void ) changeTitleMode(GAMEFIND); break; case CON_TYPESID_START+1: // IP button - OptionsInet(id); + OptionsInet(); break; case CON_IP: // ip entered sstrcpy(addr, widgGetString(psConScreen, CON_IP)); @@ -2078,8 +2077,8 @@ static void processMultiopWidgets(UDWORD id) if((id >= MULTIOP_TEAMCHOOSER) && (id <= MULTIOP_TEAMCHOOSER_END)) { ASSERT(teamChooserUp() >= 0, "processMultiopWidgets: teamChooserUp() < 0"); - ASSERT((id - MULTIOP_TEAMCHOOSER) >= 0 - && (id - MULTIOP_TEAMCHOOSER) < MAX_PLAYERS, "processMultiopWidgets: wrong id - MULTIOP_TEAMCHOOSER value (%d)", id - MULTIOP_TEAMCHOOSER); + ASSERT(id >= MULTIOP_TEAMCHOOSER + && (id - MULTIOP_TEAMCHOOSER) < MAX_PLAYERS, "processMultiopWidgets: wrong id - MULTIOP_TEAMCHOOSER value (%d)", id - MULTIOP_TEAMCHOOSER); resetReadyStatus(false); // will reset only locally if not a host @@ -2613,7 +2612,7 @@ void displayRemoteGame(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGH BOOL Down = false; UDWORD i = psWidget->UserData; char tmp[8]; - UDWORD png; + unsigned int ping; // collate info if( ((W_BUTTON*)psWidget)->state & (WBUTS_HILITE)) @@ -2645,15 +2644,16 @@ void displayRemoteGame(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGH } // ping rating - png = NETgetGameFlagsUnjoined(i,2); - if(png >= PING_LO && png < PING_MED) + ping = NETgetGameFlagsUnjoined(i, 2); + if (ping >= PING_LO && ping < PING_MED) { iV_DrawImage(FrontImages,IMAGE_LAMP_GREEN,x+70,y+26); } - else if(png >= PING_MED && png < PING_HI) + else if (ping >= PING_MED && ping < PING_HI) { iV_DrawImage(FrontImages,IMAGE_LAMP_AMBER,x+70,y+26); - }else + } + else { iV_DrawImage(FrontImages,IMAGE_LAMP_RED,x+70,y+26); } diff --git a/src/scriptobj.c b/src/scriptobj.c index 9abdd80b7..a253f4a23 100644 --- a/src/scriptobj.c +++ b/src/scriptobj.c @@ -48,6 +48,9 @@ #include "scriptvals.h" #include "research.h" +// Marks a NULL pointer for the script value save/load routines +static const int UNALLOCATED_OBJECT = -1; + static INTERP_VAL scrFunctionResult; //function return value to be pushed to stack // Get values from a base object @@ -761,9 +764,6 @@ BOOL scrValDefSave(INTERP_VAL *psVal, char *pBuffer, UDWORD *pSize) RESEARCH *psResearch; char *pPos; DROID *psCDroid; - SDWORD members; - BOOL bObjectDefined; - DROID_GROUP *psGroup; #ifdef _DEBUG BASE_OBJECT *psObj; #endif @@ -908,16 +908,9 @@ BOOL scrValDefSave(INTERP_VAL *psVal, char *pBuffer, UDWORD *pSize) } break; case ST_GROUP: - bObjectDefined = (psVal->v.oval != NULL); - - if (bObjectDefined) - { - members = grpNumMembers((DROID_GROUP *)psVal->v.oval); - } - else - { - members = UNALLOCATED_OBJECT; - } + { + DROID_GROUP* const psGroup = (DROID_GROUP *)psVal->v.oval; + const int members = psGroup ? grpNumMembers(psGroup) : UNALLOCATED_OBJECT; if (pBuffer) { @@ -927,10 +920,8 @@ BOOL scrValDefSave(INTERP_VAL *psVal, char *pBuffer, UDWORD *pSize) endian_sdword((SDWORD*)pPos); pPos += sizeof(SDWORD); - if(bObjectDefined) + if (psGroup) { - psGroup = (DROID_GROUP *)psVal->v.oval; - // store the run data *((SDWORD *)pPos) = psGroup->sRunData.sPos.x; endian_sdword((SDWORD*)pPos); @@ -949,7 +940,7 @@ BOOL scrValDefSave(INTERP_VAL *psVal, char *pBuffer, UDWORD *pSize) pPos += sizeof(SDWORD); // now store the droids - for(psCDroid=((DROID_GROUP *)psVal->v.oval)->psList; psCDroid; psCDroid=psCDroid->psGrpNext) + for (psCDroid = psGroup->psList; psCDroid; psCDroid = psCDroid->psGrpNext) { checkValidId(psCDroid->id); @@ -961,7 +952,7 @@ BOOL scrValDefSave(INTERP_VAL *psVal, char *pBuffer, UDWORD *pSize) } } - if(!bObjectDefined) + if (!psGroup) { *pSize = sizeof(SDWORD); } @@ -970,6 +961,7 @@ BOOL scrValDefSave(INTERP_VAL *psVal, char *pBuffer, UDWORD *pSize) *pSize = sizeof(SDWORD) + sizeof(UDWORD) * members + sizeof(SDWORD) * 5; // members + runData } break; + } case ST_SOUND: if(psVal->v.ival) { diff --git a/src/scriptobj.h b/src/scriptobj.h index 41b06253a..d2dc1dc5c 100644 --- a/src/scriptobj.h +++ b/src/scriptobj.h @@ -60,9 +60,6 @@ enum _objids OBJID_ORIG_HITPOINTS, // original health of a droid (when not damaged) }; -// marks a nullpointer for the save-game loading routine -#define UNALLOCATED_OBJECT (-1) - // id's for group variables enum _groupids {