summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-04-20 11:39:01 +0000
committermaedhros <maedhros@openttd.org>2007-04-20 11:39:01 +0000
commit034f3591cf6137136333f9769efbcb0bdd03f03c (patch)
treea5b8b18df7be1b5daeef1dc361167da1f60974b1 /src
parent8b65349d86f0bf71af0ec1a9bf1c08cd9adac2ec (diff)
downloadopenttd-034f3591cf6137136333f9769efbcb0bdd03f03c.tar.xz
(svn r9685) -Fix (r9683): Call v->LeaveStation() when a vehicle in a station is sent to a depot.
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/ship_cmd.cpp2
-rw-r--r--src/train_cmd.cpp5
4 files changed, 9 insertions, 2 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index aabe323bd..3950cae50 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -571,6 +571,8 @@ int32 CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
}
if (flags & DC_EXEC) {
+ if (v->current_order.type == OT_LOADING) v->LeaveStation();
+
v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP;
if (!(p2 & DEPOT_SERVICE)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index fada22c84..79fa60847 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -436,6 +436,8 @@ int32 CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (dep == NULL) return_cmd_error(STR_9019_UNABLE_TO_FIND_LOCAL_DEPOT);
if (flags & DC_EXEC) {
+ if (v->current_order.type == OT_LOADING) v->LeaveStation();
+
ClearSlot(v);
v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP;
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 3b67711fc..dd86a960d 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -1065,6 +1065,8 @@ int32 CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (dep == NULL) return_cmd_error(STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT);
if (flags & DC_EXEC) {
+ if (v->current_order.type == OT_LOADING) v->LeaveStation();
+
v->dest_tile = dep->xy;
v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP;
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 8a74ae262..bbdb77547 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1985,6 +1985,8 @@ int32 CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (tfdd.best_length == (uint)-1) return_cmd_error(STR_883A_UNABLE_TO_FIND_ROUTE_TO);
if (flags & DC_EXEC) {
+ if (v->current_order.type == OT_LOADING) v->LeaveStation();
+
v->dest_tile = tfdd.tile;
v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP;
@@ -1993,8 +1995,7 @@ int32 CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->current_order.refit_cargo = CT_INVALID;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
/* If there is no depot in front, reverse automatically */
- if (tfdd.reverse)
- DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
+ if (tfdd.reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
}
return 0;