(svn r14601) -Fix: the nearest depot and stop in depot orders didn't work together (the vehicle didn't stop).
authorrubidium
Fri, 21 Nov 2008 18:16:19 +0000
changeset 10350 a0b562efddd1
parent 10349 c733b3e4f97b
child 10351 86488e727dce
(svn r14601) -Fix: the nearest depot and stop in depot orders didn't work together (the vehicle didn't stop).
src/order_base.h
src/order_cmd.cpp
--- a/src/order_base.h	Thu Nov 20 18:44:13 2008 +0000
+++ b/src/order_base.h	Fri Nov 21 18:16:19 2008 +0000
@@ -84,10 +84,11 @@
 	 * Makes this order a Go To Depot order.
 	 * @param destination the depot to go to.
 	 * @param order       is this order a 'default' order, or an overriden vehicle order?
+	 * @param action      what to do in the depot?
 	 * @param cargo       the cargo type to change to.
 	 * @param subtype     the subtype to change to.
 	 */
-	void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, CargoID cargo = CT_NO_REFIT, byte subtype = 0);
+	void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderDepotActionFlags action = ODATF_SERVICE_ONLY, CargoID cargo = CT_NO_REFIT, byte subtype = 0);
 
 	/**
 	 * Makes this order a Go To Waypoint order.
--- a/src/order_cmd.cpp	Thu Nov 20 18:44:13 2008 +0000
+++ b/src/order_cmd.cpp	Fri Nov 21 18:16:19 2008 +0000
@@ -57,11 +57,11 @@
 	this->dest = destination;
 }
 
-void Order::MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, CargoID cargo, byte subtype)
+void Order::MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderDepotActionFlags action, CargoID cargo, byte subtype)
 {
 	this->type = OT_GOTO_DEPOT;
-	this->flags = 0;
 	this->SetDepotOrderType(order);
+	this->SetDepotActionType(action);
 	if (!(order & ODTFB_PART_OF_ORDERS)) {
 		this->SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 	}
@@ -1623,7 +1623,7 @@
 
 				if (v->FindClosestDepot(&location, &destination, &reverse)) {
 					v->dest_tile = location;
-					v->current_order.MakeGoToDepot(destination, v->current_order.GetDepotOrderType(), v->current_order.GetRefitCargo(), v->current_order.GetRefitSubtype());
+					v->current_order.MakeGoToDepot(destination, v->current_order.GetDepotOrderType(), (OrderDepotActionFlags)(v->current_order.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT), v->current_order.GetRefitCargo(), v->current_order.GetRefitSubtype());
 
 					/* If there is no depot in front, reverse automatically (trains only) */
 					if (v->type == VEH_TRAIN && reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);