widget: Remove write-only RENDERED_BUTTON::Initialised and RENDERED_BUTTON::State, and related dead code.

master
Cyp 2013-03-12 09:54:53 +01:00
parent 1240e7c96c
commit 2521e71729
6 changed files with 7 additions and 130 deletions

View File

@ -800,7 +800,6 @@ static bool _intAddTemplateForm(DROID_TEMPLATE *psSelected)
/* Add the design templates form */
IntListTabWidget *templList = new IntListTabWidget(templbaseForm);
templList->id = IDDES_TEMPLFORM;
templList->setChildSize(DES_TABBUTWIDTH, DES_TABBUTHEIGHT);
templList->setChildSpacing(DES_TABBUTGAP, DES_TABBUTGAP);
int templListWidth = OBJ_BUTWIDTH*2 + DES_TABBUTGAP;
@ -2983,7 +2982,6 @@ void intRemoveDesign(void)
widgDelete(psWScreen, IDDES_POWERFORM);
widgDelete(psWScreen, IDDES_NAMEBOX);
widgDelete(psWScreen, IDDES_TEMPLFORM);
widgDelete(psWScreen, IDDES_TEMPLBASE);
widgDelete(psWScreen, IDDES_RIGHTBASE);
@ -3594,7 +3592,6 @@ void intProcessDesign(UDWORD id)
desSetupDesignTemplates();
/* Now update the droid template form */
widgDelete(psWScreen, IDDES_TEMPLFORM);
widgDelete(psWScreen, IDDES_TEMPLBASE);
intAddTemplateForm(psTempl);
@ -4062,7 +4059,6 @@ static bool saveTemplate(void)
sstrcpy(psTempl->aName, aCurrName);
/* Now update the droid template form */
widgDelete(psWScreen, IDDES_TEMPLFORM);
widgDelete(psWScreen, IDDES_TEMPLBASE);
intAddTemplateForm(psTempl);

View File

@ -27,7 +27,6 @@
/* Design screen ID's */
#define IDDES_FORM 5000 // The base form for the design screen
#define IDDES_STATSFORM 5001 // The design screen stats form
#define IDDES_TEMPLFORM 5002 // The tabbed form of design templates
#define IDDES_SYSTEMFORM 5006 // The clickable form for the weapon/ecm/sensor
#define IDDES_BODYFORM 5007 // The clickable form for the body
#define IDDES_PROPFORM 5008 // The clickable form for the propulsion

View File

@ -1270,20 +1270,6 @@ INT_RETVAL intRunWidgets(void)
quitting = true;
break;
// Process form tab clicks.
case IDOBJ_TABFORM: // If tab clicked on in object screen then refresh all rendered buttons.
RefreshObjectButtons();
RefreshTopicButtons();
break;
case IDSTAT_TABFORM: // If tab clicked on in stats screen then refresh all rendered buttons.
RefreshStatsButtons();
break;
case IDDES_TEMPLFORM: // If tab clicked on in design template screen then refresh all rendered buttons.
RefreshStatsButtons();
break;
/* Default case passes remaining IDs to appropriate function */
default:
switch (intMode)

View File

