Make the droidOrder*() functions take a ModeQueue/ModeImmediate parameter.

Removes the need for turnOffMultiMsg() in some places.
Should reduce the number of messages sent over the network a bit.
Also removes two unused functions in src/transporter.[ch].
master
Cyp 2010-10-24 17:12:43 +02:00
parent 40ffee51fc
commit 6f1fbbde33
22 changed files with 132 additions and 250 deletions

View File

@ -991,7 +991,7 @@ void actionUpdateDroid(DROID *psDroid)
psDroid->pos.y = droidY;
//fly Transporter back to get some more droids
orderDroidLoc( psDroid, DORDER_TRANSPORTIN,
getLandingX(selectedPlayer), getLandingY(selectedPlayer));
getLandingX(selectedPlayer), getLandingY(selectedPlayer), ModeImmediate);
}
else
{
@ -1951,7 +1951,7 @@ void actionUpdateDroid(DROID *psDroid)
psDroid->action = DACTION_NONE;
if (psNextWreck)
{
orderDroidObj(psDroid, DORDER_CLEARWRECK, (BASE_OBJECT *)psNextWreck);
orderDroidObj(psDroid, DORDER_CLEARWRECK, (BASE_OBJECT *)psNextWreck, ModeImmediate);
}
}
else
@ -2273,7 +2273,7 @@ void actionUpdateDroid(DROID *psDroid)
//if the order is RTR then resubmit order so that the unit will go to repair facility point
if (orderState(psDroid,DORDER_RTR))
{
orderDroid(psDroid, DORDER_RTR);
orderDroid(psDroid, DORDER_RTR, ModeImmediate);
}
}
else
@ -2343,7 +2343,7 @@ void actionUpdateDroid(DROID *psDroid)
{
// totally bunged up - give up
objTrace(psDroid->id, "Couldn't find a clear tile near rearm pad - returning to base");
orderDroid(psDroid, DORDER_RTB);
orderDroid(psDroid, DORDER_RTB, ModeImmediate);
break;
}
moveDroidToDirect(psDroid, droidX,droidY);
@ -2526,7 +2526,7 @@ static void actionDroidBase(DROID *psDroid, DROID_ACTION_DATA *psAction)
if (!actionVTOLLandingPos(psDroid, &droidX, &droidY))
{
// totally bunged up - give up
orderDroid(psDroid, DORDER_RTB);
orderDroid(psDroid, DORDER_RTB, ModeImmediate);
break;
}
moveDroidToDirect(psDroid, droidX, droidY);
@ -2540,7 +2540,7 @@ static void actionDroidBase(DROID *psDroid, DROID_ACTION_DATA *psAction)
if (!actionVTOLLandingPos(psDroid, &droidX, &droidY))
{
// totally bunged up - give up
orderDroid(psDroid, DORDER_RTB);
orderDroid(psDroid, DORDER_RTB, ModeImmediate);
break;
}
moveDroidToDirect(psDroid, droidX, droidY);
@ -2826,7 +2826,7 @@ void moveToRearm(DROID *psDroid)
{
// no order set - use the rearm order to ensure the unit goes back
// to the landing pad
orderDroidObj(psDroid, DORDER_REARM, (BASE_OBJECT *)psStruct);
orderDroidObj(psDroid, DORDER_REARM, (BASE_OBJECT *)psStruct, ModeImmediate);
chosen=1;
}
else
@ -2838,7 +2838,7 @@ void moveToRearm(DROID *psDroid)
else
{
//return to base un-armed
orderDroid( psDroid, DORDER_RTB );
orderDroid(psDroid, DORDER_RTB, ModeImmediate);
chosen =3;
}
}

View File

@ -1057,7 +1057,7 @@ static BOOL updateAttackTarget(BASE_OBJECT * psAttacker, SDWORD weapon_slot)
orderState(psDroid, DORDER_ATTACKTARGET)) &&
weapon_slot == 0) //Watermelon:only primary slot(0) updates affect order
{
orderDroidObj((DROID *)psAttacker, DORDER_ATTACKTARGET, psBetterTarget);
orderDroidObj((DROID *)psAttacker, DORDER_ATTACKTARGET, psBetterTarget, ModeImmediate);
}
else //can't override current order
{
@ -1207,14 +1207,14 @@ void aiUpdateDroid(DROID *psDroid)
{
if (aiChooseSensorTarget((BASE_OBJECT *)psDroid, &psTarget))
{
orderDroidObj(psDroid, DORDER_OBSERVE, psTarget);
orderDroidObj(psDroid, DORDER_OBSERVE, psTarget, ModeImmediate);
}
}
else
{
if (aiChooseTarget((BASE_OBJECT *)psDroid, &psTarget, 0, true, NULL))
{
orderDroidObj(psDroid, DORDER_ATTACKTARGET, psTarget);
orderDroidObj(psDroid, DORDER_ATTACKTARGET, psTarget, ModeImmediate);
}
}
}

View File

@ -104,7 +104,7 @@ void cmdDroidAddDroid(DROID *psCommander, DROID *psDroid)
secondarySetState(psDroid, DSO_ATTACK_LEVEL, (SECONDARY_STATE)(psCommander->secondaryOrder & DSS_ALEV_MASK));
secondarySetState(psDroid, DSO_HALTTYPE, (SECONDARY_STATE)(psCommander->secondaryOrder & DSS_HALT_MASK));
orderDroidObj(psDroid, DORDER_GUARD, (BASE_OBJECT *)psCommander);
orderDroidObj(psDroid, DORDER_GUARD, (BASE_OBJECT *)psCommander, ModeQueue);
}
}

View File

