|
@@ -66,79 +66,79 @@ public:
|
|
|
void Merge(CargoPacket *cp);
|
|
|
|
|
|
/**
|
|
|
* Gets the number of 'items' in this packet.
|
|
|
* @return Item count.
|
|
|
*/
|
|
|
FORCEINLINE uint16 Count() const
|
|
|
inline uint16 Count() const
|
|
|
{
|
|
|
return this->count;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Gets the amount of money already paid to earlier vehicles in
|
|
|
* the feeder chain.
|
|
|
* @return Feeder share.
|
|
|
*/
|
|
|
FORCEINLINE Money FeederShare() const
|
|
|
inline Money FeederShare() const
|
|
|
{
|
|
|
return this->feeder_share;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Gets the number of days this cargo has been in transit.
|
|
|
* This number isn't really in days, but in 2.5 days (CARGO_AGING_TICKS = 185 ticks) and
|
|
|
* it is capped at 255.
|
|
|
* @return Length this cargo has been in transit.
|
|
|
*/
|
|
|
FORCEINLINE byte DaysInTransit() const
|
|
|
inline byte DaysInTransit() const
|
|
|
{
|
|
|
return this->days_in_transit;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Gets the type of the cargo's source. industry, town or head quarter.
|
|
|
* @return Source type.
|
|
|
*/
|
|
|
FORCEINLINE SourceType SourceSubsidyType() const
|
|
|
inline SourceType SourceSubsidyType() const
|
|
|
{
|
|
|
return this->source_type;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Gets the ID of the cargo's source. An IndustryID, TownID or CompanyID.
|
|
|
* @return Source ID.
|
|
|
*/
|
|
|
FORCEINLINE SourceID SourceSubsidyID() const
|
|
|
inline SourceID SourceSubsidyID() const
|
|
|
{
|
|
|
return this->source_id;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Gets the ID of the station where the cargo was loaded for the first time.
|
|
|
* @return StationID.
|
|
|
*/
|
|
|
FORCEINLINE SourceID SourceStation() const
|
|
|
inline SourceID SourceStation() const
|
|
|
{
|
|
|
return this->source;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Gets the coordinates of the cargo's source station.
|
|
|
* @return Source station's coordinates.
|
|
|
*/
|
|
|
FORCEINLINE TileIndex SourceStationXY() const
|
|
|
inline TileIndex SourceStationXY() const
|
|
|
{
|
|
|
return this->source_xy;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Gets the coordinates of the cargo's last loading station.
|
|
|
* @return Last loading station's coordinates.
|
|
|
*/
|
|
|
FORCEINLINE TileIndex LoadedAtXY() const
|
|
|
inline TileIndex LoadedAtXY() const
|
|
|
{
|
|
|
return this->loaded_at_xy;
|
|
|
}
|
|
|
|
|
|
|
|
|
static void InvalidateAllFrom(SourceType src_type, SourceID src);
|
|
@@ -200,49 +200,49 @@ public:
|
|
|
void OnCleanPool();
|
|
|
|
|
|
/**
|
|
|
* Returns a pointer to the cargo packet list (so you can iterate over it etc).
|
|
|
* @return Pointer to the packet list.
|
|
|
*/
|
|
|
FORCEINLINE const List *Packets() const
|
|
|
inline const List *Packets() const
|
|
|
{
|
|
|
return &this->packets;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Checks whether this list is empty.
|
|
|
* @return True if and only if the list is empty.
|
|
|
*/
|
|
|
FORCEINLINE bool Empty() const
|
|
|
inline bool Empty() const
|
|
|
{
|
|
|
return this->count == 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Returns the number of cargo entities in this list.
|
|
|
* @return The before mentioned number.
|
|
|
*/
|
|
|
FORCEINLINE uint Count() const
|
|
|
inline uint Count() const
|
|
|
{
|
|
|
return this->count;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Returns source of the first cargo packet in this list.
|
|
|
* @return The before mentioned source.
|
|
|
*/
|
|
|
FORCEINLINE StationID Source() const
|
|
|
inline StationID Source() const
|
|
|
{
|
|
|
return this->Empty() ? INVALID_STATION : this->packets.front()->source;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Returns average number of days in transit for a cargo entity.
|
|
|
* @return The before mentioned number.
|
|
|
*/
|
|
|
FORCEINLINE uint DaysInTransit() const
|
|
|
inline uint DaysInTransit() const
|
|
|
{
|
|
|
return this->count == 0 ? 0 : this->cargo_days_in_transit / this->count;
|
|
|
}
|
|
|
|
|
|
|
|
|
void Append(CargoPacket *cp);
|
|
@@ -274,13 +274,13 @@ public:
|
|
|
friend const struct SaveLoad *GetVehicleDescription(VehicleType vt);
|
|
|
|
|
|
/**
|
|
|
* Returns total sum of the feeder share for all packets.
|
|
|
* @return The before mentioned number.
|
|
|
*/
|
|
|
FORCEINLINE Money FeederShare() const
|
|
|
inline Money FeederShare() const
|
|
|
{
|
|
|
return this->feeder_share;
|
|
|
}
|
|
|
|
|
|
void AgeCargo();
|
|
|
|