MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / removeOrdersForStation

Function removeOrdersForStation

src/OpenLoco/src/Vehicles/OrderManager.cpp:497–521  ·  view source on GitHub ↗

0x0047062B

Source from the content-addressed store, hash-verified

495
496 // 0x0047062B
497 void removeOrdersForStation(const StationId stationId)
498 {
499 for (auto i = 0U; i < orderTableLength();)
500 {
501 auto& order = orders()[i];
502 auto* stationOrder = order.as<OrderStation>();
503 if (stationOrder != nullptr)
504 {
505 if (stationOrder->getStation() == stationId)
506 {
507 // Find the vehicle that has the order
508 for (auto* head : VehicleManager::VehicleList())
509 {
510 if (head->orderTableOffset <= i
511 && i < head->orderTableOffset + head->sizeOfOrderTable)
512 {
513 deleteOrder(head, i - head->orderTableOffset);
514 break;
515 }
516 }
517 }
518 }
519 i += kOrderSizes[enumValue(order.getType())];
520 }
521 }
522}

Callers 1

deallocateStationFunction · 0.85

Calls 5

ordersFunction · 0.85
deleteOrderFunction · 0.85
enumValueFunction · 0.85
getStationMethod · 0.80
getTypeMethod · 0.45

Tested by

no test coverage detected