summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-09-01 12:37:03 +0000
committerbjarni <bjarni@openttd.org>2006-09-01 12:37:03 +0000
commit26c10adbfce56a9f664d54ba91937846605ee241 (patch)
tree49dc91f6886b9cc2c0c55365e6d1c77e5e9b9bbd
parent168e2b41e5e6e5e0ff79a9f09209dce4e02e2d13 (diff)
downloadopenttd-26c10adbfce56a9f664d54ba91937846605ee241.tar.xz
(svn r6295) -Feature: using goto depot with a different control selection will now alter the service/stopping in depot flag instead of cancelling the goto depot order
-rw-r--r--aircraft_cmd.c11
-rw-r--r--roadveh_cmd.c11
-rw-r--r--ship_cmd.c11
-rw-r--r--train_cmd.c11
4 files changed, 44 insertions, 0 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 26a9bc85f..5ffa59faf 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -512,6 +512,17 @@ int32 CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
+ 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 hangar.
+ * Note: the if is (true for requesting service == true for ordered to stop in hangar) */
+ 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 hangar orders
if (flags & DC_EXEC) {
if (v->current_order.flags & OF_UNLOAD) v->cur_order_index++;
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 9d3488c77..24a433c04 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -382,6 +382,17 @@ int32 CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* If the current orders are already goto-depot */
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 the orders to 'goto depot' are in the orders list (forced servicing),
diff --git a/ship_cmd.c b/ship_cmd.c
index d81b02caa..87faf037c 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -1020,6 +1020,17 @@ int32 CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* If the current orders are already goto-depot */
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 the orders to 'goto depot' are in the orders list (forced servicing),
diff --git a/train_cmd.c b/train_cmd.c
index 603142ca4..a67e4dc63 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1948,6 +1948,17 @@ int32 CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
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)) {