- Use UserData instead of pUserData to store non-pointer data in GUI system.

- Replace several occurances of (void*)0 with NULL.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2762 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2007-11-09 20:07:12 +00:00
parent 364a32d1de
commit cd586193d3
7 changed files with 23 additions and 35 deletions

View File

@ -1184,7 +1184,6 @@ void addTextButton(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt,BOOL bA
sButInit.width = (short)(iV_GetTextWidth(txt)+10);//FRONTEND_BUTWIDTH;
sButInit.x+=35;
}
else
{
@ -1192,8 +1191,7 @@ void addTextButton(UDWORD id, UDWORD PosX, UDWORD PosY, const char *txt,BOOL bA
sButInit.width = FRONTEND_BUTWIDTH;
}
sButInit.pUserData = (void*)bGrey; // store disable state
sButInit.UserData = bGrey; // store disable state
sButInit.height = FRONTEND_BUTHEIGHT;
sButInit.pDisplay = displayTextOption;
@ -1305,7 +1303,7 @@ void displayTextOption(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, UDWORD
SDWORD fx,fy, fw;
W_BUTTON *psBut;
BOOL hilight = FALSE;
BOOL greyOut = (BOOL) psWidget->pUserData; // if option is unavailable.
BOOL greyOut = psWidget->UserData; // if option is unavailable.
psBut = (W_BUTTON *)psWidget;
iV_SetFont(psBut->FontID);

View File

@ -4958,7 +4958,7 @@ void intRemoveObject(void)
if(Form) {
Form->display = intClosePlainForm;
Form->disableChildren = TRUE;
Form->pUserData = (void*)0; // Used to signal when the close anim has finished.
Form->pUserData = NULL; // Used to signal when the close anim has finished.
ClosingObject = TRUE;
}
@ -5017,7 +5017,7 @@ void intRemoveStats(void)
Form = (W_TABFORM*)widgGetFromID(psWScreen,IDSTAT_FORM);
if(Form) {
Form->display = intClosePlainForm;
Form->pUserData = (void*)0; // Used to signal when the close anim has finished.
Form->pUserData = NULL; // Used to signal when the close anim has finished.
Form->disableChildren = TRUE;
ClosingStats = TRUE;
}
@ -5843,7 +5843,7 @@ static BOOL intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
sLabInit.y = STAT_BUTHEIGHT - 19;
sLabInit.width = 12;
sLabInit.height = 15;
sLabInit.pUserData = (void*)(int)ii;
sLabInit.UserData = ii;
sLabInit.pTip = getPlayerName(ii);
sLabInit.pDisplay = intDisplayAllyIcon;
widgAddLabel(psWScreen, &sLabInit);
@ -6692,16 +6692,13 @@ void flashReticuleButton(UDWORD buttonID)
{
W_TABFORM *psButton;
UDWORD flash;
//get the button for the id
psButton = (W_TABFORM*)widgGetFromID(psWScreen,buttonID);
if (psButton)
{
//set flashing byte to true
flash = ((UBYTE)TRUE & 0xff) << 24;
psButton->pUserData = (void *)(flash | (UDWORD)psButton->pUserData);
psButton->UserData = (1 << 24) | psButton->UserData;
}
}
@ -6710,25 +6707,18 @@ void flashReticuleButton(UDWORD buttonID)
void stopReticuleButtonFlash(UDWORD buttonID)
{
WIDGET *psButton;
UBYTE DownTime;
UBYTE Index;
UBYTE flashing;
UBYTE flashTime;
psButton = widgGetFromID(psWScreen,buttonID);
WIDGET *psButton = widgGetFromID(psWScreen,buttonID);
if (psButton)
{
// clear flashing byte
DownTime = (UBYTE)UNPACKDWORD_QUAD_C((UDWORD)psButton->pUserData);
Index = (UBYTE)UNPACKDWORD_QUAD_D((UDWORD)psButton->pUserData);
flashing = (UBYTE)UNPACKDWORD_QUAD_A((UDWORD)psButton->pUserData);
flashTime = (UBYTE)UNPACKDWORD_QUAD_B((UDWORD)psButton->pUserData);
UBYTE DownTime = UNPACKDWORD_QUAD_C(psButton->UserData);
UBYTE Index = UNPACKDWORD_QUAD_D(psButton->UserData);
UBYTE flashing = UNPACKDWORD_QUAD_A(psButton->UserData);
UBYTE flashTime = UNPACKDWORD_QUAD_B(psButton->UserData);
flashing = (UBYTE)FALSE;
// clear flashing byte
flashing = FALSE;
flashTime = 0;
psButton->pUserData = (void*)(PACKDWORD_QUAD(flashTime,flashing,DownTime,Index));
//psButton->pUserData = (void *)(((UDWORD)psButton->pUserData) & 0x00ffffff);
psButton->UserData = PACKDWORD_QUAD(flashTime,flashing,DownTime,Index);
}
}

View File

@ -355,7 +355,7 @@ BOOL intCloseInGameOptions(BOOL bPutUpLoadSave, BOOL bResetMissionWidgets)
Form = (W_TABFORM*)widgGetFromID(psWScreen,INTINGAMEOP);
if(Form) {
Form->display = intClosePlainForm;
Form->pUserData = (void*)0; // Used to signal when the close anim has finished.
Form->pUserData = NULL; // Used to signal when the close anim has finished.
Form->disableChildren= TRUE;
ClosingInGameOp = TRUE; // like orderup/closingorder
InGameOpUp = FALSE;

View File

@ -1039,7 +1039,7 @@ void intRemoveIntelMap(void)
{
Form->display = intClosePlainForm;
Form->disableChildren = TRUE;
Form->pUserData = (void*)0; // Used to signal when the close anim has finished.
Form->pUserData = NULL; // Used to signal when the close anim has finished.
}
ClosingIntelMap = TRUE;
//remove the text label
@ -1093,7 +1093,7 @@ void intRemoveMessageView(BOOL animated)
// Start the window close animation.
Form->display = intClosePlainForm;
Form->disableChildren = TRUE;
Form->pUserData = (void*)0; // Used to signal when the close anim has finished.
Form->pUserData = NULL; // Used to signal when the close anim has finished.
ClosingMessageView = TRUE;
}
else

View File

@ -1122,7 +1122,7 @@ void intRemoveOrder(void)
Form = (W_TABFORM*)widgGetFromID(psWScreen,IDORDER_FORM);
if(Form) {
Form->display = intClosePlainForm;
Form->pUserData = (void*)0; // Used to signal when the close anim has finished.
Form->pUserData = NULL; // Used to signal when the close anim has finished.
Form->disableChildren = TRUE;
ClosingOrder = TRUE;
OrderUp = FALSE;

View File

@ -462,7 +462,7 @@ void addMultiRequest(const char* searchDir, const char* fileExtension, UDWORD mo
sButInit.y = 4;
sButInit.width = R_BUT_W;
sButInit.height = R_BUT_H;
sButInit.pUserData = (void*)0;
sButInit.pUserData = NULL;
sButInit.pDisplay = displayRequestOption;
sButInit.FontID = font_regular;
@ -1322,7 +1322,7 @@ BOOL intCloseMultiMenu(void)
Form = (W_TABFORM*)widgGetFromID(psWScreen,MULTIMENU_FORM);
if(Form) {
Form->display = intClosePlainForm;
Form->pUserData = (void*)0; // Used to signal when the close anim has finished.
Form->pUserData = NULL; // Used to signal when the close anim has finished.
Form->disableChildren = TRUE;
ClosingMultiMenu = TRUE;
MultiMenuUp = FALSE;

View File

@ -1367,7 +1367,7 @@ void intRemoveTrans(void)
Form = (W_TABFORM*)widgGetFromID(psWScreen,IDTRANS_FORM);
Form->display = intClosePlainForm;
Form->disableChildren = TRUE;
Form->pUserData = (void*)0; // Used to signal when the close anim has finished.
Form->pUserData = NULL; // Used to signal when the close anim has finished.
ClosingTrans = TRUE;
intRemoveTransContent();
@ -1398,7 +1398,7 @@ void intRemoveTransContent(void)
{
Form->display = intClosePlainForm;
Form->disableChildren = TRUE;
Form->pUserData = (void*)0; // Used to signal when the close anim has finished.
Form->pUserData = NULL; // Used to signal when the close anim has finished.
ClosingTransCont = TRUE;
}
@ -1423,7 +1423,7 @@ void intRemoveTransDroidsAvail(void)
{
Form->display = intClosePlainForm;
Form->disableChildren = TRUE;
Form->pUserData = (void*)0; // Used to signal when the close anim has finished.
Form->pUserData = NULL; // Used to signal when the close anim has finished.
ClosingTransDroids = TRUE;
//remember which tab we were on
widgGetTabs(psWScreen, IDTRANS_DROIDTAB, &objMajor, &objMinor);