When canceling or completing build orders, make sure we clear the complete droid

state, otherwise other parts of the code can become confused and think they are busy.


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9748 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2010-02-08 20:45:38 +00:00 committed by Git SVN Gateway
parent a2b0a70764
commit 0da62cbc99
2 changed files with 10 additions and 3 deletions

View File

@ -120,6 +120,9 @@ void droidUpdateRecoil( DROID *psDroid );
static void cancelBuild(DROID *psDroid)
{
psDroid->action = DACTION_NONE;
psDroid->order = DORDER_NONE;
setDroidTarget(psDroid, NULL);
setDroidActionTarget(psDroid, NULL, 0);
/* Notify scripts we just became idle */
psScrCBOrderDroid = psDroid;

View File

@ -1196,14 +1196,15 @@ void structureBuild(STRUCTURE *psStruct, DROID *psDroid, int buildPoints)
intRefreshScreen(); // update any open interface bars.
}
/* Not needed, but left for backward compatibility */
structureCompletedCallback(psStruct->pStructureType);
/* must reset here before the callback, droid must have DACTION_NONE
in order to be able to start a new built task, doubled in actionUpdateDroid() */
if (psDroid)
{
psDroid->action = DACTION_NONE;
psDroid->order = DORDER_NONE;
setDroidTarget(psDroid, NULL);
setDroidActionTarget(psDroid, NULL, 0);
psDroid->psTarStats = NULL;
/* Notify scripts we just finished building a structure, pass builder and what was built */
psScrCBNewStruct = psStruct;
@ -1212,6 +1213,9 @@ void structureBuild(STRUCTURE *psStruct, DROID *psDroid, int buildPoints)
audio_StopObjTrack( psDroid, ID_SOUND_CONSTRUCTION_LOOP );
}
/* Not needed, but left for backward compatibility */
structureCompletedCallback(psStruct->pStructureType);
}
else
{