static */
| 174 | } |
| 175 | |
| 176 | /* static */ ScriptOrder::OrderPosition ScriptOrder::ResolveOrderPosition(VehicleID vehicle_id, OrderPosition order_position) |
| 177 | { |
| 178 | if (!ScriptVehicle::IsPrimaryVehicle(vehicle_id)) return ORDER_INVALID; |
| 179 | |
| 180 | int num_manual_orders = ::Vehicle::Get(vehicle_id)->GetNumManualOrders(); |
| 181 | if (num_manual_orders == 0) return ORDER_INVALID; |
| 182 | |
| 183 | if (order_position == ORDER_CURRENT) { |
| 184 | int cur_order_pos = ::Vehicle::Get(vehicle_id)->cur_real_order_index; |
| 185 | OrderPosition order_pos = ::RealOrderPositionToScriptOrderPosition(vehicle_id, cur_order_pos); |
| 186 | assert(order_pos < num_manual_orders); |
| 187 | return order_pos; |
| 188 | } |
| 189 | return (order_position >= 0 && order_position < num_manual_orders) ? order_position : ORDER_INVALID; |
| 190 | } |
| 191 | |
| 192 | |
| 193 | /* static */ bool ScriptOrder::AreOrderFlagsValid(TileIndex destination, ScriptOrderFlags order_flags) |
nothing calls this directly
no test coverage detected