@ -669,8 +669,6 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
Buffer->ImdRotation += realTimeAdjustedAverage(BUTTONOBJ_ROTSPEED);
}
Buffer->State = Form->state;
Object = NULL;
Image = -1;
psObj = (BASE_OBJECT *)Buffer->Data; // Get the object associated with this widget.
@ -698,7 +696,6 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
{
Object = Structure;
IMDType = IMDTYPE_STRUCTURE;
RENDERBUTTON_INITIALISED(Buffer);
}
}
else if (DroidGoingToBuild(Droid))
@ -708,7 +705,6 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
Object = (void *)Stats;
Player = selectedPlayer;
IMDType = IMDTYPE_STRUCTURESTAT;
RENDERBUTTON_INITIALISED(Buffer);
}
else if (orderState(Droid, DORDER_DEMOLISH))
{
@ -717,7 +713,6 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
Object = (void *)Stats;
Player = selectedPlayer;
IMDType = IMDTYPE_STRUCTURESTAT;
RENDERBUTTON_INITIALISED(Buffer);
}
else if (Droid->droidType == DROID_COMMAND)
{
@ -726,7 +721,6 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
{
Object = Structure;
IMDType = IMDTYPE_STRUCTURE;
RENDERBUTTON_INITIALISED(Buffer);
}
}
break;
@ -742,7 +736,6 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
{
IMDType = IMDTYPE_DROIDTEMPLATE;
Object = (void *)FactoryGetTemplate(StructureGetFactory(Structure));
RENDERBUTTON_INITIALISED(Buffer);
bOnHold = StructureIsOnHoldPending(Structure);
}
@ -800,7 +793,6 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
IMDType = IMDTYPE_RESEARCH;
}
}
RENDERBUTTON_INITIALISED(Buffer);
}
break;
default:
@ -812,10 +804,6 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
ASSERT(false, "Invalid structure type");
}
}
else
{
RENDERBUTTON_INITIALISED(Buffer);
}
// Render the object into the button.
if (Object)
@ -880,8 +868,6 @@ void intDisplayObjectButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
Buffer->ImdRotation += realTimeAdjustedAverage(BUTTONOBJ_ROTSPEED);
}
Buffer->State = Form->state;
Object = NULL;
psObj = (BASE_OBJECT *)Buffer->Data; // Get the object associated with this widget.
@ -920,8 +906,6 @@ void intDisplayObjectButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
RenderBlankToButton(Buffer, Down, BTMBUTTON);
}
RENDERBUTTON_INITIALISED(Buffer);
if (Hilight)
{
@ -952,8 +936,6 @@ void intDisplayStatsButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
Buffer->ImdRotation += realTimeAdjustedAverage(BUTTONOBJ_ROTSPEED);
}
Buffer->State = Form->state;
Object = NULL;
Image = -1;
@ -1076,11 +1058,8 @@ void intDisplayStatsButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
RenderBlankToButton(Buffer, Down, TOPBUTTON);
}
RENDERBUTTON_INITIALISED(Buffer);
if (Hilight)
{
iV_DrawImage(IntImages, IMAGE_BUT_HILITE, xOffset + Form->x(), yOffset + Form->y());
}
}
@ -1584,47 +1563,6 @@ void intInitialiseGraphics(void)
imageInitBitmaps();
}
void RefreshObjectButtons(void)
{
UDWORD i;
for (i = 0; i < NUM_OBJECTBUFFERS; i++)
{
RENDERBUTTON_NOTINITIALISED(&ObjectBuffers[i]);
}
}
void RefreshSystem0Buttons(void)
{
UDWORD i;
for (i = 0; i < NUM_SYSTEM0BUFFERS; i++)
{
RENDERBUTTON_NOTINITIALISED(&System0Buffers[i]);
}
}
void RefreshTopicButtons(void)
{
UDWORD i;
for (i = 0; i < NUM_TOPICBUFFERS; i++)
{
RENDERBUTTON_NOTINITIALISED(&TopicBuffers[i]);
}
}
void RefreshStatsButtons(void)
{
UDWORD i;
for (i = 0; i < NUM_STATBUFFERS; i++)
{
RENDERBUTTON_NOTINITIALISED(&StatBuffers[i]);
}
}
void ClearObjectBuffers(void)
{
UDWORD i;
@ -1647,8 +1585,7 @@ void ClearTopicBuffers(void)
void ClearObjectButtonBuffer(SDWORD BufferID)
{
RENDERBUTTON_NOTINITIALISED(&ObjectBuffers[BufferID]); // what have I done
RENDERBUTTON_NOTINUSE(&ObjectBuffers[BufferID]);
ObjectBuffers[BufferID].InUse = false;
ObjectBuffers[BufferID].Data = NULL;
ObjectBuffers[BufferID].Data2 = NULL;
ObjectBuffers[BufferID].ImdRotation = DEFAULT_BUTTON_ROTATION;
@ -1656,8 +1593,7 @@ void ClearObjectButtonBuffer(SDWORD BufferID)
void ClearTopicButtonBuffer(SDWORD BufferID)
{
RENDERBUTTON_NOTINITIALISED(&TopicBuffers[BufferID]); // what have I done
RENDERBUTTON_NOTINUSE(&TopicBuffers[BufferID]);
TopicBuffers[BufferID].InUse = false;
TopicBuffers[BufferID].Data = NULL;
TopicBuffers[BufferID].Data2 = NULL;
TopicBuffers[BufferID].ImdRotation = DEFAULT_BUTTON_ROTATION;
@ -1669,7 +1605,7 @@ SDWORD GetObjectBuffer(void)
for (i = 0; i < NUM_OBJECTBUFFERS; i++)
{
if (IsBufferInUse(&ObjectBuffers[i]) == false)
if (!ObjectBuffers[i].InUse)
{
return i;
}
@ -1684,8 +1620,7 @@ void ClearStatBuffers(void)
for (i = 0; i < NUM_STATBUFFERS; i++)
{
RENDERBUTTON_NOTINITIALISED(&StatBuffers[i]); // what have I done
RENDERBUTTON_NOTINUSE(&StatBuffers[i]);
StatBuffers[i].InUse = false;
StatBuffers[i].Data = NULL;
StatBuffers[i].ImdRotation = DEFAULT_BUTTON_ROTATION;
}
@ -1697,7 +1632,7 @@ SDWORD GetStatBuffer(void)
for (i = 0; i < NUM_STATBUFFERS; i++)
{
if (IsBufferInUse(&StatBuffers[i]) == false)
if (!StatBuffers[i].InUse)
{
return i;
}
@ -1720,8 +1655,7 @@ void ClearSystem0Buffers(void)
void ClearSystem0ButtonBuffer(SDWORD BufferID)
{
RENDERBUTTON_NOTINITIALISED(&System0Buffers[BufferID]); // what have I done
RENDERBUTTON_NOTINUSE(&System0Buffers[BufferID]);
System0Buffers[BufferID].InUse = false;
System0Buffers[BufferID].Data = NULL;
System0Buffers[BufferID].Data2 = NULL;
System0Buffers[BufferID].ImdRotation = DEFAULT_BUTTON_ROTATION;
@ -1733,7 +1667,7 @@ SDWORD GetSystem0Buffer(void)
for (i = 0; i < NUM_SYSTEM0BUFFERS; i++)
{
if (IsBufferInUse(&System0Buffers[i]) == false)
if (!System0Buffers[i].InUse)
{
return i;
}
@ -2641,8 +2575,6 @@ void intDisplayTransportButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
Buffer->ImdRotation += realTimeAdjustedAverage(BUTTONOBJ_ROTSPEED);
}
Buffer->State = Form->state;
if (psDroid)
{
RenderToButton(NULL, 0, psDroid, psDroid->player, Buffer, Down, IMDTYPE_DROID, TOPBUTTON);
@ -2651,7 +2583,6 @@ void intDisplayTransportButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
{
RenderBlankToButton(Buffer, Down, TOPBUTTON);
}
RENDERBUTTON_INITIALISED(Buffer);
if (Hilight)
{

View File

@ -61,19 +61,11 @@ enum {
};
#define RENDERBUTTON_INUSE(x) ((x)->InUse=true)
#define RENDERBUTTON_NOTINUSE(x) ((x)->InUse=false)
#define RENDERBUTTON_INITIALISED(x) ((x)->Initialised=true)
#define RENDERBUTTON_NOTINITIALISED(x) ((x)->Initialised=false)
#define IsBufferInUse(x) ((x)->InUse)
struct RENDERED_BUTTON
{
bool InUse; // Is it in use.
bool Initialised; // Is it initialised.
SDWORD ImdRotation; // Rotation if button is an IMD.
UDWORD State; // Copy of widget's state so we know if state has changed.
void *Data; // Any data we want to attach.
void *Data2; // Any data we want to attach.
};
@ -106,12 +98,6 @@ void ClearObjectButtonBuffer(SDWORD BufferID);
// Clear ( make unused ) a RENDERED_BUTTON structure.
void ClearTopicButtonBuffer(SDWORD BufferID);
void RefreshObjectButtons(void);
void RefreshSystem0Buttons(void);
void RefreshTopicButtons(void);
void RefreshStatsButtons(void);
// Get a free RENDERED_BUTTON structure for a stat window button.
SDWORD GetStatBuffer(void);

View File

@ -58,9 +58,7 @@
#include "qtscript.h"
//#define IDTRANS_FORM 9000 //The Transporter base form
#define IDTRANS_TABFORM 9001 //The Transporter tabbed form
#define IDTRANS_CLOSE 9002 //The close button icon
#define IDTRANS_CONTABFORM 9004 //The Transporter Contents tabbed form
#define IDTRANS_CONTCLOSE 9005 //The close icon on the Contents form
#define IDTRANS_DROIDTAB 9007 //The Droid tab form
#define IDTRANS_DROIDCLOSE 9008 //The close icon for the Droid form
@ -427,7 +425,6 @@ bool intAddTransButtonForm(void)
/* Add the button form */
IntListTabWidget *transList = new IntListTabWidget(transForm);
transList->id = IDTRANS_TABFORM;
transList->setChildSize(OBJ_BUTWIDTH, OBJ_BUTHEIGHT*2);
transList->setChildSpacing(OBJ_GAP, OBJ_GAP);
int objListWidth = OBJ_BUTWIDTH*5 + OBJ_GAP*4;
@ -509,7 +506,6 @@ bool intAddTransContentsForm(void)
/* Add the contents form */
IntListTabWidget *contList = new IntListTabWidget(contForm);
contList->id = IDTRANS_CONTABFORM;
contList->setChildSize(OBJ_BUTWIDTH, OBJ_BUTHEIGHT);
contList->setChildSpacing(OBJ_GAP, OBJ_GAP);
int contListWidth = OBJ_BUTWIDTH*2 + OBJ_GAP;
@ -805,23 +801,6 @@ static void _intProcessTransporter(UDWORD id)
is called by intTransporterAddDroid()*/
}
}
// Process form tab clicks.
else if (id == IDTRANS_TABFORM)
{
//If tab clicked on Transporter screen then refresh rendered buttons.
RefreshObjectButtons();
RefreshTopicButtons();
}
else if (id == IDTRANS_CONTABFORM)
{
//If tab clicked on Transporter Contents screen then refresh rendered buttons.
RefreshStatsButtons();
}
else if (id == IDTRANS_DROIDTAB)
{
//If tab clicked on Droids Available screen then refresh rendered buttons.
RefreshSystem0Buttons();
}
}
/* Remove the Transporter widgets from the screen */