From b178a94c19ce670063f63a18aca9e48a12ce0fc9 Mon Sep 17 00:00:00 2001 From: smatz Date: Fri, 29 May 2009 15:46:55 +0000 Subject: (svn r16459) -Codechange: move definition of several cargopacket accessors to header file --- src/cargopacket.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/cargopacket.h') diff --git a/src/cargopacket.h b/src/cargopacket.h index 783430221..23203bc04 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -48,7 +48,10 @@ struct CargoPacket : CargoPacketPool::PoolItem<&_cargopacket_pool> { * @param cp the cargo packet to compare to * @return true if and only if days_in_transit and source_xy are equal */ - bool SameSource(const CargoPacket *cp) const; + FORCEINLINE bool SameSource(const CargoPacket *cp) const + { + return this->source_xy == cp->source_xy && this->days_in_transit == cp->days_in_transit && this->paid_for == cp->paid_for; + } }; /** @@ -95,7 +98,7 @@ public: friend const struct SaveLoad *GetGoodsDesc(); /** Create the cargo list */ - CargoList() { this->InvalidateCache(); } + FORCEINLINE CargoList() { this->InvalidateCache(); } /** And destroy it ("frees" all cargo packets) */ ~CargoList(); @@ -103,7 +106,7 @@ public: * Returns a pointer to the cargo packet list (so you can iterate over it etc). * @return pointer to the packet list */ - const CargoList::List *Packets() const; + FORCEINLINE const CargoList::List *Packets() const { return &this->packets; } /** * Ages the all cargo in this list @@ -114,37 +117,37 @@ public: * Checks whether this list is empty * @return true if and only if the list is empty */ - bool Empty() const; + FORCEINLINE bool Empty() const { return this->empty; } /** * Returns the number of cargo entities in this list * @return the before mentioned number */ - uint Count() const; + FORCEINLINE uint Count() const { return this->count; } /** * Is there some cargo that has not been paid for? * @return true if and only if there is such a cargo */ - bool UnpaidCargo() const; + FORCEINLINE bool UnpaidCargo() const { return this->unpaid_cargo; } /** * Returns total sum of the feeder share for all packets * @return the before mentioned number */ - Money FeederShare() const; + FORCEINLINE Money FeederShare() const { return this->feeder_share; } /** * Returns source of the first cargo packet in this list * @return the before mentioned source */ - StationID Source() const; + FORCEINLINE StationID Source() const { return this->source; } /** * Returns average number of days in transit for a cargo entity * @return the before mentioned number */ - uint DaysInTransit() const; + FORCEINLINE uint DaysInTransit() const { return this->days_in_transit; } /** -- cgit v1.2.3-54-g00ecf