@ -434,7 +434,7 @@ void counterBatteryFire(BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget)
//inform viewer of target
if (psViewer->type == OBJ_DROID)
{
orderDroidObj((DROID *)psViewer, DORDER_OBSERVE, psAttacker);
orderDroidObj((DROID *)psViewer, DORDER_OBSERVE, psAttacker, ModeImmediate);
}
else if (psViewer->type == OBJ_STRUCTURE)
{

View File

@ -1811,7 +1811,7 @@ static void dealWithLMBDroid(DROID* psDroid, SELECTION_TYPE selection)
droidSensorDroidWeapon((BASE_OBJECT *)psDroid, psCurr))
{
bSensorAssigned = true;
orderDroidObj(psCurr, DORDER_FIRESUPPORT, (BASE_OBJECT *)psDroid);
orderDroidObj(psCurr, DORDER_FIRESUPPORT, (BASE_OBJECT *)psDroid, ModeQueue);
FeedbackOrderGiven();
}
}
@ -2091,7 +2091,7 @@ static void dealWithLMBFeature(FEATURE* psFeature)
}
else
{
orderDroidStatsLocDir(psCurr, DORDER_BUILD, (BASE_STATS*) &asStructureStats[i], psFeature->pos.x, psFeature->pos.y, player.r.y);
orderDroidStatsLocDir(psCurr, DORDER_BUILD, (BASE_STATS*) &asStructureStats[i], psFeature->pos.x, psFeature->pos.y, player.r.y, ModeQueue);
}
++numTrucks;
}
@ -2125,7 +2125,7 @@ static void dealWithLMBFeature(FEATURE* psFeature)
/* If so then find the nearest unit! */
if (psNearestUnit) // bloody well should be!!!
{
orderDroidObj(psNearestUnit, DORDER_RECOVER, (BASE_OBJECT *)psFeature);
orderDroidObj(psNearestUnit, DORDER_RECOVER, (BASE_OBJECT *)psFeature, ModeQueue);
FeedbackOrderGiven();
}
else

View File

@ -461,7 +461,7 @@ static void driveMoveFollower(DROID *psDroid)
// if the droid is currently guarding we need to change the order to a move
if (psDroid->order==DORDER_GUARD)
{
orderDroidLoc(psDroid,DORDER_MOVE, psDrivenDroid->pos.x,psDrivenDroid->pos.y);
orderDroidLoc(psDroid, DORDER_MOVE, psDrivenDroid->pos.x, psDrivenDroid->pos.y, ModeQueue);
}
else
{

View File

@ -672,7 +672,7 @@ void droidBurn(DROID *psDroid)
audio_PlayObjDynamicTrack( psDroid, ID_SOUND_BARB_SCREAM+(rand()%3), NULL );
/* set droid running */
orderDroid( psDroid, DORDER_RUNBURN );
orderDroid(psDroid, DORDER_RUNBURN, ModeImmediate);
}
void _syncDebugDroid(const char *function, DROID *psDroid, char ch)
@ -4294,7 +4294,7 @@ DROID * giftSingleDroid(DROID *psD, UDWORD to)
if (bMultiPlayer)
{
// reset order
orderDroid(psD, DORDER_STOP);
orderDroid(psD, DORDER_STOP, ModeQueue);
if (droidRemove(psD, apsDroidLists)) // remove droid from one list
{
@ -4363,7 +4363,7 @@ DROID * giftSingleDroid(DROID *psD, UDWORD to)
{
if (psCurr->psTarget == (BASE_OBJECT *)psD || psCurr->psActionTarget[0] == (BASE_OBJECT *)psD)
{
orderDroid(psCurr, DORDER_STOP);
orderDroid(psCurr, DORDER_STOP, ModeQueue);
}
// check through order list
for (i = 0; i < psCurr->listSize; i++)

View File

@ -171,7 +171,7 @@ PROPULSION_STATS *psPropStats;
// if(orderState(psDroid,DORDER_ATTACK) == false)
// {
orderDroidLoc(psDroid,DORDER_MOVE,
apsStructLists[otherPlayer]->pos.x, apsStructLists[otherPlayer]->pos.y);
apsStructLists[otherPlayer]->pos.x, apsStructLists[otherPlayer]->pos.y, ModeQueue);
// }
if(!getWarCamStatus())
@ -286,7 +286,7 @@ UDWORD i,numWith;
{
/* Make the droid attack the building - it'll indirectly route there too */
orderDroidLoc(psDroid,DORDER_SCOUT,
apsStructLists[otherPlayer]->pos.x, apsStructLists[otherPlayer]->pos.y);
apsStructLists[otherPlayer]->pos.x, apsStructLists[otherPlayer]->pos.y, ModeQueue);
}
}
}

View File

@ -3766,7 +3766,7 @@ BOOL saveGame(char *aFileName, GAME_TYPE saveType)
//this is mainly for VTOLs
setSaveDroidBase(psDroid, NULL);
psDroid->cluster = 0;
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
}
@ -5501,7 +5501,7 @@ static DROID* buildDroidFromSaveDroidV19(SAVE_DROID_V18* psSaveDroid, UDWORD ver
{
ASSERT( false,"loadUnit TargetStat not found" );
psDroid->psTarStats = NULL;
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
}
//warning V14 - v17 only

View File

@ -323,7 +323,7 @@ void orderGroup(DROID_GROUP *psGroup, DROID_ORDER order)
for (psCurr = psGroup->psList; psCurr; psCurr=psCurr->psGrpNext)
{
orderDroid(psCurr, order);
orderDroid(psCurr, order, ModeQueue);
}
}
@ -335,26 +335,11 @@ void orderGroupLoc(DROID_GROUP *psGroup, DROID_ORDER order, UDWORD x, UDWORD y)
ASSERT(grpInitialized, "Group code not initialized yet");
ASSERT_OR_RETURN(, psGroup != NULL,
"orderGroupLoc: invalid droid group" );
ASSERT_OR_RETURN(, validOrderForLoc(order), "SendGroupOrderGroup: Bad order");
if(bMultiMessages)
for (psCurr = psGroup->psList; psCurr != NULL; psCurr = psCurr->psGrpNext)
{
SendGroupOrderGroup(psGroup,order,x,y,NULL);
return; // Wait for our order before changing the droids.
bMultiMessages = false;
for(psCurr=psGroup->psList; psCurr; psCurr = psCurr->psGrpNext)
{
orderDroidLoc(psCurr, order, x,y);
}
bMultiMessages = true;
}
else
{
for(psCurr=psGroup->psList; psCurr; psCurr = psCurr->psGrpNext)
{
orderDroidLoc(psCurr, order, x,y);
}
orderDroidLoc(psCurr, order, x, y, bMultiMessages? ModeQueue : ModeImmediate);
}
}
@ -365,26 +350,11 @@ void orderGroupObj(DROID_GROUP *psGroup, DROID_ORDER order, BASE_OBJECT *psObj)
ASSERT_OR_RETURN(, psGroup != NULL,
"orderGroupObj: invalid droid group" );
ASSERT_OR_RETURN(, validOrderForObj(order), "SendGroupOrderGroup: Bad order");
if(bMultiMessages)
for (psCurr = psGroup->psList; psCurr != NULL; psCurr = psCurr->psGrpNext)
{
SendGroupOrderGroup(psGroup,order,0,0,psObj);
return; // Wait for our order before changing the droids.
bMultiMessages = false;
for(psCurr = psGroup->psList; psCurr; psCurr = psCurr->psGrpNext)
{
orderDroidObj(psCurr, order, (BASE_OBJECT *)psObj);
}
bMultiMessages = true;
}
else
{
for(psCurr = psGroup->psList; psCurr; psCurr = psCurr->psGrpNext)
{
orderDroidObj(psCurr, order, (BASE_OBJECT *)psObj);
}
orderDroidObj(psCurr, order, (BASE_OBJECT *)psObj, bMultiMessages? ModeQueue : ModeImmediate);
}
}

