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

Method ShiftCargo

src/cargopacket.cpp:290–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288 */
289template <class Taction>
290void VehicleCargoList::ShiftCargo(Taction action)
291{
292 Iterator it(this->packets.begin());
293 while (it != this->packets.end() && action.MaxMove() > 0) {
294 CargoPacket *cp = *it;
295 if (action(cp)) {
296 it = this->packets.erase(it);
297 } else {
298 break;
299 }
300 }
301}
302
303/**
304 * Pops cargo from the back of the packet list and applies some action to it.

Callers 4

UnloadMethod · 0.95
RerouteMethod · 0.95
ReserveMethod · 0.80
LoadMethod · 0.80

Calls 6

InvalidFunction · 0.85
equal_rangeMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
MaxMoveMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected