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

Method DeleteOrderAt

src/order_cmd.cpp:439–450  ·  view source on GitHub ↗

* Remove an order from the order list and delete it. * @param index is the position of the order which is to be deleted. */

Source from the content-addressed store, hash-verified

437 * @param index is the position of the order which is to be deleted.
438 */
439void 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.

Callers 1

DeleteOrderFunction · 0.80

Calls 8

IsTypeMethod · 0.80
GetTimetabledWaitMethod · 0.80
GetTimetabledTravelMethod · 0.80
GetWaitTimeMethod · 0.80
GetTravelTimeMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
eraseMethod · 0.45

Tested by

no test coverage detected