MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / Truncate

Method Truncate

src/cargopacket.cpp:648–653  ·  view source on GitHub ↗

* Truncates the cargo in this list to the given amount. It leaves the * first cargo entities and removes max_move from the back of the list. * @param max_move Maximum amount of entities to be removed from the list. * @return Amount of entities actually moved. */

Source from the content-addressed store, hash-verified

646 * @return Amount of entities actually moved.
647 */
648uint VehicleCargoList::Truncate(uint max_move)
649{
650 max_move = std::min(this->count, max_move);
651 this->PopCargo(CargoRemoval<VehicleCargoList>(this, max_move));
652 return max_move;
653}
654
655/**
656 * Routes packets with station "avoid" as next hop to a different place.

Callers 8

CheckCargoCapacityFunction · 0.80
ConsistChangedMethod · 0.80
PreDestructorMethod · 0.80
TruncateCargoFunction · 0.80
RefitVehicleFunction · 0.80
CrashAirplaneFunction · 0.80
MaybeCrashAirplaneFunction · 0.80
~StationMethod · 0.80

Calls 7

PopCargoMethod · 0.95
RandomRangeFunction · 0.85
RemoveFromCacheMethod · 0.80
ReduceMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected