mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-10-31 15:20:10 +00:00
Add UI setting to show speed before destination in vehicle status bar
This commit is contained in:
parent
5d7c87f5e4
commit
1e0ff41d33
@ -317,6 +317,9 @@ STR_CONFIG_SETTING_SHOW_VEHICLE_GROUP_HIERARCHY_NAME_HELPTEXT :When enabled, a
|
|||||||
STR_CONFIG_SETTING_SHOW_ORDER_NUMBER_IN_VEHICLE_VIEW :Show order number in vehicle view window: {STRING2}
|
STR_CONFIG_SETTING_SHOW_ORDER_NUMBER_IN_VEHICLE_VIEW :Show order number in vehicle view window: {STRING2}
|
||||||
STR_CONFIG_SETTING_SHOW_ORDER_NUMBER_IN_VEHICLE_VIEW_HELPTEXT :When enabled, the current vehicle order is shown in the vehicle view window start/stop bar
|
STR_CONFIG_SETTING_SHOW_ORDER_NUMBER_IN_VEHICLE_VIEW_HELPTEXT :When enabled, the current vehicle order is shown in the vehicle view window start/stop bar
|
||||||
|
|
||||||
|
STR_CONFIG_SETTING_SHOW_SPEED_FIRST_IN_VEHICLE_VIEW :Show speed before destination in vehicle view window: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_SHOW_SPEED_FIRST_IN_VEHICLE_VIEW_HELPTEXT :When enabled, show the vehicle speed before the destination in the vehicle view window start/stop bar
|
||||||
|
|
||||||
STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION :Hide default order stop locations: {STRING2}
|
STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION :Hide default order stop locations: {STRING2}
|
||||||
STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION_HELPTEXT :When enabled, hide the order stop location when it matches the default.
|
STR_CONFIG_SETTING_HIDE_DEFAULT_STOP_LOCATION_HELPTEXT :When enabled, hide the order stop location when it matches the default.
|
||||||
|
|
||||||
|
@ -2281,6 +2281,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
vehicle_windows->Add(new ConditionallyHiddenSettingEntry("gui.show_vehicle_group_hierarchy_name", []() -> bool { return !_settings_client.gui.show_group_hierarchy_name; }));
|
vehicle_windows->Add(new ConditionallyHiddenSettingEntry("gui.show_vehicle_group_hierarchy_name", []() -> bool { return !_settings_client.gui.show_group_hierarchy_name; }));
|
||||||
vehicle_windows->Add(new SettingEntry("gui.enable_single_veh_shared_order_gui"));
|
vehicle_windows->Add(new SettingEntry("gui.enable_single_veh_shared_order_gui"));
|
||||||
vehicle_windows->Add(new SettingEntry("gui.show_order_number_vehicle_view"));
|
vehicle_windows->Add(new SettingEntry("gui.show_order_number_vehicle_view"));
|
||||||
|
vehicle_windows->Add(new SettingEntry("gui.show_speed_first_vehicle_view"));
|
||||||
vehicle_windows->Add(new SettingEntry("gui.hide_default_stop_location"));
|
vehicle_windows->Add(new SettingEntry("gui.hide_default_stop_location"));
|
||||||
vehicle_windows->Add(new ConditionallyHiddenSettingEntry("gui.show_running_costs_calendar_year", []() -> bool { return GetGameSettings().economy.timekeeping_units != TKU_CALENDAR; }));
|
vehicle_windows->Add(new ConditionallyHiddenSettingEntry("gui.show_running_costs_calendar_year", []() -> bool { return GetGameSettings().economy.timekeeping_units != TKU_CALENDAR; }));
|
||||||
}
|
}
|
||||||
|
@ -314,6 +314,7 @@ struct GUISettings : public TimeSettings {
|
|||||||
bool show_group_hierarchy_name; ///< Show the full hierarchy in group names
|
bool show_group_hierarchy_name; ///< Show the full hierarchy in group names
|
||||||
bool show_vehicle_group_hierarchy_name; ///< Show the full group hierarchy in vehicle names
|
bool show_vehicle_group_hierarchy_name; ///< Show the full group hierarchy in vehicle names
|
||||||
bool show_order_number_vehicle_view; ///< Show order number in vehicle view window
|
bool show_order_number_vehicle_view; ///< Show order number in vehicle view window
|
||||||
|
bool show_speed_first_vehicle_view; ///< Show speed before destination in vehicle view window
|
||||||
bool hide_default_stop_location; ///< Hide default stop location for orders
|
bool hide_default_stop_location; ///< Hide default stop location for orders
|
||||||
bool show_rail_polyline_tool; ///< Show rail polyline tool
|
bool show_rail_polyline_tool; ///< Show rail polyline tool
|
||||||
bool show_running_costs_calendar_year; ///< Show vehicle running costs in calendar years
|
bool show_running_costs_calendar_year; ///< Show vehicle running costs in calendar years
|
||||||
|
@ -1603,6 +1603,14 @@ str = STR_CONFIG_SETTING_SHOW_ORDER_NUMBER_IN_VEHICLE_VIEW
|
|||||||
strhelp = STR_CONFIG_SETTING_SHOW_ORDER_NUMBER_IN_VEHICLE_VIEW_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_SHOW_ORDER_NUMBER_IN_VEHICLE_VIEW_HELPTEXT
|
||||||
post_cb = [](auto) { SetWindowClassesDirty(WC_VEHICLE_VIEW); }
|
post_cb = [](auto) { SetWindowClassesDirty(WC_VEHICLE_VIEW); }
|
||||||
|
|
||||||
|
[SDTC_BOOL]
|
||||||
|
var = gui.show_speed_first_vehicle_view
|
||||||
|
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_PATCH
|
||||||
|
def = false
|
||||||
|
str = STR_CONFIG_SETTING_SHOW_SPEED_FIRST_IN_VEHICLE_VIEW
|
||||||
|
strhelp = STR_CONFIG_SETTING_SHOW_SPEED_FIRST_IN_VEHICLE_VIEW_HELPTEXT
|
||||||
|
post_cb = [](auto) { SetWindowClassesDirty(WC_VEHICLE_VIEW); }
|
||||||
|
|
||||||
[SDTC_BOOL]
|
[SDTC_BOOL]
|
||||||
var = gui.hide_default_stop_location
|
var = gui.hide_default_stop_location
|
||||||
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_PATCH
|
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_PATCH
|
||||||
|
@ -3615,6 +3615,22 @@ static bool IsVehicleRefitable(const Vehicle *v)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static StringID AdjustVehicleViewVelocityStringID(StringID str)
|
||||||
|
{
|
||||||
|
if (_settings_client.gui.show_speed_first_vehicle_view) return str;
|
||||||
|
|
||||||
|
if (str == STR_VEHICLE_STATUS_TRAIN_STOPPING_VEL) return STR_VEHICLE_STATUS_TRAIN_STOPPING_VEL_END;
|
||||||
|
|
||||||
|
static_assert(STR_VEHICLE_STATUS_CANNOT_REACH_DEPOT_SERVICE_VEL_END - STR_VEHICLE_STATUS_HEADING_FOR_STATION_VEL_END ==
|
||||||
|
STR_VEHICLE_STATUS_CANNOT_REACH_DEPOT_SERVICE_VEL - STR_VEHICLE_STATUS_HEADING_FOR_STATION_VEL);
|
||||||
|
|
||||||
|
if (str >= STR_VEHICLE_STATUS_HEADING_FOR_STATION_VEL && str <= STR_VEHICLE_STATUS_CANNOT_REACH_DEPOT_SERVICE_VEL) {
|
||||||
|
return str + STR_VEHICLE_STATUS_HEADING_FOR_STATION_VEL_END - STR_VEHICLE_STATUS_HEADING_FOR_STATION_VEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
/** Window manager class for viewing a vehicle. */
|
/** Window manager class for viewing a vehicle. */
|
||||||
struct VehicleViewWindow : Window {
|
struct VehicleViewWindow : Window {
|
||||||
private:
|
private:
|
||||||
@ -3970,6 +3986,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
str = AdjustVehicleViewVelocityStringID(str);
|
||||||
|
|
||||||
if (_settings_client.gui.show_order_number_vehicle_view && show_order_number && v->cur_implicit_order_index < v->GetNumOrders()) {
|
if (_settings_client.gui.show_order_number_vehicle_view && show_order_number && v->cur_implicit_order_index < v->GetNumOrders()) {
|
||||||
_temp_special_strings[0] = GetString(str);
|
_temp_special_strings[0] = GetString(str);
|
||||||
SetDParam(0, v->cur_implicit_order_index + 1);
|
SetDParam(0, v->cur_implicit_order_index + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user