train_cmd.c
changeset 4510 071bca98c577
parent 4506 0d8fcc0a4e49
child 4519 1437b1e7416c
--- a/train_cmd.c	Fri Sep 01 11:01:44 2006 +0000
+++ b/train_cmd.c	Fri Sep 01 12:37:03 2006 +0000
@@ -1948,6 +1948,17 @@
 	if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
 
 	if (v->current_order.type == OT_GOTO_DEPOT) {
+		if ((p2 & DEPOT_SERVICE) == (bool)HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
+			/* We called with a different DEPOT_SERVICE setting.
+			* Now we change the setting to apply the new one and let the vehicle head for the same depot.
+			* Note: the if is (true for requesting service == true for ordered to stop in depot)          */
+			if (flags & DC_EXEC) {
+				TOGGLEBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
+				InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
+			}
+			return 0;
+		}
+
 		if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders
 		if (flags & DC_EXEC) {
 			if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS)) {