Debug: Show type of current order in vehicle debug info

pull/451/head
Jonathan G Rennison 2 years ago
parent 0f852c32d6
commit 6ac311d71e

@ -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 "???";
}

@ -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 */

@ -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",

Loading…
Cancel
Save