mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r16459) -Codechange: move definition of several cargopacket accessors to header file
This commit is contained in:
parent
1ad410dc00
commit
b178a94c19
@ -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);
|
||||
|
@ -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; }
|
||||
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user