summaryrefslogtreecommitdiff
path: root/src/cargopacket.h
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-29 15:46:55 +0000
committersmatz <smatz@openttd.org>2009-05-29 15:46:55 +0000
commitb178a94c19ce670063f63a18aca9e48a12ce0fc9 (patch)
treeb9f1d5da020550f5f9621981e7b8a54183f543ee /src/cargopacket.h
parent1ad410dc009991c511974c9d1794dbf087276b50 (diff)
downloadopenttd-b178a94c19ce670063f63a18aca9e48a12ce0fc9.tar.xz
(svn r16459) -Codechange: move definition of several cargopacket accessors to header file
Diffstat (limited to 'src/cargopacket.h')
-rw-r--r--src/cargopacket.h21
1 files changed, 12 insertions, 9 deletions
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; }
/**