|
@@ -39,22 +39,22 @@ CargoPacket::CargoPacket()
|
|
|
* @param source_id Actual source of the packet (for subsidies).
|
|
|
* @pre count != 0
|
|
|
* @note We have to zero memory ourselves here because we are using a 'new'
|
|
|
* that, in contrary to all other pools, does not memset to 0.
|
|
|
*/
|
|
|
CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16_t count, SourceType source_type, SourceID source_id) :
|
|
|
feeder_share(0),
|
|
|
count(count),
|
|
|
periods_in_transit(0),
|
|
|
feeder_share(0),
|
|
|
source_xy(source_xy),
|
|
|
loaded_at_xy(0),
|
|
|
source_id(source_id),
|
|
|
source(source),
|
|
|
source_xy(source_xy),
|
|
|
loaded_at_xy(0)
|
|
|
source_type(source_type)
|
|
|
{
|
|
|
assert(count != 0);
|
|
|
this->source_type = source_type;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Creates a new cargo packet. Initializes the fields that cannot be changed later.
|
|
|
* Used when loading or splitting packets.
|
|
|
* @param count Number of cargo entities to put in this packet.
|
|
@@ -66,22 +66,22 @@ CargoPacket::CargoPacket(StationID sourc
|
|
|
* @param source_type 'Type' of source the packet comes from (for subsidies).
|
|
|
* @param source_id Actual source of the packet (for subsidies).
|
|
|
* @note We have to zero memory ourselves here because we are using a 'new'
|
|
|
* that, in contrary to all other pools, does not memset to 0.
|
|
|
*/
|
|
|
CargoPacket::CargoPacket(uint16_t count, uint16_t periods_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),
|
|
|
periods_in_transit(periods_in_transit),
|
|
|
feeder_share(feeder_share),
|
|
|
source_xy(source_xy),
|
|
|
loaded_at_xy(loaded_at_xy),
|
|
|
source_id(source_id),
|
|
|
source(source),
|
|
|
source_xy(source_xy),
|
|
|
loaded_at_xy(loaded_at_xy)
|
|
|
source_type(source_type)
|
|
|
{
|
|
|
assert(count != 0);
|
|
|
this->source_type = source_type;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Split this packet in two and return the split off part.
|
|
|
* @param new_size Size of the split part.
|
|
|
* @return Split off part, or nullptr if no packet could be allocated!
|