View File

@ -2018,7 +2018,7 @@ INT_RETVAL intRunWidgets(void)
&& intNumSelectedDroids(DROID_CYBORG_CONSTRUCT) == 0
&& psObjSelected != NULL)
{
orderDroidStatsTwoLocDir((DROID *)psObjSelected, DORDER_LINEBUILD, psPositionStats, structX, structY, structX2, structY2, player.r.y);
orderDroidStatsTwoLocDir((DROID *)psObjSelected, DORDER_LINEBUILD, psPositionStats, structX, structY, structX2, structY2, player.r.y, ModeQueue);
}
else
{
@ -2063,7 +2063,7 @@ INT_RETVAL intRunWidgets(void)
&& intNumSelectedDroids(DROID_CYBORG_CONSTRUCT) == 0
&& psObjSelected != NULL)
{
orderDroidStatsLocDir((DROID *)psObjSelected, DORDER_BUILD, psPositionStats, structX, structY, player.r.y);
orderDroidStatsLocDir((DROID *)psObjSelected, DORDER_BUILD, psPositionStats, structX, structY, player.r.y, ModeQueue);
}
else
{
@ -6142,13 +6142,13 @@ static BOOL setConstructionStats(BASE_OBJECT *psObj, BASE_STATS *psStats)
}
else
{
orderDroid(psDroid,DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeQueue);
}
}
else
{
psDroid = (DROID *)psObj;
orderDroid(psDroid,DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeQueue);
}
return true;
}

View File

@ -2339,7 +2339,7 @@ void kf_SetDroidMoveHold( void )
{
if (psDroid->selected)
{
orderDroid(psDroid, DORDER_TEMP_HOLD);
orderDroid(psDroid, DORDER_TEMP_HOLD, ModeQueue);
}
}
}

View File

@ -700,8 +700,8 @@ void missionFlyTransportersIn( SDWORD iPlayer, BOOL bTrackTransporter )
psTransporter->body = psTransporter->originalBody;
/* set fly-in order */
orderDroidLoc( psTransporter, DORDER_TRANSPORTIN,
iLandX, iLandY );
orderDroidLoc(psTransporter, DORDER_TRANSPORTIN,
iLandX, iLandY, ModeImmediate);
audio_PlayObjDynamicTrack( psTransporter, ID_SOUND_BLIMP_FLIGHT,
moveCheckDroidMovingAndVisible );
@ -790,12 +790,12 @@ static void saveMissionData(void)
{
if (psStructBeingBuilt->status == SS_BUILT)
{
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
}
else
{
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
}
@ -949,11 +949,11 @@ void saveMissionLimboData(void)
{
if (StructIsFactory(psStruct))
{
holdProduction(psStruct, ModeQueue);
holdProduction(psStruct, ModeImmediate);
}
else if (psStruct->pStructureType->type == REF_RESEARCH)
{
holdResearch(psStruct, ModeQueue);
holdResearch(psStruct, ModeImmediate);
}
}
}
@ -1033,7 +1033,7 @@ void restoreMissionLimboData(void)
addDroid(psDroid, apsDroidLists);
psDroid->cluster = 0;
//reset droid orders
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
//the location of the droid should be valid!
}
}
@ -1309,7 +1309,7 @@ static void clearCampaignUnits(void)
for (psDroid = apsDroidLists[selectedPlayer]; psDroid != NULL; psDroid = psDroid->psNext)
{
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
setDroidBase(psDroid, NULL);
visRemoveVisibilityOffWorld((BASE_OBJECT *)psDroid);
CHECK_DROID(psDroid);
@ -1329,7 +1329,7 @@ static void processMission(void)
{
psNext = psDroid->psNext;
//reset order - do this to all the droids that are returning from offWorld
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
//remove out of stored list and add to current Droid list
if (droidRemove(psDroid, apsDroidLists))
@ -1400,7 +1400,7 @@ void processMissionLimbo(void)
// This is mainly for VTOLs
setDroidBase(psDroid, NULL);
psDroid->cluster = 0;
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
numDroidsAddedToLimboList++;
}
}
@ -1685,7 +1685,7 @@ static void missionResetDroids(void)
}
else
{
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
//KILL OFF TRANSPORTER
@ -1877,7 +1877,7 @@ void unloadTransporter(DROID *psTransporter, UDWORD x, UDWORD y, BOOL goingHome)
}
//reset droid orders
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
psDroid->selected = false;
if (!bMultiPlayer)
{
@ -1923,7 +1923,7 @@ void unloadTransporter(DROID *psTransporter, UDWORD x, UDWORD y, BOOL goingHome)
/* Send transporter offworld */
missionGetTransporterExit( psTransporter->player, &iX, &iY );
orderDroidLoc(psTransporter, DORDER_TRANSPORTRETURN, iX, iY );
orderDroidLoc(psTransporter, DORDER_TRANSPORTRETURN, iX, iY, ModeImmediate);
// Set the launch time so the transporter doesn't just disappear for CAMSTART/CAMCHANGE
transporterSetLaunchTime(gameTime);

View File

@ -472,7 +472,7 @@ BOOL recvDroid(NETQUEUE queue)
if (haveInitialOrders)
{
psDroid->secondaryOrder = initialOrders.secondaryOrder;
orderDroidLoc(psDroid, DORDER_MOVE, initialOrders.moveToX, initialOrders.moveToY);
orderDroidLoc(psDroid, DORDER_MOVE, initialOrders.moveToX, initialOrders.moveToY, ModeImmediate);
cbNewDroid(IdToStruct(initialOrders.factoryId, ANYPLAYER), psDroid);
}
}

View File

