Cleanup:
* Mark several parameters that aren't being used (but shouldn't be removed) with WZ_DECL_UNUSED * Use "(unsigned )?int" instead of "[SU](D?WORD|BYTE)" where the size guarantee is not required * Instead of "(X - Y) >= 0" use the logically equivalent and more readable "X >= Y" * Remove redundant function prototypes * Move variables into a more local scope where possible * Assign the result of an expression to a variable once so that the expression doesn't have to be duplicated several times * Move constant UNALLOCATED_OBJECT out of the header and into the only source file where it's ever used git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6160 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
8312b90c8a
commit
71ddbdc5e4
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,7 +2077,7 @@ static void processMultiopWidgets(UDWORD id)
|
|||
if((id >= MULTIOP_TEAMCHOOSER) && (id <= MULTIOP_TEAMCHOOSER_END))
|
||||
{
|
||||
ASSERT(teamChooserUp() >= 0, "processMultiopWidgets: teamChooserUp() < 0");
|
||||
ASSERT((id - MULTIOP_TEAMCHOOSER) >= 0
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue