Reorder struct CargoPacket

Reduce size from 40 bytes to 32 bytes.
See: https://github.com/OpenTTD/OpenTTD/pull/11201
pull/595/head
Jonathan G Rennison 9 months ago
parent fabe507b08
commit bd378a2842

@ -117,16 +117,16 @@ CargoPacket::CargoPacket()
* 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) :
feeder_share(0),
count(count),
days_in_transit(0),
feeder_share(0),
source_id(source_id),
source(source),
source_xy(source_xy),
loaded_at_xy(0)
loaded_at_xy(0),
source(source),
source_type(source_type)
{
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.
*/
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),
days_in_transit(days_in_transit),
feeder_share(feeder_share),
source_id(source_id),
source(source),
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);
this->source_type = source_type;
}
/** Destroy the packet. */

@ -53,18 +53,18 @@ void ChangeOwnershipOfCargoPacketDeferredPayments(Owner old_owner, Owner new_own
*/
struct CargoPacket : CargoPacketPool::PoolItem<&_cargopacket_pool> {
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 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.
StationID source; ///< The station where the cargo came from first.
TileIndex source_xy; ///< The origin of the cargo (first station in feeder chain).
union {
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.
};
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. */
enum CargoPacketFlags {

Loading…
Cancel
Save