Reorder struct CargoPacket
Reduce size from 40 bytes to 32 bytes. See: https://github.com/OpenTTD/OpenTTD/pull/11201
This commit is contained in:
@@ -117,16 +117,16 @@ CargoPacket::CargoPacket()
|
|||||||
* that, in contrary to all other pools, does not memset to 0.
|
* that, in contrary to all other pools, does not memset to 0.
|
||||||
*/
|
*/
|
||||||
CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16 count, SourceType source_type, SourceID source_id) :
|
CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16 count, SourceType source_type, SourceID source_id) :
|
||||||
feeder_share(0),
|
|
||||||
count(count),
|
count(count),
|
||||||
days_in_transit(0),
|
days_in_transit(0),
|
||||||
|
feeder_share(0),
|
||||||
source_id(source_id),
|
source_id(source_id),
|
||||||
source(source),
|
|
||||||
source_xy(source_xy),
|
source_xy(source_xy),
|
||||||
loaded_at_xy(0)
|
loaded_at_xy(0),
|
||||||
|
source(source),
|
||||||
|
source_type(source_type)
|
||||||
{
|
{
|
||||||
dbg_assert(count != 0);
|
dbg_assert(count != 0);
|
||||||
this->source_type = source_type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,16 +144,16 @@ CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16 count, So
|
|||||||
* that, in contrary to all other pools, does not memset to 0.
|
* that, in contrary to all other pools, does not memset to 0.
|
||||||
*/
|
*/
|
||||||
CargoPacket::CargoPacket(uint16 count, uint16 days_in_transit, StationID source, TileIndex source_xy, TileIndex loaded_at_xy, Money feeder_share, SourceType source_type, SourceID source_id) :
|
CargoPacket::CargoPacket(uint16 count, uint16 days_in_transit, StationID source, TileIndex source_xy, TileIndex loaded_at_xy, Money feeder_share, SourceType source_type, SourceID source_id) :
|
||||||
feeder_share(feeder_share),
|
|
||||||
count(count),
|
count(count),
|
||||||
days_in_transit(days_in_transit),
|
days_in_transit(days_in_transit),
|
||||||
|
feeder_share(feeder_share),
|
||||||
source_id(source_id),
|
source_id(source_id),
|
||||||
source(source),
|
|
||||||
source_xy(source_xy),
|
source_xy(source_xy),
|
||||||
loaded_at_xy(loaded_at_xy)
|
loaded_at_xy(loaded_at_xy),
|
||||||
|
source(source),
|
||||||
|
source_type(source_type)
|
||||||
{
|
{
|
||||||
dbg_assert(count != 0);
|
dbg_assert(count != 0);
|
||||||
this->source_type = source_type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destroy the packet. */
|
/** Destroy the packet. */
|
||||||
|
@@ -53,18 +53,18 @@ void ChangeOwnershipOfCargoPacketDeferredPayments(Owner old_owner, Owner new_own
|
|||||||
*/
|
*/
|
||||||
struct CargoPacket : CargoPacketPool::PoolItem<&_cargopacket_pool> {
|
struct CargoPacket : CargoPacketPool::PoolItem<&_cargopacket_pool> {
|
||||||
private:
|
private:
|
||||||
Money feeder_share; ///< Value of feeder pickup to be paid for on delivery of cargo.
|
|
||||||
uint16 count; ///< The amount of cargo in this packet.
|
uint16 count; ///< The amount of cargo in this packet.
|
||||||
uint16 days_in_transit; ///< Amount of days this packet has been in transit.
|
uint16 days_in_transit; ///< Amount of days this packet has been in transit.
|
||||||
SourceType source_type; ///< Type of \c source_id.
|
Money feeder_share; ///< Value of feeder pickup to be paid for on delivery of cargo.
|
||||||
SourceID source_id; ///< Index of source, INVALID_SOURCE if unknown/invalid.
|
SourceID source_id; ///< Index of source, INVALID_SOURCE if unknown/invalid.
|
||||||
StationID source; ///< The station where the cargo came from first.
|
|
||||||
TileIndex source_xy; ///< The origin of the cargo (first station in feeder chain).
|
TileIndex source_xy; ///< The origin of the cargo (first station in feeder chain).
|
||||||
union {
|
union {
|
||||||
TileOrStationID loaded_at_xy; ///< Location where this cargo has been loaded into the vehicle.
|
TileOrStationID loaded_at_xy; ///< Location where this cargo has been loaded into the vehicle.
|
||||||
TileOrStationID next_station; ///< Station where the cargo wants to go next.
|
TileOrStationID next_station; ///< Station where the cargo wants to go next.
|
||||||
};
|
};
|
||||||
uint flags = 0; ///< NOSAVE: temporary flags
|
StationID source; ///< The station where the cargo came from first.
|
||||||
|
SourceType source_type; ///< Type of \c source_id.
|
||||||
|
uint8 flags = 0; ///< NOSAVE: temporary flags
|
||||||
|
|
||||||
/** Cargo packet flag bits in CargoPacket::flags. */
|
/** Cargo packet flag bits in CargoPacket::flags. */
|
||||||
enum CargoPacketFlags {
|
enum CargoPacketFlags {
|
||||||
|
Reference in New Issue
Block a user