From 62a6e9509b9067443899afcf8791e97d48aa8983 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 18 Oct 2009 17:26:10 +0000 Subject: (svn r17804) -Codechange: move the CargoPacket 'invalidation' when stations get removed to CargoPacket. --- src/cargopacket.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/cargopacket.cpp') 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 -- cgit v1.2.3-70-g09d2