| 288 | */ |
| 289 | template <class Taction> |
| 290 | void 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. |