@ -446,15 +446,13 @@ void formAlliance(uint8_t p1, uint8_t p2, BOOL prop, BOOL allowAudio, BOOL allow
}
// Clear out any attacking orders
turnOffMultiMsg(true);
for (psDroid = apsDroidLists[p1]; psDroid; psDroid = psDroid->psNext) // from -> to
{
if (psDroid->order == DORDER_ATTACK
&& psDroid->psTarget
&& psDroid->psTarget->player == p2)
{
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
}
for (psDroid = apsDroidLists[p2]; psDroid; psDroid = psDroid->psNext) // to -> from
@ -463,11 +461,9 @@ void formAlliance(uint8_t p1, uint8_t p2, BOOL prop, BOOL allowAudio, BOOL allow
&& psDroid->psTarget
&& psDroid->psTarget->player == p1)
{
orderDroid(psDroid,DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
}
turnOffMultiMsg(false);
}

View File

@ -387,9 +387,7 @@ BOOL recvDroidCheck(NETQUEUE queue)
{
debug(LOG_SYNC, "Droid %u out of synch, changing order from %s to %s(%d, %d).", pc.droidID, getDroidOrderName(pc2.order), getDroidOrderName(pc.order), pc.orderX, pc.orderY);
// reroute the droid.
turnOffMultiMsg(true);
orderDroidLoc(pD, pc.order, pc.orderX, pc.orderY);
turnOffMultiMsg(false);
orderDroidLoc(pD, pc.order, pc.orderX, pc.orderY, ModeImmediate);
}
break;
case DORDER_ATTACK:
@ -400,9 +398,7 @@ BOOL recvDroidCheck(NETQUEUE queue)
{
debug(LOG_SYNC, "Droid %u out of synch, changing order from %s to %s(%u).", pc.droidID, getDroidOrderName(pc2.order), getDroidOrderName(pc.order), pc.targetID);
// remote droid is attacking, not here tho!
turnOffMultiMsg(true);
orderDroidObj(pD, pc.order, IdToPointer(pc.targetID, ANYPLAYER));
turnOffMultiMsg(false);
orderDroidObj(pD, pc.order, IdToPointer(pc.targetID, ANYPLAYER), ModeImmediate);
}
else
{

View File

@ -300,7 +300,7 @@ void orderUpdateDroid(DROID *psDroid)
else if (hasCommander(psDroid) &&
(psDroid->psTarStats != (BASE_STATS *) structGetDemolishStat())) // stop the constructor auto repairing when it is about to demolish
{
orderDroidObj(psDroid, DORDER_GUARD, (BASE_OBJECT *)psDroid->psGroup->psCommander);
orderDroidObj(psDroid, DORDER_GUARD, (BASE_OBJECT *)psDroid->psGroup->psCommander, ModeImmediate);
}
else if (psDroid->droidType == DROID_TRANSPORTER && !bMultiPlayer)
{
@ -361,9 +361,7 @@ void orderUpdateDroid(DROID *psDroid)
secondaryGetState(psDroid, DSO_HALTTYPE) == DSS_HALT_GUARD &&
!isVtolDroid(psDroid))
{
turnOffMultiMsg(true);
orderDroidLoc(psDroid, DORDER_GUARD, psDroid->pos.x, psDroid->pos.y);
turnOffMultiMsg(false);
orderDroidLoc(psDroid, DORDER_GUARD, psDroid->pos.x, psDroid->pos.y, ModeImmediate);
}
break;
@ -388,7 +386,7 @@ void orderUpdateDroid(DROID *psDroid)
//move droids in Transporter into holding list
moveDroidsToSafety(psDroid);
//we need the transporter to just sit off world for a while...
orderDroid( psDroid, DORDER_TRANSPORTIN );
orderDroid(psDroid, DORDER_TRANSPORTIN, ModeImmediate);
/* set action transporter waits for timer */
actionDroid( psDroid, DACTION_TRANSPORTWAITTOFLYIN );
@ -860,9 +858,7 @@ void orderUpdateDroid(DROID *psDroid)
CHECK_DROID(transporter);
// order the droid to stop so moveUpdateDroid does not process this unit
turnOffMultiMsg(true); // Do this now, since synchronised. If sending later, it's too late.
orderDroid(psDroid, DORDER_STOP);
turnOffMultiMsg(false);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
setDroidTarget(psDroid, NULL);
psDroid->psTarStats = NULL;
secondarySetState(psDroid, DSO_RETURN_TO_LOC, DSS_NONE);
@ -925,7 +921,7 @@ void orderUpdateDroid(DROID *psDroid)
{
// Our target got lost. Let's try again.
psDroid->order = DORDER_NONE;
orderDroid(psDroid, DORDER_RTR);
orderDroid(psDroid, DORDER_RTR, ModeImmediate);
}
else if (psDroid->action == DACTION_NONE)
{
@ -954,7 +950,7 @@ void orderUpdateDroid(DROID *psDroid)
((psDroid->id + gameTime)/GAME_TICKS_PER_SEC != (psDroid->id + gameTime - deltaGameTime)/GAME_TICKS_PER_SEC))
{
// see if there is a repair facility nearer than the one currently selected
orderDroid(psDroid, DORDER_RTR);
orderDroid(psDroid, DORDER_RTR, ModeImmediate);
}
break;
case DORDER_RUNBURN:
@ -1230,7 +1226,7 @@ void orderUpdateDroid(DROID *psDroid)
if (psObj == NULL
|| psObj != (BASE_OBJECT *)psDroid->psGroup->psCommander)
{
orderDroidObj(psDroid, DORDER_GUARD, (BASE_OBJECT *)psDroid->psGroup->psCommander);
orderDroidObj(psDroid, DORDER_GUARD, (BASE_OBJECT *)psDroid->psGroup->psCommander, ModeImmediate);
}
}
@ -1267,7 +1263,7 @@ void orderUpdateDroid(DROID *psDroid)
}
if (psObj)
{
orderDroidObj(psDroid, DORDER_REPAIR, psObj);
orderDroidObj(psDroid, DORDER_REPAIR, psObj, ModeImmediate);
}
}
break;
@ -1331,7 +1327,6 @@ static void orderCmdGroupBase(DROID_GROUP *psGroup, DROID_ORDER_DATA *psData)
}
}
}
turnOffMultiMsg(false);
}
@ -1947,7 +1942,7 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
}
else
{
orderDroid(psDroid, DORDER_RTB);
orderDroid(psDroid, DORDER_RTB, ModeImmediate);
}
}
else
@ -1955,7 +1950,7 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
// no repair facility or HQ go to the landing zone
if (!bMultiPlayer && selectedPlayer == 0)
{
orderDroid(psDroid, DORDER_RTB);
orderDroid(psDroid, DORDER_RTB, ModeImmediate);
}
}
break;
@ -2091,7 +2086,7 @@ void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder)
/* Give a droid an order */
void orderDroid(DROID *psDroid, DROID_ORDER order)
void orderDroid(DROID *psDroid, DROID_ORDER order, QUEUE_MODE mode)
{
DROID_ORDER_DATA sOrder;
@ -2113,10 +2108,9 @@ void orderDroid(DROID *psDroid, DROID_ORDER order)
memset(&sOrder,0,sizeof(DROID_ORDER_DATA));
sOrder.order = order;
if(bMultiMessages)
if (mode == ModeQueue && bMultiPlayer)
{
SendDroidInfo(psDroid, order, 0, 0, NULL, NULL, 0, 0, 0);
// Wait to receive our order before changing the droid.
}
else
{
@ -2145,18 +2139,17 @@ BOOL validOrderForLoc(DROID_ORDER order)
}
/* Give a droid an order with a location target */
void orderDroidLoc(DROID *psDroid, DROID_ORDER order, UDWORD x, UDWORD y)
void orderDroidLoc(DROID *psDroid, DROID_ORDER order, UDWORD x, UDWORD y, QUEUE_MODE mode)
{
DROID_ORDER_DATA sOrder;
ASSERT_OR_RETURN(, psDroid != NULL, "Invalid unit pointer");
ASSERT_OR_RETURN(, validOrderForLoc(order), "Invalid order for location");
if(bMultiMessages) //ajl
if (mode == ModeQueue && bMultiPlayer) //ajl
{
SendDroidInfo(psDroid, order, x, y, NULL, NULL, 0, 0, 0);
return; // Wait to receive our order before changing the droid.
//turnOffMultiMsg(true); // msgs off.
}
orderClearDroidList(psDroid);
@ -2166,8 +2159,6 @@ void orderDroidLoc(DROID *psDroid, DROID_ORDER order, UDWORD x, UDWORD y)
sOrder.x = (UWORD)x;
sOrder.y = (UWORD)y;
orderDroidBase(psDroid, &sOrder);
//turnOffMultiMsg(false); //msgs back on..
}
@ -2207,14 +2198,14 @@ BOOL validOrderForObj(DROID_ORDER order)
}
/* Give a droid an order with an object target */
void orderDroidObj(DROID *psDroid, DROID_ORDER order, BASE_OBJECT *psObj)
void orderDroidObj(DROID *psDroid, DROID_ORDER order, BASE_OBJECT *psObj, QUEUE_MODE mode)
{
DROID_ORDER_DATA sOrder;
ASSERT(psDroid != NULL, "Invalid unit pointer");
ASSERT(validOrderForObj(order), "Invalid order for object");
if(bMultiMessages) //ajl
if (mode == ModeQueue && bMultiPlayer) //ajl
{
SendDroidInfo(psDroid, order, 0, 0, psObj, NULL, 0, 0, 0);
return; // Wait for the order to be received before changing the droid.
@ -2315,14 +2306,14 @@ BASE_OBJECT* orderStateObj(DROID *psDroid, DROID_ORDER order)
/* Give a droid an order with a location and a stat */
void orderDroidStatsLocDir(DROID *psDroid, DROID_ORDER order, BASE_STATS *psStats, UDWORD x, UDWORD y, uint16_t direction)
void orderDroidStatsLocDir(DROID *psDroid, DROID_ORDER order, BASE_STATS *psStats, UDWORD x, UDWORD y, uint16_t direction, QUEUE_MODE mode)
{
DROID_ORDER_DATA sOrder;
ASSERT(psDroid != NULL, "Invalid unit pointer");
ASSERT(order == DORDER_BUILD, "Invalid order for location");
if (bMultiMessages)
if (mode == ModeQueue && bMultiPlayer)
{
SendDroidInfo(psDroid, order, x, y, NULL, psStats, 0, 0, direction);
return; // Wait for our order before changing the droid.
@ -2361,7 +2352,7 @@ void orderDroidStatsLocDirAdd(DROID *psDroid, DROID_ORDER order, BASE_STATS *psS
/* Give a droid an order with a location and a stat */
void orderDroidStatsTwoLocDir(DROID *psDroid, DROID_ORDER order, BASE_STATS *psStats, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, uint16_t direction)
void orderDroidStatsTwoLocDir(DROID *psDroid, DROID_ORDER order, BASE_STATS *psStats, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, uint16_t direction, QUEUE_MODE mode)
{
DROID_ORDER_DATA sOrder;
@ -2369,7 +2360,7 @@ void orderDroidStatsTwoLocDir(DROID *psDroid, DROID_ORDER order, BASE_STATS *psS
ASSERT(order == DORDER_LINEBUILD, "Invalid order for location");
ASSERT(x1 == x2 || y1 == y2, "Invalid locations for LINEBUILD");
if (bMultiMessages)
if (mode == ModeQueue && bMultiPlayer)
{
SendDroidInfo(psDroid, order, x1, y1, NULL, psStats, x2, y2, direction);
return; // Wait for our order before changing the droid.
@ -2768,7 +2759,6 @@ void orderSelectedLoc(uint32_t player, uint32_t x, uint32_t y, bool add)
// note that an order list graphic needs to be displayed
bOrderEffectDisplayed = false;
return; // Wait to receive our order before changing the droids.
turnOffMultiMsg(true);
}
// remove any units from their command group
@ -2800,12 +2790,10 @@ void orderSelectedLoc(uint32_t player, uint32_t x, uint32_t y, bool add)
if (order != DORDER_NONE && !(add && orderDroidLocAdd(psCurr, order, x, y)))
{
// if not just do it straight off
orderDroidLoc(psCurr, order, x,y);
orderDroidLoc(psCurr, order, x, y, ModeQueue);
}
}
}
turnOffMultiMsg(false); // msgs back on...
}
@ -3143,7 +3131,6 @@ void orderSelectedObjAdd(UDWORD player, BASE_OBJECT *psObj, BOOL add)
bOrderEffectDisplayed = false;
orderPlayOrderObjAudio(player, psObj);
return; // Wait to receive our order before changing anything.
turnOffMultiMsg(true);
}
@ -3173,14 +3160,12 @@ void orderSelectedObjAdd(UDWORD player, BASE_OBJECT *psObj, BOOL add)
if (!(add && orderDroidObjAdd(psCurr, order, &psObj)))
{
// if not just do it straight off
orderDroidObj(psCurr, order, psObj);
orderDroidObj(psCurr, order, psObj, ModeQueue);
}
}
}
orderPlayOrderObjAudio( player, psObj );
turnOffMultiMsg(false); //msgs back on.
}
void orderSelectedObj(UDWORD player, BASE_OBJECT *psObj)
@ -3209,7 +3194,7 @@ void orderSelectedStatsLocDir(UDWORD player, DROID_ORDER order, BASE_STATS *psSt
}
else
{
orderDroidStatsLocDir(psCurr, order, psStats, x, y, direction);
orderDroidStatsLocDir(psCurr, order, psStats, x, y, direction, ModeQueue);
}
}
}
@ -3236,7 +3221,7 @@ void orderSelectedStatsTwoLocDir(UDWORD player, DROID_ORDER order, BASE_STATS *p
}
else
{
orderDroidStatsTwoLocDir(psCurr, order, psStats, x1, y1, x2, y2, direction);
orderDroidStatsTwoLocDir(psCurr, order, psStats, x1, y1, x2, y2, direction, ModeQueue);
}
}
}
@ -3531,7 +3516,7 @@ void secondaryCheckDamageLevel(DROID *psDroid)
}
else
{
orderDroid(psDroid, DORDER_RTR);
orderDroid(psDroid, DORDER_RTR, ModeImmediate);
}
}
}
@ -3553,7 +3538,6 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
{
sendDroidSecondary(psDroid,sec,State);
return true; // Wait for our order before changing the droid.
turnOffMultiMsg(true); // msgs off.
}
@ -3588,7 +3572,7 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
// orderState(psDroid, DORDER_FIRESUPPORT) )
{
// just kill these orders
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
if (isVtolDroid(psDroid))
{
moveToRearm(psDroid);
@ -3699,7 +3683,7 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
{
if (!orderState(psDroid, DORDER_RECYCLE))
{
orderDroid(psDroid, DORDER_RECYCLE);
orderDroid(psDroid, DORDER_RECYCLE, ModeImmediate);
}
// CurrState &= ~(DSS_HOLD_SET|DSS_RTB_SET|DSS_RTR_SET|DSS_RECYCLE_SET);
CurrState &= ~(DSS_RTL_MASK|DSS_RECYCLE_MASK|DSS_HALT_MASK);
@ -3714,7 +3698,7 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
{
psNext = psCurr->psGrpNext;
grpLeave(psCurr->psGroup, psCurr);
orderDroid(psCurr, DORDER_STOP);
orderDroid(psCurr, DORDER_STOP, ModeImmediate);
}
}
else if (psDroid->psGroup->type == GT_COMMAND)
@ -3727,7 +3711,7 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
{
if (orderState(psDroid, DORDER_RECYCLE))
{
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
CurrState &= ~DSS_RECYCLE_MASK;
}
@ -3760,20 +3744,20 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
CurrState |= DSS_HALT_PURSUE;
if (orderState(psDroid, DORDER_GUARD))
{
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
break;
case DSS_HALT_GUARD:
CurrState &= ~ DSS_HALT_MASK;
CurrState |= DSS_HALT_GUARD;
orderDroidLoc(psDroid, DORDER_GUARD, psDroid->pos.x,psDroid->pos.y);
orderDroidLoc(psDroid, DORDER_GUARD, psDroid->pos.x, psDroid->pos.y, ModeImmediate);
break;
case DSS_HALT_HOLD:
CurrState &= ~ DSS_HALT_MASK;
CurrState |= DSS_HALT_HOLD;
if (!orderState(psDroid, DORDER_FIRESUPPORT))
{
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
break;
}
@ -3785,7 +3769,7 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
orderState(psDroid, DORDER_RTB) ||
orderState(psDroid, DORDER_EMBARK))
{
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
}
CurrState &= ~DSS_RTL_MASK;
}
@ -3834,7 +3818,7 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
CurrState |= DSS_RTL_TRANSPORT;
if (!orderState(psDroid, DORDER_EMBARK))
{
orderDroidObj(psDroid, DORDER_EMBARK, (BASE_OBJECT *)psTransport);
orderDroidObj(psDroid, DORDER_EMBARK, (BASE_OBJECT *)psTransport, ModeImmediate);
}
}
}
@ -3849,7 +3833,7 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
}
if (!orderState(psDroid, order))
{
orderDroid(psDroid, order);
orderDroid(psDroid, order, ModeImmediate);
}
}
break;
@ -3873,10 +3857,6 @@ BOOL secondarySetState(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE Stat
psDroid->secondaryOrder = CurrState;
turnOffMultiMsg(false);
return retVal;
}
@ -4039,12 +4019,14 @@ void orderMoralCheck(UDWORD player)
}
check = gameRand(100);
syncDebug("Run check = %d", check);
if (psCurr->droidType == DROID_PERSON)
{
if (check > personLShip)
{
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psCurr->id );
orderDroid(psCurr, DORDER_RUN);
syncDebug("Person running.");
orderDroid(psCurr, DORDER_RUN, ModeImmediate);
}
}
else
@ -4052,7 +4034,8 @@ void orderMoralCheck(UDWORD player)
if (check > leadership)
{
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psCurr->id );
orderDroid(psCurr, DORDER_RUN);
syncDebug("Droid running.");
orderDroid(psCurr, DORDER_RUN, ModeImmediate);
}
}
}
@ -4104,12 +4087,14 @@ void orderGroupMoralCheck(DROID_GROUP *psGroup)
}
check = gameRand(100);
syncDebug("Run check = %d", check);
if (psCurr->droidType == DROID_PERSON)
{
if (check > personLShip)
{
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psCurr->id );
orderDroidLoc(psCurr, DORDER_RUN, psRunData->sPos.x, psRunData->sPos.y);
syncDebug("Person running.");
orderDroidLoc(psCurr, DORDER_RUN, psRunData->sPos.x, psRunData->sPos.y, ModeImmediate);
}
}
else
@ -4117,7 +4102,8 @@ void orderGroupMoralCheck(DROID_GROUP *psGroup)
if (check > leadership)
{
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psCurr->id );
orderDroidLoc(psCurr, DORDER_RUN, psRunData->sPos.x, psRunData->sPos.y);
syncDebug("Droid running.");
orderDroidLoc(psCurr, DORDER_RUN, psRunData->sPos.x, psRunData->sPos.y, ModeImmediate);
}
}
}
@ -4173,7 +4159,8 @@ void orderHealthCheck(DROID *psDroid)
orderState(psDroid, DORDER_DESTRUCT)))
{
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psDroid->id );
orderDroidLoc(psDroid, DORDER_RUN, retreatX, retreatY);
syncDebug("Droid running.");
orderDroidLoc(psDroid, DORDER_RUN, retreatX, retreatY, ModeImmediate);
}
// order each unit in the same group to run
@ -4193,7 +4180,8 @@ void orderHealthCheck(DROID *psDroid)
}
// debug( LOG_NEVER, " DORDER_RUN: droid %d\n", psCurr->id );
orderDroidLoc(psCurr, DORDER_RUN, retreatX, retreatY);
syncDebug("Group running.");
orderDroidLoc(psCurr, DORDER_RUN, retreatX, retreatY, ModeImmediate);
}
}
}

