Permalink
Browse files

Make sure hold order holds for more actions.

Should hold for fix repair, restore and observe.
  • Loading branch information...
perim committed Nov 11, 2017
1 parent c01f2db commit 561bbbc7653927d9326a43657648ccec9a2a34d7
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/action.cpp
View
@@ -2039,7 +2039,7 @@ static void actionDroidBase(DROID *psDroid, DROID_ACTION_DATA *psAction)
moveDroidTo(psDroid, psAction->x, psAction->y);
break;
case DACTION_REPAIR:
psDroid->action = DACTION_MOVETOREPAIR;
psDroid->action = psAction->action;
psDroid->actionPos.x = psAction->x;
psDroid->actionPos.y = psAction->y;
//this needs setting so that automatic repair works
@@ -2054,6 +2054,7 @@ static void actionDroidBase(DROID *psDroid, DROID_ACTION_DATA *psAction)
}
break;
case DACTION_OBSERVE:
psDroid->action = psAction->action;
setDroidActionTarget(psDroid, psAction->psObj, 0);
psDroid->actionPos.x = psDroid->pos.x;
psDroid->actionPos.y = psDroid->pos.y;
@@ -2104,7 +2105,7 @@ static void actionDroidBase(DROID *psDroid, DROID_ACTION_DATA *psAction)
ensureRearmPadClear((STRUCTURE *)psAction->psObj, psDroid);
break;
case DACTION_DROIDREPAIR:
psDroid->action = DACTION_MOVETODROIDREPAIR;
psDroid->action = psAction->action;
psDroid->actionPos.x = psAction->x;
psDroid->actionPos.y = psAction->y;
setDroidActionTarget(psDroid, psAction->psObj, 0);
@@ -2119,13 +2120,17 @@ static void actionDroidBase(DROID *psDroid, DROID_ACTION_DATA *psAction)
break;
case DACTION_RESTORE:
ASSERT_OR_RETURN(, order->type == DORDER_RESTORE, "cannot start restore action without a restore order");
psDroid->action = DACTION_MOVETORESTORE;
psDroid->action = psAction->action;
psDroid->actionPos.x = psAction->x;
psDroid->actionPos.y = psAction->y;
ASSERT_OR_RETURN(, (order->psObj != nullptr) && (order->psObj->type == OBJ_STRUCTURE), "invalid target for restore order");
order->psStats = ((STRUCTURE *)order->psObj)->pStructureType;
setDroidActionTarget(psDroid, psAction->psObj, 0);
moveDroidTo(psDroid, psAction->x, psAction->y);
if (order->type != DORDER_HOLD)
{
psDroid->action = DACTION_MOVETORESTORE;
moveDroidTo(psDroid, psAction->x, psAction->y);
}
break;
default:
ASSERT(!"unknown action", "actionUnitBase: unknown action");

0 comments on commit 561bbbc

Please sign in to comment.