[Feature] Added waypoint viewport tooltips.

pull/568/head
RoqueDeicide 11 months ago
parent e612bbeae1
commit c57bfa479a

@ -1420,6 +1420,8 @@ STR_DEPOT_VIEW_WAITING_TOOLTIP :{}{COMMA} {P is
STR_DEPOT_VIEW_FREE_WAGONS_TOOLTIP :{BLACK}{COMMA} wagon{P "" s} inside
STR_DEPOT_VIEW_MIXED_CONTENTS_TOOLTIP :{BLACK}{STRING1}{}{STRING1}
STR_WAYPOINT_VIEW_NAME_TOOLTIP :{WAYPOINT}
STR_STATION_VIEW_NAME_TOOLTIP :{STATION}{NBSP}{STATION_FEATURES}
STR_STATION_VIEW_CARGO_LINE_TOOLTIP :{STRING} ({COMMA}%): {CARGO_SHORT}
@ -2179,6 +2181,12 @@ STR_CONFIG_SETTING_DEPOT_TOOLTIP_MODE_OFF :Off
STR_CONFIG_SETTING_DEPOT_TOOLTIP_MODE_SIMPLE :Simple
STR_CONFIG_SETTING_DEPOT_TOOLTIP_MODE_DETAILED :Detailed
STR_CONFIG_SETTING_WAYPOINT_VIEWPORT_TOOLTIP_NAME :Show viewport tooltips for waypoints and buoys: {STRING2}
STR_CONFIG_SETTING_WAYPOINT_VIEWPORT_TOOLTIP_NAME_HELPTEXT :Show the name of the waypoint or buoy in a viewport tooltip when hovering over it.
STR_CONFIG_SETTING_WAYPOINT_VIEWPORT_TOOLTIP_NAME_OFF :Off
STR_CONFIG_SETTING_WAYPOINT_VIEWPORT_TOOLTIP_NAME_ON_IF_HIDDEN :On, if waypoint names are hidden
STR_CONFIG_SETTING_WAYPOINT_VIEWPORT_TOOLTIP_NAME_ALWAYS_ON :Always on
STR_CONFIG_SETTING_STATION_VIEWPORT_TOOLTIP_NAME :Show names in station viewport tooltips: {STRING2}
STR_CONFIG_SETTING_STATION_VIEWPORT_TOOLTIP_NAME_HELPTEXT :Show the name of the station in a viewport tooltip when hovering over it.
STR_CONFIG_SETTING_STATION_VIEWPORT_TOOLTIP_CARGO :Show cargo details in station viewport tooltips: {STRING2}

@ -1984,6 +1984,7 @@ static SettingsContainer &GetSettingsTree()
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_stockpiled", []() -> bool { return !_settings_client.gui.industry_tooltip_show; }));
tooltips->Add(new ConditionallyHiddenSettingEntry("gui.industry_tooltip_show_produced", []() -> bool { return !_settings_client.gui.industry_tooltip_show; }));
tooltips->Add(new SettingEntry("gui.depot_tooltip_mode"));
tooltips->Add(new SettingEntry("gui.waypoint_viewport_tooltip_name"));
tooltips->Add(new SettingEntry("gui.station_viewport_tooltip_name"));
tooltips->Add(new SettingEntry("gui.station_viewport_tooltip_cargo"));
tooltips->Add(new SettingEntry("gui.station_rating_tooltip_mode"));

@ -147,6 +147,7 @@ struct GUISettings : public TimeSettings {
bool industry_tooltip_show_stockpiled; ///< whether to display cargoes stockpiled by the industry, when hovering over one of its tiles.
bool industry_tooltip_show_produced; ///< whether to display cargoes produced by the industry, when hovering over one of its tiles.
uint8 depot_tooltip_mode; ///< Display mode for depot viewport tooltips. (0 = never, 1 = just a total number of vehicles, 2 = total number of vehicles in the depot along with a breakdown of numbers)
uint8 waypoint_viewport_tooltip_name; ///< Show the name of the waypoint or buoy in a viewport tooltip. (0 = never, 1 = only if waypoint names are hidden, 2 = always)
uint8 station_viewport_tooltip_name; ///< Show the name of the station in a viewport tooltip. (0 = never, 1 = only if station names are hidden, 2 = always)
bool station_viewport_tooltip_cargo; ///< Show a list of cargo details at the station in a viewport tooltip.
uint8 station_rating_tooltip_mode; ///< Station rating tooltip mode

@ -4610,6 +4610,17 @@ str = STR_CONFIG_SETTING_DEPOT_TOOLTIP_MODE
strhelp = STR_CONFIG_SETTING_DEPOT_TOOLTIP_MODE_HELPTEXT
strval = STR_CONFIG_SETTING_DEPOT_TOOLTIP_MODE_OFF
[SDTC_VAR]
var = gui.waypoint_viewport_tooltip_name
type = SLE_UINT8
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_DROPDOWN
def = 1
min = 0
max = 2
str = STR_CONFIG_SETTING_WAYPOINT_VIEWPORT_TOOLTIP_NAME
strhelp = STR_CONFIG_SETTING_WAYPOINT_VIEWPORT_TOOLTIP_NAME_HELPTEXT
strval = STR_CONFIG_SETTING_WAYPOINT_VIEWPORT_TOOLTIP_NAME_OFF
[SDTC_VAR]
var = gui.station_viewport_tooltip_name
type = SLE_UINT8

@ -226,6 +226,12 @@ enum TownNameTooltipMode : uint8 {
TNTM_ALWAYS_ON
};
enum WaypointTooltipNameMode : uint8 {
WTNM_OFF,
WTNM_ON_IF_HIDDEN,
WTNM_ALWAYS_ON
};
enum StationTooltipNameMode : uint8 {
STNM_OFF,
STNM_ON_IF_HIDDEN,
@ -266,6 +272,15 @@ void ShowTownNameTooltip(Window *w, const TileIndex tile)
GuiShowTooltips(w, tooltip_string, 0, nullptr, TCC_HOVER_VIEWPORT);
}
void ShowWaypointViewportTooltip(Window *w, const TileIndex tile)
{
if (_settings_client.gui.waypoint_viewport_tooltip_name == WTNM_OFF ||
(_settings_client.gui.waypoint_viewport_tooltip_name == WTNM_ON_IF_HIDDEN && HasBit(_display_opt, DO_SHOW_WAYPOINT_NAMES))) return;
SetDParam(0, GetStationIndex(tile));
GuiShowTooltips(w, STR_WAYPOINT_VIEW_NAME_TOOLTIP, 0, nullptr, TCC_HOVER_VIEWPORT);
}
void ShowStationViewportTooltip(Window *w, const TileIndex tile)
{
const StationID station_id = GetStationIndex(tile);
@ -336,6 +351,8 @@ void ShowTooltipForTile(Window *w, const TileIndex tile)
case MP_STATION: {
if (IsHangar(tile)) {
ShowDepotTooltip(w, tile);
} else if (IsBuoy(tile) || IsRailWaypoint(tile) || IsRoadWaypoint(tile)) {
ShowWaypointViewportTooltip(w, tile);
} else {
ShowStationViewportTooltip(w, tile);
}

Loading…
Cancel
Save