View File

@ -153,7 +153,7 @@ extern void initRunData(void);
extern void orderUpdateDroid(DROID *psDroid);
/* Give a droid an order */
extern void orderDroid(DROID *psDroid, DROID_ORDER order);
extern void orderDroid(DROID *psDroid, DROID_ORDER order, QUEUE_MODE mode);
/* Check the order state of a droid */
extern BOOL orderState(DROID *psDroid, DROID_ORDER order);
@ -165,26 +165,26 @@ BOOL validOrderForLoc(DROID_ORDER order);
BOOL validOrderForObj(DROID_ORDER order);
/* Give a droid an order with a location target */
extern void orderDroidLoc(DROID *psDroid, DROID_ORDER order, UDWORD x, UDWORD y);
void orderDroidLoc(DROID *psDroid, DROID_ORDER order, UDWORD x, UDWORD y, QUEUE_MODE mode);
/* Get the state of a droid order with a location */
extern BOOL orderStateLoc(DROID *psDroid, DROID_ORDER order, UDWORD *pX, UDWORD *pY);
/* Give a droid an order with an object target */
extern void orderDroidObj(DROID *psDroid, DROID_ORDER order, BASE_OBJECT *psObj);
void orderDroidObj(DROID *psDroid, DROID_ORDER order, BASE_OBJECT *psObj, QUEUE_MODE mode);
/* Get the state of a droid order with an object */
extern BASE_OBJECT* orderStateObj(DROID *psDroid, DROID_ORDER order);
/* Give a droid an order with a location and a stat */
extern void orderDroidStatsLocDir(DROID *psDroid, DROID_ORDER order, BASE_STATS *psStats, UDWORD x, UDWORD y, uint16_t direction);
void orderDroidStatsLocDir(DROID *psDroid, DROID_ORDER order, BASE_STATS *psStats, UDWORD x, UDWORD y, uint16_t direction, QUEUE_MODE mode);
/* Get the state of a droid order with a location and a stat */
extern BOOL orderStateStatsLoc(DROID *psDroid, DROID_ORDER order,
BASE_STATS **ppsStats, UDWORD *pX, UDWORD *pY);
/* Give a droid an order with a location and a stat */
void orderDroidStatsTwoLocDir(DROID *psDroid, DROID_ORDER order, BASE_STATS *psStats, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, uint16_t direction);
void orderDroidStatsTwoLocDir(DROID *psDroid, DROID_ORDER order, BASE_STATS *psStats, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, uint16_t direction, QUEUE_MODE mode);
void orderDroidStatsTwoLocDirAdd(DROID *psDroid, DROID_ORDER order, BASE_STATS *psStats, UDWORD x1, UDWORD y1, UDWORD x2, UDWORD y2, uint16_t direction);

