summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cargopacket.cpp40
-rw-r--r--src/cargopacket.h21
2 files changed, 12 insertions, 49 deletions
diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp
index b2ce7ed3b..9a6b9b6c0 100644
--- a/src/cargopacket.cpp
+++ b/src/cargopacket.cpp
@@ -29,11 +29,6 @@ CargoPacket::CargoPacket(StationID source, uint16 count)
this->paid_for = false;
}
-bool CargoPacket::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;
-}
-
/*
*
* Cargo list implementation
@@ -48,11 +43,6 @@ CargoList::~CargoList()
}
}
-const CargoList::List *CargoList::Packets() const
-{
- return &packets;
-}
-
void CargoList::AgeCargo()
{
if (empty) return;
@@ -65,36 +55,6 @@ void CargoList::AgeCargo()
days_in_transit = dit / count;
}
-bool CargoList::Empty() const
-{
- return empty;
-}
-
-uint CargoList::Count() const
-{
- return count;
-}
-
-bool CargoList::UnpaidCargo() const
-{
- return unpaid_cargo;
-}
-
-Money CargoList::FeederShare() const
-{
- return feeder_share;
-}
-
-StationID CargoList::Source() const
-{
- return source;
-}
-
-uint CargoList::DaysInTransit() const
-{
- return days_in_transit;
-}
-
void CargoList::Append(CargoPacket *cp)
{
assert(cp != NULL);
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; }
/**