diff options
author | fonsinchen <fonsinchen@openttd.org> | 2013-06-15 20:48:50 +0000 |
---|---|---|
committer | fonsinchen <fonsinchen@openttd.org> | 2013-06-15 20:48:50 +0000 |
commit | c9452bbbffbde07dcf357c3c0d2dc5be74214dff (patch) | |
tree | fa70192e7138220bc26f91b1a4df27d01130df57 /src | |
parent | e06ad1dda146018ef18f67a02232bcf735138720 (diff) | |
download | openttd-c9452bbbffbde07dcf357c3c0d2dc5be74214dff.tar.xz |
(svn r25419) -Fix: assign some random other source station to packets which have lost their source
Diffstat (limited to 'src')
-rw-r--r-- | src/cargopacket.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index 2a4c96e82..e2e7e4e4d 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -450,6 +450,11 @@ bool VehicleCargoList::Stage(bool accepted, StationID current_station, StationID assert((cargo_next != next_station || cargo_next == INVALID_STATION) && cargo_next != current_station); } else { + /* Rewrite an invalid source station to some random other one to + * avoid keeping the cargo in the vehicle forever. */ + if (cp->source == INVALID_STATION && !ge->flows.empty()) { + cp->source = ge->flows.begin()->first; + } cargo_next = ge->GetVia(cp->source); if (cargo_next == INVALID_STATION) { action = (accepted && cp->source != current_station) ? MTA_DELIVER : MTA_KEEP; |