Debug: Show type of current order in vehicle debug info

This commit is contained in:
Jonathan G Rennison
2022-10-30 14:09:50 +00:00
parent 0f852c32d6
commit 6ac311d71e
3 changed files with 26 additions and 2 deletions

View File

@@ -3567,3 +3567,25 @@ void ShiftOrderDates(int interval)
SetWindowClassesDirty(WC_SCHDISPATCH_SLOTS); SetWindowClassesDirty(WC_SCHDISPATCH_SLOTS);
InvalidateWindowClassesData(WC_DEPARTURES_BOARD, 0); 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 "???";
}

View File

@@ -43,4 +43,6 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int
uint16 GetServiceIntervalClamped(uint interval, bool ispercent); uint16 GetServiceIntervalClamped(uint interval, bool ispercent);
bool OrderConditionCompare(OrderConditionComparator occ, int variable, int value); bool OrderConditionCompare(OrderConditionComparator occ, int variable, int value);
const char *GetOrderTypeName(OrderType order_type);
#endif /* ORDER_FUNC_H */ #endif /* ORDER_FUNC_H */

View File

@@ -148,8 +148,8 @@ class NIHVehicle : public NIHelper {
output.print(buffer); output.print(buffer);
if (v->IsPrimaryVehicle()) { if (v->IsPrimaryVehicle()) {
seprintf(buffer, lastof(buffer), " Order indices: real: %u, implicit: %u, tt: %u", 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); v->cur_real_order_index, v->cur_implicit_order_index, v->cur_timetable_order_index, GetOrderTypeName(v->current_order.GetType()));
output.print(buffer); output.print(buffer);
} }
seprintf(buffer, lastof(buffer), " V Cache: max speed: %u, cargo age period: %u, vis effect: %u", seprintf(buffer, lastof(buffer), " V Cache: max speed: %u, cargo age period: %u, vis effect: %u",