From 31acc42b21105ced6bdc65bbb903cc71d57a99e3 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 6 Oct 2009 21:06:26 +0000 Subject: (svn r17730) -Codechange: do not cache the source of a packet in the cargo list. It's only used for (some) GUI/NewGRF purposes so precalculating it costs more than calculating when it's actually used. --- src/cargopacket.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/cargopacket.h') diff --git a/src/cargopacket.h b/src/cargopacket.h index dd96ed7f0..c5d0bf822 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -166,7 +166,6 @@ private: bool empty; ///< Cache for whether this list is empty or not uint count; ///< Cache for the number of cargo entities Money feeder_share; ///< Cache for the feeder share - StationID source; ///< Cache for the source of the packet uint days_in_transit; ///< Cache for the number of days in transit public: @@ -225,7 +224,7 @@ public: */ FORCEINLINE StationID Source() const { - return this->source; + return this->Empty() ? INVALID_STATION : this->packets.front()->source;; } /** -- cgit v1.2.3-54-g00ecf