mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-10 08:17:05 +00:00
(svn r25419) -Fix: assign some random other source station to packets which have lost their source
This commit is contained in:
parent
e06ad1dda1
commit
c9452bbbff
@ -450,6 +450,11 @@ bool VehicleCargoList::Stage(bool accepted, StationID current_station, StationID
|
|||||||
assert((cargo_next != next_station || cargo_next == INVALID_STATION) &&
|
assert((cargo_next != next_station || cargo_next == INVALID_STATION) &&
|
||||||
cargo_next != current_station);
|
cargo_next != current_station);
|
||||||
} else {
|
} 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);
|
cargo_next = ge->GetVia(cp->source);
|
||||||
if (cargo_next == INVALID_STATION) {
|
if (cargo_next == INVALID_STATION) {
|
||||||
action = (accepted && cp->source != current_station) ? MTA_DELIVER : MTA_KEEP;
|
action = (accepted && cp->source != current_station) ? MTA_DELIVER : MTA_KEEP;
|
||||||
|
Loading…
Reference in New Issue
Block a user