View File

@ -514,7 +514,7 @@ BOOL scrOrderDroid(void)
return false;
}
orderDroid(psDroid, order);
orderDroid(psDroid, order, ModeQueue);
return true;
}
@ -556,7 +556,7 @@ BOOL scrOrderDroidLoc(void)
return false;
}
orderDroidLoc(psDroid, order, (UDWORD)x,(UDWORD)y);
orderDroidLoc(psDroid, order, x, y, ModeQueue);
return true;
}
@ -597,7 +597,7 @@ BOOL scrOrderDroidObj(void)
return false;
}
orderDroidObj(psDroid, order, psObj);
orderDroidObj(psDroid, order, psObj, ModeQueue);
return true;
}
@ -658,7 +658,7 @@ BOOL scrOrderDroidStatsLoc(void)
return true;
}
orderDroidStatsLocDir(psDroid, order, psStats, (UDWORD)x, (UDWORD)y, 0);
orderDroidStatsLocDir(psDroid, order, psStats, x, y, 0, ModeQueue);
}
return true;
@ -1989,11 +1989,11 @@ static BOOL defenseLocation(BOOL variantB)
// first section.
if(x1 == x2 && y1 == y2) //first sec is 1 tile only: ((2 tile gate) or (3 tile gate and first sec))
{
orderDroidStatsLocDir(psDroid, DORDER_BUILD, psWStats, x1, y1, 0);
orderDroidStatsLocDir(psDroid, DORDER_BUILD, psWStats, x1, y1, 0, ModeQueue);
}
else
{
orderDroidStatsTwoLocDir(psDroid, DORDER_LINEBUILD, psWStats, x1, y1, x2, y2, 0);
orderDroidStatsTwoLocDir(psDroid, DORDER_LINEBUILD, psWStats, x1, y1, x2, y2, 0, ModeQueue);
}
// second section
@ -2080,6 +2080,7 @@ BOOL scrActionDroidObj(void)
return false;
}
syncDebug("TODO: Synchronise this!");
actionDroidObj(psDroid, action, (BASE_OBJECT *)psObj);
return true;

