From e7d21956768ffb617542945dc0014c9d8c98e0c3 Mon Sep 17 00:00:00 2001
From: johns <>
Date: Mon, 19 Feb 2001 17:29:43 +0000
Subject: [PATCH] Fixed bug: Unit didn't return to old place.

---
 src/action/action_still.cpp | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/action/action_still.cpp b/src/action/action_still.cpp
index c345942c2..c68b52a72 100644
--- a/src/action/action_still.cpp
+++ b/src/action/action_still.cpp
@@ -92,7 +92,7 @@ global void ActionStillGeneric(Unit* unit,int ground)
 #ifdef NEW_ORDERS
 	    unit->Frame=unit->Data.Resource.Active ? 2 : 0;
 #else
-	    unit->Frame=unit->Command.Data.OilWell.Active ? 2 : 0;
+	    unit->Frame=unit->Command.Data.Resource.Active ? 2 : 0;
 #endif
 	}
     }
@@ -170,17 +170,24 @@ global void ActionStillGeneric(Unit* unit,int ground)
 	if( !type->Tower && !ground ) {
 	    if( (goal=AttackUnitsInReactRange(unit)) ) {
 		// Weak goal, can choose other unit, come back after attack
-		// FIXME: should rewrite command handling
-		CommandAttack(unit,unit->X,unit->Y,NULL,FlushCommands);
-#ifdef NEW_ORDERS
-		unit->SavedOrder=unit->Orders[1];
-#else
-		unit->SavedCommand=unit->NextCommand[0];
-		unit->SavedCommand.Action=UnitActionAttack;
-#endif
 		CommandAttack(unit,goal->X,goal->Y,NULL,FlushCommands);
-		DebugLevel3Fn(" %Zd Attacking in range %d\n"
+		DebugLevel2Fn(" %Zd Attacking in range %d\n"
 			,UnitNumber(unit),unit->SubAction);
+#ifdef NEW_ORDERS
+		unit->SavedOrder.Action=UnitActionAttack;
+		unit->SavedOrder.RangeX=unit->SavedOrder.RangeY=0;
+		unit->SavedOrder.X=unit->X;
+		unit->SavedOrder.Y=unit->Y;
+		unit->SavedOrder.Goal=NoUnitP;
+		ResetPath(unit->SavedOrder);
+#else
+		unit->SavedCommand.Action=UnitActionAttack;
+		unit->SavedCommand.Data.Move.Range=0;
+		unit->SavedCommand.Data.Move.DX=unit->X;
+		unit->SavedCommand.Data.Move.DY=unit->Y;
+		unit->SavedCommand.Data.Move.Goal=NoUnitP;
+		ResetPath(unit->SavedCommand);
+#endif
 		unit->SubAction|=2;
 	    }
 	} else if( (goal=AttackUnitsInRange(unit)) ) {