summaryrefslogtreecommitdiff
path: root/src/cargopacket.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-10-18 17:26:10 +0000
committerrubidium <rubidium@openttd.org>2009-10-18 17:26:10 +0000
commit62a6e9509b9067443899afcf8791e97d48aa8983 (patch)
tree4c288501328daf29cc914d608289b75efa642973 /src/cargopacket.cpp
parent41037308c09239e901c6160b31292af2eab2f918 (diff)
downloadopenttd-62a6e9509b9067443899afcf8791e97d48aa8983.tar.xz
(svn r17804) -Codechange: move the CargoPacket 'invalidation' when stations get removed to CargoPacket.
Diffstat (limited to 'src/cargopacket.cpp')
-rw-r--r--src/cargopacket.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp
index 313e7db4f..e9b3f5064 100644
--- a/src/cargopacket.cpp
+++ b/src/cargopacket.cpp
@@ -62,6 +62,18 @@ CargoPacket::CargoPacket(uint16 count, byte days_in_transit, Money feeder_share,
}
}
+/**
+ * Invalidates (sets source to INVALID_STATION) all cargo packets from given station
+ * @param sid the station that gets removed
+ */
+/* static */ void CargoPacket::InvalidateAllFrom(StationID sid)
+{
+ CargoPacket *cp;
+ FOR_ALL_CARGOPACKETS(cp) {
+ if (cp->source == sid) cp->source_id = INVALID_SOURCE;
+ }
+}
+
/*
*
* Cargo list implementation