* Remove an order from the order list and delete it. * @param index is the position of the order which is to be deleted. */
| 437 | * @param index is the position of the order which is to be deleted. |
| 438 | */ |
| 439 | void OrderList::DeleteOrderAt(VehicleOrderID index) |
| 440 | { |
| 441 | auto to_remove = std::ranges::next(std::begin(this->orders), index, std::end(this->orders)); |
| 442 | if (to_remove == std::end(this->orders)) return; |
| 443 | |
| 444 | if (!to_remove->IsType(OT_IMPLICIT)) --this->num_manual_orders; |
| 445 | |
| 446 | this->timetable_duration -= (to_remove->GetTimetabledWait() + to_remove->GetTimetabledTravel()); |
| 447 | this->total_duration -= (to_remove->GetWaitTime() + to_remove->GetTravelTime()); |
| 448 | |
| 449 | this->orders.erase(to_remove); |
| 450 | } |
| 451 | |
| 452 | /** |
| 453 | * Move an order to another position within the order list. |
no test coverage detected