From 6440440f129041fbb60d25fbfb182a68c82f17a2 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 29 Apr 2007 18:21:24 +0000 Subject: (svn r9752) -Codechange: remove some duplication related to BeginLoading. --- src/vehicle.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/vehicle.cpp') 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); } -- cgit v1.2.3-70-g09d2