View File

@ -2682,10 +2682,11 @@ static BOOL structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
if ( psFact->psCommander != NULL )
{
syncDebug("Has commander.");
if (idfDroid(psNewDroid) ||
isVtolDroid(psNewDroid))
{
orderDroidObj(psNewDroid, DORDER_FIRESUPPORT, (BASE_OBJECT *)psFact->psCommander);
orderDroidObj(psNewDroid, DORDER_FIRESUPPORT, (BASE_OBJECT *)psFact->psCommander, ModeImmediate);
moveToRearm(psNewDroid);
}
else
@ -2725,11 +2726,11 @@ static BOOL structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
UDWORD droidY = psFlag->coords.y;
//find a suitable location near the delivery point
actionVTOLLandingPos(psNewDroid, &droidX, &droidY);
orderDroidLoc(psNewDroid,DORDER_MOVE,droidX,droidY);
orderDroidLoc(psNewDroid, DORDER_MOVE, droidX, droidY, ModeQueue);
}
else
{
orderDroidLoc(psNewDroid,DORDER_MOVE,psFlag->coords.x,psFlag->coords.y);
orderDroidLoc(psNewDroid, DORDER_MOVE, psFlag->coords.x, psFlag->coords.y, ModeQueue);
}
}
}
@ -3154,15 +3155,15 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
// return a droid to it's command group
DROID *psCommander = psDroid->psGroup->psCommander;
orderDroidObj(psDroid, DORDER_GUARD, (BASE_OBJECT *)psCommander);
orderDroidObj(psDroid, DORDER_GUARD, (BASE_OBJECT *)psCommander, ModeImmediate);
}
else if (psRepairFac->psDeliveryPoint != NULL)
{
// move the droid out the way
objTrace(psDroid->id, "Repair not needed - move to delivery point");
orderDroidLoc( psDroid, DORDER_MOVE,
orderDroidLoc(psDroid, DORDER_MOVE,
psRepairFac->psDeliveryPoint->coords.x,
psRepairFac->psDeliveryPoint->coords.y );
psRepairFac->psDeliveryPoint->coords.y, ModeImmediate);
}
continue;
}
@ -3650,7 +3651,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
DROID *psCommander = psDroid->psGroup->psCommander;
objTrace(psDroid->id, "Repair complete - move to commander");
orderDroidObj(psDroid, DORDER_GUARD, (BASE_OBJECT *)psCommander);
orderDroidObj(psDroid, DORDER_GUARD, (BASE_OBJECT *)psCommander, ModeImmediate);
}
else if (psRepairFac->psDeliveryPoint != NULL)
{
@ -3658,7 +3659,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
objTrace(psDroid->id, "Repair complete - move to delivery point");
orderDroidLoc( psDroid, DORDER_MOVE,
psRepairFac->psDeliveryPoint->coords.x,
psRepairFac->psDeliveryPoint->coords.y );
psRepairFac->psDeliveryPoint->coords.y, ModeImmediate);
}
}
}
@ -7816,14 +7817,14 @@ STRUCTURE * giftSingleStructure(STRUCTURE *psStructure, UBYTE attackPlayer, BOOL
{
if (psCurr->psTarget == (BASE_OBJECT *)psStructure)
{
orderDroid(psCurr, DORDER_STOP);
orderDroid(psCurr, DORDER_STOP, ModeImmediate);
break;
}
for (i = 0;i < psCurr->numWeaps;i++)
{
if (psCurr->psActionTarget[i] == (BASE_OBJECT *)psStructure)
{
orderDroid(psCurr, DORDER_STOP);
orderDroid(psCurr, DORDER_STOP, ModeImmediate);
break;
}
}

View File

@ -1072,71 +1072,6 @@ bool transporterIsEmpty(const DROID* psTransporter)
|| psTransporter->psGroup->psList == psTransporter);
}
#define MAX_TRANSPORTERS 8
// Order all selected droids to embark all avaialable transporters.
//
BOOL OrderDroidsToEmbark(void)
{
UWORD NumTransporters = 0;
UWORD CurrentTransporter;
DROID *psTransporters[MAX_TRANSPORTERS];
DROID *psDroid;
BOOL Ok = false;
// First build a list of transporters.
for(psDroid = apsDroidLists[selectedPlayer]; (psDroid != NULL); psDroid = psDroid->psNext) {
if( psDroid->droidType == DROID_TRANSPORTER ) {
psTransporters[NumTransporters] = psDroid;
NumTransporters++;
ASSERT( NumTransporters <= MAX_TRANSPORTERS,"MAX_TRANSPORTERS Exceeded" );
}
}
// Now order any selected droids to embark them.
if(NumTransporters) {
CurrentTransporter = 0;
for(psDroid = apsDroidLists[selectedPlayer]; (psDroid != NULL); psDroid =
psDroid->psNext)
{
if( psDroid->selected && (psDroid->droidType != DROID_TRANSPORTER) )
{
orderDroidObj(psDroid, DORDER_EMBARK, (BASE_OBJECT *)psTransporters[CurrentTransporter]);
// Step through the available transporters.
CurrentTransporter++;
if(CurrentTransporter >= NumTransporters) {
CurrentTransporter = 0;
}
Ok = true;
}
}
}
return false;
}
// Order a single droid to embark any available transporters.
//
BOOL OrderDroidToEmbark(DROID *psDroid)
{
DROID *psTransporter;
psTransporter = FindATransporter(psDroid->player);
if(psTransporter != NULL)
{
orderDroidObj(psDroid, DORDER_EMBARK, (BASE_OBJECT *)psTransporter);
return true;
}
return false;
}
static void intSetTransCapacityLabel(char *Label)
{
UDWORD capacity = TRANSPORTER_CAPACITY;
@ -1379,7 +1314,7 @@ void transporterRemoveDroid(UDWORD id)
// Not sure how to fix this...
debug(LOG_ERROR, "TODO: Can't unload single droids, sending order to unload all at once, because this code is so convoluted.");
// All at once is better than nothing...
orderDroidLoc(psCurrTransporter, DORDER_DISEMBARK, psCurrTransporter->pos.x, psCurrTransporter->pos.y);
orderDroidLoc(psCurrTransporter, DORDER_DISEMBARK, psCurrTransporter->pos.x, psCurrTransporter->pos.y, ModeQueue);
return;
}
@ -1456,7 +1391,7 @@ void transporterRemoveDroid(UDWORD id)
//initialise the movement data
initDroidMovement(psDroid);
//reset droid orders
orderDroid(psDroid, DORDER_STOP);
orderDroid(psDroid, DORDER_STOP, ModeImmediate);
psDroid->cluster = 0;
// check if it is a commander
if (psDroid->droidType == DROID_COMMAND)
@ -1676,7 +1611,7 @@ BOOL launchTransporter(DROID *psTransporter)
{
//tell the transporter to move to the new offworld location
missionGetTransporterExit( psTransporter->player, &iX, &iY );
orderDroidLoc(psTransporter, DORDER_TRANSPORTOUT, iX, iY );
orderDroidLoc(psTransporter, DORDER_TRANSPORTOUT, iX, iY, ModeQueue);
//g_iLaunchTime = gameTime;
transporterSetLaunchTime(gameTime);
}
@ -1697,7 +1632,7 @@ BOOL launchTransporter(DROID *psTransporter)
//psTransporter->pos.y = getLandingY(psTransporter->player);
//unloadTransporter(psTransporter, psTransporter->pos.x, psTransporter->pos.y, false);
orderDroid( psTransporter, DORDER_TRANSPORTIN );
orderDroid(psTransporter, DORDER_TRANSPORTIN, ModeImmediate);
/* set action transporter waits for timer */
actionDroid( psTransporter, DACTION_TRANSPORTWAITTOFLYIN );

View File

@ -66,11 +66,6 @@ extern BOOL launchTransporter(DROID *psTransporter);
have arrived - returns true when there*/
extern BOOL updateTransporter(DROID *psTransporter);
// Order all selected droids to embark all avaialable transporters.
extern BOOL OrderDroidsToEmbark(void);
// Order a single droid to embark any available transporters.
extern BOOL OrderDroidToEmbark(DROID *psDroid);
extern void intUpdateTransCapacity(WIDGET *psWidget, W_CONTEXT *psContext);
/* Remove the Transporter Launch widget from the screen*/