0x004B4F6D
| 2883 | |
| 2884 | // 0x004B4F6D |
| 2885 | static void onOrderDelete(Vehicles::VehicleHead* const head, const int16_t orderId) |
| 2886 | { |
| 2887 | // No deletable orders |
| 2888 | if (head->sizeOfOrderTable <= 1) |
| 2889 | { |
| 2890 | return; |
| 2891 | } |
| 2892 | |
| 2893 | // orderId can be -1 at this point for none selected |
| 2894 | auto i = 0; |
| 2895 | const Vehicles::Order* last = nullptr; |
| 2896 | for (const auto& order : getOrderTable(head)) |
| 2897 | { |
| 2898 | if (i == orderId) |
| 2899 | { |
| 2900 | orderDeleteCommand(head, order.getOffset()); |
| 2901 | return; |
| 2902 | } |
| 2903 | last = ℴ |
| 2904 | i++; |
| 2905 | } |
| 2906 | // No order selected so delete the last one |
| 2907 | if (last != nullptr) |
| 2908 | { |
| 2909 | orderDeleteCommand(head, last->getOffset()); |
| 2910 | } |
| 2911 | } |
| 2912 | |
| 2913 | // 0x004B4C14 |
| 2914 | static bool orderUpCommand(Vehicles::VehicleHead* const head, const uint32_t orderOffset) |
no test coverage detected