23template <
class Tsource,
class Tdest>
26 if (this->max_move < cp->
Count()) {
41template <
class Tsource>
60template <
class Tsource>
63 if (remove == cp->
Count()) {
79bool CargoRemoval<StationCargoList>::operator()(
CargoPacket *cp)
82 this->
source->RemoveFromCache(cp, remove);
93bool CargoRemoval<VehicleCargoList>::operator()(
CargoPacket *cp)
122 if (cp_new ==
nullptr)
return false;
124 this->
source->RemoveFromCache(cp_new, cp_new->
Count());
137 if (cp_new ==
nullptr)
return false;
140 this->
source->RemoveFromCache(cp_new, cp_new->
Count());
153 if (cp_new ==
nullptr) cp_new = cp;
154 assert(cp_new->
Count() <= this->destination->reserved_count);
170 if (cp_new ==
nullptr)
return false;
186 if (cp_new ==
nullptr) cp_new = cp;
200 if (cp_new ==
nullptr) cp_new = cp;
201 StationID next = this->ge->GetVia(cp_new->
GetFirstStation(), this->avoid, this->avoid2);
202 assert(next != this->avoid && next != this->avoid2);
204 this->
source->RemoveFromCache(cp_new, cp_new->
Count());
223 if (cp_new ==
nullptr) cp_new = cp;
Actions to be applied to cargo packets.
CargoPayment * payment
Payment object where payments will be registered.
CargoType cargo
The cargo type of the cargo.
TileIndex current_tile
Current tile cargo delivery is happening.
bool operator()(CargoPacket *cp)
Delivers some cargo.
bool operator()(CargoPacket *cp)
Loads some cargo onto a vehicle.
TileIndex current_tile
Current tile cargo loading is happening.
StationCargoList * source
CargoPacket * Preprocess(CargoPacket *cp)
Decides if a packet needs to be split.
VehicleCargoList * destination
uint Preprocess(CargoPacket *cp)
Determines the amount of cargo to be removed from a packet and removes that from the metadata of the ...
bool Postprocess(CargoPacket *cp, uint remove)
Finalize cargo removal.
VehicleCargoList * source
bool operator()(CargoPacket *cp)
Reserves some cargo for loading.
TileIndex current_tile
Current tile cargo unloading is happening.
bool operator()(CargoPacket *cp)
Returns some reserved cargo.
bool operator()(CargoPacket *cp)
Shifts some cargo from a vehicle to another one.
bool operator()(CargoPacket *cp)
Transfers some cargo from a vehicle to a station.
TileIndex current_tile
Current tile cargo unloading is happening.
bool operator()(CargoPacket *cp)
Reroutes some cargo from one Station sublist to another.
bool operator()(CargoPacket *cp)
Reroutes some cargo in a VehicleCargoList.
Base classes related to the economy.
A number of safeguards to prevent using unsafe methods.
Base classes/functions for stations.
@ Count
by amount of cargo
Definition of base types and functions in a cross-platform compatible way.
Container for cargo from the same location and time.
void Reduce(uint count)
Reduce the packet by the given amount and remove the feeder share.
uint16_t Count() const
Gets the number of 'items' in this packet.
void SetNextHop(StationID next_hop)
Sets the station where the packet is supposed to go next.
CargoPacket * Split(uint new_size)
Split this packet in two and return the split off part.
void UpdateLoadingTile(TileIndex tile)
Update for the cargo being loaded on this tile.
StationID GetNextHop() const
Gets the ID of station the cargo wants to go next.
StationID GetFirstStation() const
Gets the ID of the station where the cargo was loaded for the first time.
void UpdateUnloadingTile(TileIndex tile)
Update for the cargo being unloaded on this tile.