summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-04-29 18:21:24 +0000
committerrubidium <rubidium@openttd.org>2007-04-29 18:21:24 +0000
commit6440440f129041fbb60d25fbfb182a68c82f17a2 (patch)
tree87b202dc9547deba8ff9f14dc895001e6404777e /src/vehicle.cpp
parentbf04c88ecad4d4a183ebf8461f1d58fa57d658ae (diff)
downloadopenttd-6440440f129041fbb60d25fbfb182a68c82f17a2.tar.xz
(svn r9752) -Codechange: remove some duplication related to BeginLoading.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 90ee45ad6..dccebcd5d 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2950,6 +2950,24 @@ extern const ChunkHandler _veh_chunk_handlers[] = {
void Vehicle::BeginLoading()
{
assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
+
+ if (this->current_order.type == OT_GOTO_STATION &&
+ this->current_order.dest == this->last_station_visited) {
+ /* Arriving at the ordered station.
+ * Keep the load/unload flags, as we (obviously) still need them. */
+ this->current_order.flags &= OF_FULL_LOAD | OF_UNLOAD | OF_TRANSFER;
+
+ /* Furthermore add the Non Stop flag to mark that this station
+ * is the actual destination of the vehicle, which is (for example)
+ * necessary to be known for HandleTrainLoading to determine
+ * whether the train is lost or not; not marking a train lost
+ * that arrives at random stations is bad. */
+ this->current_order.flags |= OF_NON_STOP;
+ } else {
+ /* This is just an unordered intermediate stop */
+ this->current_order.flags = 0;
+ }
+
current_order.type = OT_LOADING;
GetStation(this->last_station_visited)->loading_vehicles.push_back(this);
}