diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index c9e1b92255..a4872c762b 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -3567,3 +3567,25 @@ void ShiftOrderDates(int interval) SetWindowClassesDirty(WC_SCHDISPATCH_SLOTS); InvalidateWindowClassesData(WC_DEPARTURES_BOARD, 0); } + +const char *GetOrderTypeName(OrderType order_type) +{ + static const char *names[] = { + "OT_NOTHING", + "OT_GOTO_STATION", + "OT_GOTO_DEPOT", + "OT_LOADING", + "OT_LEAVESTATION", + "OT_DUMMY", + "OT_GOTO_WAYPOINT", + "OT_CONDITIONAL", + "OT_IMPLICIT", + "OT_WAITING", + "OT_LOADING_ADVANCE", + "OT_RELEASE_SLOT", + "OT_COUNTER", + }; + static_assert(lengthof(names) == OT_END); + if (order_type < OT_END) return names[order_type]; + return "???"; +} diff --git a/src/order_func.h b/src/order_func.h index 649da7e84d..6a9558f075 100644 --- a/src/order_func.h +++ b/src/order_func.h @@ -43,4 +43,6 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int uint16 GetServiceIntervalClamped(uint interval, bool ispercent); bool OrderConditionCompare(OrderConditionComparator occ, int variable, int value); +const char *GetOrderTypeName(OrderType order_type); + #endif /* ORDER_FUNC_H */ diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 3e5aa9b00d..e3595a43c8 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -148,8 +148,8 @@ class NIHVehicle : public NIHelper { output.print(buffer); if (v->IsPrimaryVehicle()) { - seprintf(buffer, lastof(buffer), " Order indices: real: %u, implicit: %u, tt: %u", - v->cur_real_order_index, v->cur_implicit_order_index, v->cur_timetable_order_index); + seprintf(buffer, lastof(buffer), " Order indices: real: %u, implicit: %u, tt: %u, current type: %s", + v->cur_real_order_index, v->cur_implicit_order_index, v->cur_timetable_order_index, GetOrderTypeName(v->current_order.GetType())); output.print(buffer); } seprintf(buffer, lastof(buffer), " V Cache: max speed: %u, cargo age period: %u, vis effect: %u",