summaryrefslogtreecommitdiff
path: root/src/station.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-23 19:43:09 +0000
committersmatz <smatz@openttd.org>2009-05-23 19:43:09 +0000
commit7854e68b95951979445bb485f1d377a358c6d204 (patch)
tree287bcea15d830067e7e4fcd842388e7c0151a1b6 /src/station.cpp
parent4bf70602a116f957ffdbb599d0de6f92a7df0a28 (diff)
downloadopenttd-7854e68b95951979445bb485f1d377a358c6d204.tar.xz
(svn r16407) -Fix [FS#2913]: set CargoPacket::source to INVALID_STATION when source station is deleted
Diffstat (limited to 'src/station.cpp')
-rw-r--r--src/station.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/station.cpp b/src/station.cpp
index b8946aeb4..57c9f150f 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -101,6 +101,12 @@ Station::~Station()
for (CargoID c = 0; c < NUM_CARGO; c++) {
goods[c].cargo.Truncate(0);
}
+
+ CargoPacket *cp;
+ FOR_ALL_CARGOPACKETS(cp) {
+ /* Don't allow cargo packets with invalid source station */
+ if (cp->source == this->index) cp->source = INVALID_STATION;
+ }
}