Fix a few strict-aliasing warnings and 2 types NETenum warnings (in multibot)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3993 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
f0ab52dbd3
commit
cd14124c47
20
src/droid.c
20
src/droid.c
|
@ -4513,14 +4513,14 @@ building the specified structure - returns TRUE if finds one*/
|
|||
BOOL checkDroidsBuilding(STRUCTURE *psStructure)
|
||||
{
|
||||
DROID *psDroid;
|
||||
STRUCTURE *psStruct = NULL;
|
||||
|
||||
for (psDroid = apsDroidLists[psStructure->player]; psDroid != NULL; psDroid =
|
||||
psDroid->psNext)
|
||||
{
|
||||
BASE_OBJECT *psStruct = NULL;
|
||||
//check DORDER_BUILD, HELP_BUILD is handled the same
|
||||
orderStateObj(psDroid, DORDER_BUILD, (BASE_OBJECT **) &psStruct);
|
||||
if (psStruct == psStructure)
|
||||
orderStateObj(psDroid, DORDER_BUILD, &psStruct);
|
||||
if ((STRUCTURE*)psStruct == psStructure)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -4533,14 +4533,14 @@ demolishing the specified structure - returns TRUE if finds one*/
|
|||
BOOL checkDroidsDemolishing(STRUCTURE *psStructure)
|
||||
{
|
||||
DROID *psDroid;
|
||||
STRUCTURE *psStruct = NULL;
|
||||
|
||||
for (psDroid = apsDroidLists[psStructure->player]; psDroid != NULL; psDroid =
|
||||
psDroid->psNext)
|
||||
{
|
||||
BASE_OBJECT *psStruct = NULL;
|
||||
//check DORDER_DEMOLISH
|
||||
orderStateObj(psDroid, DORDER_DEMOLISH, (BASE_OBJECT **) &psStruct);
|
||||
if (psStruct == psStructure)
|
||||
orderStateObj(psDroid, DORDER_DEMOLISH, &psStruct);
|
||||
if ((STRUCTURE*)psStruct == psStructure)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -4897,7 +4897,7 @@ BOOL vtolEmpty(DROID *psDroid)
|
|||
// true if a vtol is waiting to be rearmed by a particular rearm pad
|
||||
BOOL vtolReadyToRearm(DROID *psDroid, STRUCTURE *psStruct)
|
||||
{
|
||||
STRUCTURE *psRearmPad;
|
||||
BASE_OBJECT *psRearmPad;
|
||||
|
||||
CHECK_DROID(psDroid);
|
||||
|
||||
|
@ -4908,10 +4908,10 @@ BOOL vtolReadyToRearm(DROID *psDroid, STRUCTURE *psStruct)
|
|||
}
|
||||
|
||||
// If a unit has been ordered to rearm make sure it goes to the correct base
|
||||
if (orderStateObj(psDroid, DORDER_REARM, (BASE_OBJECT **)&psRearmPad))
|
||||
if (orderStateObj(psDroid, DORDER_REARM, &psRearmPad))
|
||||
{
|
||||
if ((psRearmPad != psStruct) &&
|
||||
!vtolOnRearmPad(psRearmPad, psDroid))
|
||||
if (((STRUCTURE*)psRearmPad != psStruct) &&
|
||||
!vtolOnRearmPad((STRUCTURE*)psRearmPad, psDroid))
|
||||
{
|
||||
// target rearm pad is clear - let it go there
|
||||
return FALSE;
|
||||
|
|
34
src/hci.c
34
src/hci.c
|
@ -6064,35 +6064,39 @@ static BOOL selectConstruction(BASE_OBJECT *psObj)
|
|||
/* Return the stats for a construction droid */
|
||||
static BASE_STATS *getConstructionStats(BASE_OBJECT *psObj)
|
||||
{
|
||||
DROID *psDroid;
|
||||
DROID *psDroid = (DROID *)psObj;
|
||||
BASE_STATS *Stats;
|
||||
STRUCTURE *Structure;
|
||||
UDWORD x,y;
|
||||
BASE_OBJECT *Structure;
|
||||
UDWORD x, y;
|
||||
|
||||
ASSERT( psObj != NULL && psObj->type == OBJ_DROID,
|
||||
"getConstructionStats: invalid droid pointer" );
|
||||
psDroid = (DROID *)psObj;
|
||||
|
||||
//if(droidType(psDroid) != DROID_CONSTRUCT) return NULL;
|
||||
if (!(droidType(psDroid) == DROID_CONSTRUCT || droidType(psDroid) ==
|
||||
DROID_CYBORG_CONSTRUCT))
|
||||
if (!(droidType(psDroid) == DROID_CONSTRUCT ||
|
||||
droidType(psDroid) == DROID_CYBORG_CONSTRUCT))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(orderStateStatsLoc(psDroid, DORDER_BUILD,&Stats,&x,&y)) { // Moving to build location?
|
||||
if(orderStateStatsLoc(psDroid, DORDER_BUILD, &Stats, &x, &y)) // Moving to build location?
|
||||
{
|
||||
return Stats;
|
||||
} else if( orderStateObj(psDroid, DORDER_BUILD,(BASE_OBJECT**)&Structure) &&
|
||||
psDroid->order == DORDER_BUILD ) { // Is building
|
||||
}
|
||||
else if( orderStateObj(psDroid, DORDER_BUILD, &Structure) &&
|
||||
psDroid->order == DORDER_BUILD ) // Is building
|
||||
{
|
||||
return psDroid->psTarStats;
|
||||
} else if( orderStateObj(psDroid, DORDER_HELPBUILD,(BASE_OBJECT**)&Structure) &&
|
||||
(psDroid->order == DORDER_HELPBUILD || psDroid->order == DORDER_LINEBUILD)) { //Is helping
|
||||
return (BASE_STATS*)Structure->pStructureType;
|
||||
} else if (orderState(psDroid, DORDER_DEMOLISH)) {
|
||||
}
|
||||
else if( orderStateObj(psDroid, DORDER_HELPBUILD, &Structure) &&
|
||||
(psDroid->order == DORDER_HELPBUILD || psDroid->order == DORDER_LINEBUILD)) // Is helping
|
||||
{
|
||||
return (BASE_STATS*)((STRUCTURE*)Structure)->pStructureType;
|
||||
}
|
||||
else if (orderState(psDroid, DORDER_DEMOLISH))
|
||||
{
|
||||
return (BASE_STATS *)structGetDemolishStat();
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -800,6 +800,7 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PI
|
|||
case REF_RESEARCH:
|
||||
if (StructureIsResearching(Structure))
|
||||
{
|
||||
iIMDShape * shape = Object;
|
||||
Stats = (BASE_STATS*)Buffer->Data2;
|
||||
if (!Stats)
|
||||
{
|
||||
|
@ -809,7 +810,8 @@ void intDisplayStatusButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PI
|
|||
{
|
||||
bOnHold = TRUE;
|
||||
}
|
||||
StatGetResearchImage(Stats,&Image,(iIMDShape**)&Object, &psResGraphic, FALSE);
|
||||
StatGetResearchImage(Stats,&Image,&shape, &psResGraphic, FALSE);
|
||||
Object = shape;
|
||||
if (psResGraphic)
|
||||
{
|
||||
// we have a Stat associated with this research topic
|
||||
|
@ -1052,6 +1054,7 @@ void intDisplayStatsButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIE
|
|||
}
|
||||
else if(StatIsResearch(Stat))
|
||||
{
|
||||
iIMDShape * shape = Object;
|
||||
/*IMDType = IMDTYPE_RESEARCH;
|
||||
StatGetResearchImage(Stat,&Image,(iIMDShape**)&Object,TRUE);
|
||||
//if Object != NULL the there must be a IMD so set the object to
|
||||
|
@ -1060,7 +1063,8 @@ void intDisplayStatsButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIE
|
|||
{
|
||||
Object = (void*)Stat;
|
||||
}*/
|
||||
StatGetResearchImage(Stat,&Image,(iIMDShape**)&Object, &psResGraphic, TRUE);
|
||||
StatGetResearchImage(Stat,&Image,&shape, &psResGraphic, TRUE);
|
||||
Object = shape;
|
||||
if (psResGraphic)
|
||||
{
|
||||
//we have a Stat associated with this research topic
|
||||
|
@ -2500,22 +2504,22 @@ void CreateBlankButton(RENDERED_BUTTON *Buffer,BOOL Down, UDWORD buttonType)
|
|||
BOOL DroidIsDemolishing(DROID *Droid)
|
||||
{
|
||||
BASE_STATS *Stats;
|
||||
STRUCTURE *Structure;
|
||||
BASE_OBJECT *Structure;
|
||||
UDWORD x,y;
|
||||
|
||||
//if(droidType(Droid) != DROID_CONSTRUCT) return FALSE;
|
||||
if (!(droidType(Droid) == DROID_CONSTRUCT || droidType(Droid) ==
|
||||
DROID_CYBORG_CONSTRUCT))
|
||||
if (!(droidType(Droid) == DROID_CONSTRUCT ||
|
||||
droidType(Droid) == DROID_CYBORG_CONSTRUCT))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(orderStateStatsLoc(Droid, DORDER_DEMOLISH,&Stats,&x,&y)) { // Moving to demolish location?
|
||||
|
||||
if(orderStateStatsLoc(Droid, DORDER_DEMOLISH,&Stats,&x,&y)) // Moving to demolish location?
|
||||
{
|
||||
return TRUE;
|
||||
|
||||
} else if( orderStateObj(Droid, DORDER_DEMOLISH,(BASE_OBJECT**)&Structure) ) { // Is demolishing?
|
||||
|
||||
}
|
||||
else if( orderStateObj(Droid, DORDER_DEMOLISH,&Structure) ) // Is demolishing?
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2547,7 +2551,7 @@ BOOL DroidIsRepairing(DROID *Droid)
|
|||
BOOL DroidIsBuilding(DROID *Droid)
|
||||
{
|
||||
BASE_STATS *Stats;
|
||||
STRUCTURE *Structure;
|
||||
BASE_OBJECT *Structure;
|
||||
UDWORD x,y;
|
||||
|
||||
//if(droidType(Droid) != DROID_CONSTRUCT) return FALSE;
|
||||
|
@ -2561,9 +2565,9 @@ BOOL DroidIsBuilding(DROID *Droid)
|
|||
{
|
||||
// Moving to build location?
|
||||
return FALSE;
|
||||
|
||||
} else if (orderStateObj(Droid, DORDER_BUILD,(BASE_OBJECT**)&Structure) || // Is building or helping?
|
||||
orderStateObj(Droid, DORDER_HELPBUILD,(BASE_OBJECT**)&Structure))
|
||||
}
|
||||
else if (orderStateObj(Droid, DORDER_BUILD,&Structure) ||
|
||||
orderStateObj(Droid, DORDER_HELPBUILD,&Structure)) // Is building or helping?
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2598,13 +2602,13 @@ BOOL DroidGoingToBuild(DROID *Droid)
|
|||
//
|
||||
STRUCTURE *DroidGetBuildStructure(DROID *Droid)
|
||||
{
|
||||
STRUCTURE *Structure;
|
||||
BASE_OBJECT *Structure;
|
||||
|
||||
if(!orderStateObj(Droid, DORDER_BUILD,(BASE_OBJECT**)&Structure)) {
|
||||
orderStateObj(Droid, DORDER_HELPBUILD,(BASE_OBJECT**)&Structure);
|
||||
if(!orderStateObj(Droid, DORDER_BUILD,&Structure)) {
|
||||
orderStateObj(Droid, DORDER_HELPBUILD,&Structure);
|
||||
}
|
||||
|
||||
return Structure;
|
||||
return (STRUCTURE*)Structure;
|
||||
}
|
||||
|
||||
// Get the first factory assigned to a command droid
|
||||
|
|
|
@ -147,8 +147,8 @@ BOOL sendDroidSecondary(const DROID* psDroid, SECONDARY_ORDER sec, SECONDARY_STA
|
|||
BOOL recvDroidSecondary()
|
||||
{
|
||||
DROID* psDroid;
|
||||
SECONDARY_ORDER sec;
|
||||
SECONDARY_STATE state;
|
||||
SECONDARY_ORDER sec = DSO_ATTACK_RANGE;
|
||||
SECONDARY_STATE state = DSS_NONE;
|
||||
|
||||
NETbeginDecode(NET_SECONDARY);
|
||||
{
|
||||
|
@ -650,11 +650,11 @@ BOOL SendGroupOrderGroup(const DROID_GROUP* psGroup, DROID_ORDER order, uint32_t
|
|||
// receive a group order.
|
||||
BOOL recvGroupOrder()
|
||||
{
|
||||
DROID_ORDER order;
|
||||
DROID_ORDER order = DORDER_NONE;
|
||||
BOOL subType, cmdOrder;
|
||||
|
||||
uint32_t destId, x, y;
|
||||
OBJECT_TYPE destType;
|
||||
OBJECT_TYPE destType = OBJ_DROID; // Dummy initialisation to workaround NETenum macro
|
||||
|
||||
uint8_t droidCount, i;
|
||||
uint32_t* droidIDs;
|
||||
|
@ -792,7 +792,7 @@ BOOL recvDroidInfo()
|
|||
{
|
||||
uint32_t droidId;
|
||||
DROID* psDroid;
|
||||
DROID_ORDER order;
|
||||
DROID_ORDER order = DORDER_NONE;
|
||||
BOOL subType;
|
||||
|
||||
// Get the droid
|
||||
|
@ -811,7 +811,7 @@ BOOL recvDroidInfo()
|
|||
|
||||
if (subType)
|
||||
{
|
||||
uint32_t destId, destType;
|
||||
uint32_t destId, destType = 0;
|
||||
|
||||
NETuint32_t(&destId);
|
||||
NETenum(&destType);
|
||||
|
|
Loading…
Reference in New Issue