Call CALL_NEWDROID script callback only if newly built droid was successfully placed on map.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1048 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
26158abb0c
commit
7557531b17
|
@ -3551,8 +3551,8 @@ BOOL placeDroid(STRUCTURE *psStructure, UDWORD *droidX, UDWORD *droidY)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Place a newly manufactured droid next to a factory and then send if off
|
/* Place a newly manufactured droid next to a factory and then send if off
|
||||||
to the assembly point*/
|
to the assembly point, returns true if droid was placed successfully */
|
||||||
static void structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
|
static BOOL structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
|
||||||
DROID **ppsDroid)
|
DROID **ppsDroid)
|
||||||
{
|
{
|
||||||
UDWORD x,y;
|
UDWORD x,y;
|
||||||
|
@ -3582,7 +3582,7 @@ static void structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
|
||||||
if (!psNewDroid)
|
if (!psNewDroid)
|
||||||
{
|
{
|
||||||
*ppsDroid = NULL;
|
*ppsDroid = NULL;
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the droids order to that of the factory - AB 22/04/99
|
//set the droids order to that of the factory - AB 22/04/99
|
||||||
|
@ -3803,11 +3803,14 @@ static void structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
|
||||||
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DROIDBUILT);
|
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DROIDBUILT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*ppsDroid = NULL;
|
*ppsDroid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3950,7 +3953,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure)
|
||||||
RESEARCH_FACILITY *psResFacility;
|
RESEARCH_FACILITY *psResFacility;
|
||||||
REARM_PAD *psReArmPad;
|
REARM_PAD *psReArmPad;
|
||||||
iVector iVecEffect;
|
iVector iVecEffect;
|
||||||
BOOL bFinishAction;//bFinishRepair;
|
BOOL bFinishAction,bDroidPlaced;
|
||||||
WEAPON_STATS *psWStats;
|
WEAPON_STATS *psWStats;
|
||||||
BASE_OBJECT *psTarget;
|
BASE_OBJECT *psTarget;
|
||||||
SDWORD xdiff,ydiff, mindist, currdist;
|
SDWORD xdiff,ydiff, mindist, currdist;
|
||||||
|
@ -4544,7 +4547,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure)
|
||||||
!CheckHaltOnMaxUnitsReached(psStructure))
|
!CheckHaltOnMaxUnitsReached(psStructure))
|
||||||
{
|
{
|
||||||
/* Place the droid on the map */
|
/* Place the droid on the map */
|
||||||
structPlaceDroid(psStructure, (DROID_TEMPLATE *)pSubject, &psDroid);
|
bDroidPlaced = structPlaceDroid(psStructure, (DROID_TEMPLATE *)pSubject, &psDroid);
|
||||||
|
|
||||||
//reset the start time
|
//reset the start time
|
||||||
psFactory->timeStarted = ACTION_START_TIME;
|
psFactory->timeStarted = ACTION_START_TIME;
|
||||||
|
@ -4567,7 +4570,10 @@ static void aiUpdateStructure(STRUCTURE *psStructure)
|
||||||
psFactory->psSubject = NULL;
|
psFactory->psSubject = NULL;
|
||||||
|
|
||||||
//script callback, must be called after factory was flagged as idle
|
//script callback, must be called after factory was flagged as idle
|
||||||
cbNewDroid(psStructure, psDroid);
|
if(bDroidPlaced)
|
||||||
|
{
|
||||||
|
cbNewDroid(psStructure, psDroid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4610,7 +4616,10 @@ static void aiUpdateStructure(STRUCTURE *psStructure)
|
||||||
intManufactureFinished(psStructure);
|
intManufactureFinished(psStructure);
|
||||||
|
|
||||||
//script callback, must be called after factory was flagged as idle
|
//script callback, must be called after factory was flagged as idle
|
||||||
cbNewDroid(psStructure, psDroid);
|
if(bDroidPlaced)
|
||||||
|
{
|
||||||
|
cbNewDroid(psStructure, psDroid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9937,6 +9946,9 @@ BOOL lasSatStructSelected(STRUCTURE *psStruct)
|
||||||
/* Call CALL_NEWDROID script callback */
|
/* Call CALL_NEWDROID script callback */
|
||||||
static void cbNewDroid(STRUCTURE *psFactory, DROID *psDroid)
|
static void cbNewDroid(STRUCTURE *psFactory, DROID *psDroid)
|
||||||
{
|
{
|
||||||
|
ASSERT(psDroid != NULL,
|
||||||
|
"cbNewDroid: no droid assigned for CALL_NEWDROID callback");
|
||||||
|
|
||||||
psScrCBNewDroid = psDroid;
|
psScrCBNewDroid = psDroid;
|
||||||
psScrCBNewDroidFact = psFactory;
|
psScrCBNewDroidFact = psFactory;
|
||||||
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_NEWDROID);
|
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_NEWDROID);
|
||||||
|
|
Loading…
Reference in New Issue