Add setting to control station rating tooltip detail level

Default to simple
pull/279/head
Jonathan G Rennison 3 years ago
parent e7909b4bee
commit 1cc8053003

@ -1453,6 +1453,12 @@ STR_CONFIG_SETTING_VEHICLE_NAMES_LONG :Long
STR_CONFIG_SETTING_SHADED_TREES_ON_SLOPES :Shade trees on slopes: {STRING2}
STR_CONFIG_SETTING_SHADED_TREES_ON_SLOPES_HELPTEXT :Change brightness of trees drawn on slopes. Improves the look of tree cover in mountainous areas.
STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE :Station rating tooltips: {STRING2}
STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE_HELPTEXT :Set whether station rating tooltips are shown and the level of information detail.
STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE_OFF :Off
STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE_SIMPLE :Simple
STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE_DETAILED :Detailed
STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES :Enable signals on bridges/tunnels advanced modes: {STRING2}
STR_CONFIG_SETTING_ADV_SIG_BRIDGE_TUN_MODES_HELPTEXT :Enables use of advanced modes of signal simulation on bridges and tunnels. When disabled, bridges/tunnels which are not already in an advanced mode cannot be changed to an advanced mode, however other players may choose to enable this setting and use an advanced mode.
@ -6520,39 +6526,40 @@ STR_STATION_RATING_TOOLTIP_NEWGRF_WAITTIME :Time since last
STR_STATION_RATING_MAX_PERCENTAGE : (max {PLUS_NUM}%)
STR_STATION_RATING_MAX_PERCENTAGE_COMMA :, max {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_SPEED :Max speed of last vehicle{STRING1}: {STRING2} ({STRING})
STR_STATION_RATING_TOOLTIP_SPEED_ZERO :{RED}{VELOCITY}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_SPEED_0 :{ORANGE}{VELOCITY}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_SPEED_1 :{GOLD}{VELOCITY}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_SPEED_2 :{YELLOW}{VELOCITY}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_SPEED_3 :{GREEN}{VELOCITY}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_AGE :Age of last vehicle{STRING1}: {STRING2}
STR_STATION_RATING_TOOLTIP_AGE_0 :{ORANGE}{NUM} year{P "" s}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_AGE_1 :{GOLD}{NUM} year{P "" s}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_AGE_2 :{YELLOW}{NUM} year{P "" s}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_AGE_3 :{GREEN}{NUM} year{P "" s}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITTIME :Time since last pickup{STRING1}: {STRING2}
STR_STATION_RATING_TOOLTIP_WAITTIME_SHIP :Time since last pickup{STRING1}: {STRING2} (by ship)
STR_STATION_RATING_TOOLTIP_WAITTIME_0 :{RED}{NUM} day{P "" s}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITTIME_1 :{ORANGE}{NUM} day{P "" s}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITTIME_2 :{GOLD}{NUM} day{P "" s}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITTIME_3 :{YELLOW}{NUM} day{P "" s}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITTIME_4 :{GREEN}{NUM} day{P "" s}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITUNITS :Cargo waiting (on average per next stop{STRING1}): {STRING2}
STR_STATION_RATING_TOOLTIP_WAITUNITS_0 :{RED}{NUM}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITUNITS_1 :{ORANGE}{NUM}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITUNITS_2 :{GOLD}{NUM}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITUNITS_3 :{YELLOW}{NUM}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITUNITS_4 :{YELLOW}{NUM}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_WAITUNITS_5 :{GREEN}{NUM}, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_STATUE :Statue in town{STRING1}: {STRING1}
STR_STATION_RATING_TOOLTIP_STATUE_NO :{GOLD}no, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_STATUE_YES :{GREEN}yes, {PLUS_NUM}%
STR_STATION_RATING_PERCENTAGE_COMMA :, {PLUS_NUM}%
STR_STATION_RATING_TOOLTIP_SPEED :Max speed of last vehicle{STRING1}: {STRING3} ({STRING})
STR_STATION_RATING_TOOLTIP_SPEED_ZERO :{RED}{VELOCITY}{STRING1}
STR_STATION_RATING_TOOLTIP_SPEED_0 :{ORANGE}{VELOCITY}{STRING1}
STR_STATION_RATING_TOOLTIP_SPEED_1 :{GOLD}{VELOCITY}{STRING1}
STR_STATION_RATING_TOOLTIP_SPEED_2 :{YELLOW}{VELOCITY}{STRING1}
STR_STATION_RATING_TOOLTIP_SPEED_3 :{GREEN}{VELOCITY}{STRING1}
STR_STATION_RATING_TOOLTIP_AGE :Age of last vehicle{STRING1}: {STRING3}
STR_STATION_RATING_TOOLTIP_AGE_0 :{ORANGE}{NUM} year{P "" s}{STRING1}
STR_STATION_RATING_TOOLTIP_AGE_1 :{GOLD}{NUM} year{P "" s}{STRING1}
STR_STATION_RATING_TOOLTIP_AGE_2 :{YELLOW}{NUM} year{P "" s}{STRING1}
STR_STATION_RATING_TOOLTIP_AGE_3 :{GREEN}{NUM} year{P "" s}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITTIME :Time since last pickup{STRING1}: {STRING3}
STR_STATION_RATING_TOOLTIP_WAITTIME_SHIP :Time since last pickup{STRING1}: {STRING3} (by ship)
STR_STATION_RATING_TOOLTIP_WAITTIME_0 :{RED}{NUM} day{P "" s}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITTIME_1 :{ORANGE}{NUM} day{P "" s}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITTIME_2 :{GOLD}{NUM} day{P "" s}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITTIME_3 :{YELLOW}{NUM} day{P "" s}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITTIME_4 :{GREEN}{NUM} day{P "" s}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITUNITS :Cargo waiting (on average per next stop{STRING1}): {STRING3}
STR_STATION_RATING_TOOLTIP_WAITUNITS_0 :{RED}{NUM}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITUNITS_1 :{ORANGE}{NUM}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITUNITS_2 :{GOLD}{NUM}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITUNITS_3 :{YELLOW}{NUM}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITUNITS_4 :{YELLOW}{NUM}{STRING1}
STR_STATION_RATING_TOOLTIP_WAITUNITS_5 :{GREEN}{NUM}{STRING1}
STR_STATION_RATING_TOOLTIP_STATUE :Statue in town{STRING1}: {STRING2}
STR_STATION_RATING_TOOLTIP_STATUE_NO :{GOLD}no{STRING1}
STR_STATION_RATING_TOOLTIP_STATUE_YES :{GREEN}yes{STRING1}
STR_STATION_RATING_TOOLTIP_TRAIN :Train
STR_STATION_RATING_TOOLTIP_ROAD_VEHICLE :Road Vehicle

@ -1839,6 +1839,7 @@ static SettingsContainer &GetSettingsTree()
interface->Add(new SettingEntry("gui.show_depot_sell_gui"));
interface->Add(new SettingEntry("gui.open_vehicle_gui_clone_share"));
interface->Add(new SettingEntry("gui.vehicle_names"));
interface->Add(new SettingEntry("gui.station_rating_tooltip_mode"));
}
SettingsPage *advisors = main->Add(new SettingsPage(STR_CONFIG_SETTING_ADVISORS));

@ -220,6 +220,7 @@ struct GUISettings : public TimeSettings {
uint8 linkgraph_colours; ///< linkgraph overlay colours
uint8 vehicle_names; ///< Vehicle naming scheme
bool shade_trees_on_slopes; ///< Shade trees on slopes
uint8 station_rating_tooltip_mode; ///< Station rating tooltip mode
uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity.
uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed.

@ -48,6 +48,12 @@
#include "safeguards.h"
#include "widgets/misc_widget.h"
enum StationRatingTooltipMode {
SRTM_OFF,
SRTM_SIMPLE,
SRTM_DETAILED,
};
/**
* Calculates and draws the accepted or supplied cargo around the selected tile(s)
* @param left x position where the string is to be drawn
@ -1442,7 +1448,8 @@ struct StationViewWindow : public Window {
bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
{
if (widget != WID_SV_ACCEPT_RATING_LIST || this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) {
if (widget != WID_SV_ACCEPT_RATING_LIST || this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON ||
_settings_client.gui.station_rating_tooltip_mode == SRTM_OFF) {
return false;
}
@ -2569,7 +2576,7 @@ void ShowSelectWaypointIfNeeded(const CommandContainer &cmd, TileArea ta)
{
ShowSelectBaseStationIfNeeded<Waypoint>(cmd, ta);
}
static const NWidgetPart _nested_station_rating_tooltip_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, WID_TT_BACKGROUND), SetMinimalSize(64, 32), EndContainer(),
};
@ -2640,13 +2647,15 @@ public:
this->data[1][0] = '\0';
return;
}
uint line_nr = 1;
// Calculate target rating.
bool skip = false;
int total_rating = 0;
const bool detailed = _settings_client.gui.station_rating_tooltip_mode == SRTM_DETAILED;
if (_extra_cheats.station_rating.value) {
total_rating = 255;
skip = true;
@ -2656,7 +2665,7 @@ public:
int new_grf_rating;
this->newgrf_rating_used = GetNewGrfRating(st, cs, ge, &new_grf_rating);
if (this->newgrf_rating_used) {
skip = true;
total_rating += new_grf_rating;
@ -2710,7 +2719,7 @@ public:
const auto speed_rating = GetSpeedRating(ge);
const auto rounded_speed_rating = RoundRating(speed_rating);
SetDParam(0, STR_STATION_RATING_MAX_PERCENTAGE);
SetDParam(0, detailed ? STR_STATION_RATING_MAX_PERCENTAGE : STR_EMPTY);
SetDParam(1, 17);
if (ge->last_speed == 255) {
@ -2724,24 +2733,25 @@ public:
}
SetDParam(3, ge->last_speed);
SetDParam(4, rounded_speed_rating);
SetDParam(4, detailed ? STR_STATION_RATING_PERCENTAGE_COMMA : STR_EMPTY);
SetDParam(5, rounded_speed_rating);
switch (ge->last_vehicle_type)
{
case VEH_TRAIN:
SetDParam(5, STR_STATION_RATING_TOOLTIP_TRAIN);
SetDParam(6, STR_STATION_RATING_TOOLTIP_TRAIN);
break;
case VEH_ROAD:
SetDParam(5, STR_STATION_RATING_TOOLTIP_ROAD_VEHICLE);
SetDParam(6, STR_STATION_RATING_TOOLTIP_ROAD_VEHICLE);
break;
case VEH_SHIP:
SetDParam(5, STR_STATION_RATING_TOOLTIP_SHIP);
SetDParam(6, STR_STATION_RATING_TOOLTIP_SHIP);
break;
case VEH_AIRCRAFT:
SetDParam(5, STR_STATION_RATING_TOOLTIP_AIRCRAFT);
SetDParam(6, STR_STATION_RATING_TOOLTIP_AIRCRAFT);
break;
default:
SetDParam(5, STR_STATION_RATING_TOOLTIP_INVALID);
SetDParam(6, STR_STATION_RATING_TOOLTIP_INVALID);
break;
}
@ -2767,18 +2777,19 @@ public:
wait_time_stage = 1;
}
SetDParam(0, STR_STATION_RATING_MAX_PERCENTAGE);
SetDParam(0, detailed ? STR_STATION_RATING_MAX_PERCENTAGE : STR_EMPTY);
SetDParam(1, 51);
SetDParam(2, STR_STATION_RATING_TOOLTIP_WAITTIME_0 + wait_time_stage);
SetDParam(3, ge->max_waiting_cargo);
SetDParam(4, RoundRating(wait_time_rating));
SetDParam(4, detailed ? STR_STATION_RATING_PERCENTAGE_COMMA : STR_EMPTY);
SetDParam(5, RoundRating(wait_time_rating));
GetString(this->data[line_nr],
(ge->last_vehicle_type == VEH_SHIP) ?
STR_STATION_RATING_TOOLTIP_WAITTIME_SHIP :
STR_STATION_RATING_TOOLTIP_WAITTIME,
lastof(this->data[line_nr]));
line_nr++;
total_rating += wait_time_rating;
}
@ -2800,32 +2811,33 @@ public:
wait_units_stage = 1;
}
SetDParam(0, STR_STATION_RATING_MAX_PERCENTAGE_COMMA);
SetDParam(0, detailed ? STR_STATION_RATING_MAX_PERCENTAGE_COMMA : STR_EMPTY);
SetDParam(1, 16);
SetDParam(2, STR_STATION_RATING_TOOLTIP_WAITUNITS_0 + wait_units_stage);
SetDParam(3, ge->max_waiting_cargo);
SetDParam(4, RoundRating(cargo_rating));
SetDParam(4, detailed ? STR_STATION_RATING_PERCENTAGE_COMMA : STR_EMPTY);
SetDParam(5, RoundRating(cargo_rating));
GetString(this->data[line_nr],
STR_STATION_RATING_TOOLTIP_WAITUNITS,
lastof(this->data[line_nr]));
line_nr++;
total_rating += cargo_rating;
}
}
if (!_extra_cheats.station_rating.value) {
// Statue
{
const auto statue_rating = GetStatueRating(st);
SetDParam(0, STR_STATION_RATING_MAX_PERCENTAGE);
const auto statue_rating = GetStatueRating(st);
if (statue_rating > 0 || detailed) {
SetDParam(0, detailed ? STR_STATION_RATING_MAX_PERCENTAGE : STR_EMPTY);
SetDParam(1, 10);
SetDParam(2, (statue_rating > 0) ? STR_STATION_RATING_TOOLTIP_STATUE_YES : STR_STATION_RATING_TOOLTIP_STATUE_NO);
SetDParam(3, (statue_rating > 0) ? 10 : 0);
SetDParam(3, detailed ? STR_STATION_RATING_PERCENTAGE_COMMA : STR_EMPTY);
SetDParam(4, (statue_rating > 0) ? 10 : 0);
GetString(this->data[line_nr], STR_STATION_RATING_TOOLTIP_STATUE, lastof(this->data[line_nr]));
line_nr++;
total_rating += statue_rating;
}
@ -2842,12 +2854,13 @@ public:
} else if (age_rating >= 10) {
age_stage = 1;
}
SetDParam(0, STR_STATION_RATING_MAX_PERCENTAGE);
SetDParam(0, detailed ? STR_STATION_RATING_MAX_PERCENTAGE : STR_EMPTY);
SetDParam(1, 13);
SetDParam(2, STR_STATION_RATING_TOOLTIP_AGE_0 + age_stage);
SetDParam(3, ge->last_age);
SetDParam(4, RoundRating(age_rating));
SetDParam(4, detailed ? STR_STATION_RATING_PERCENTAGE_COMMA : STR_EMPTY);
SetDParam(5, RoundRating(age_rating));
GetString(this->data[line_nr], STR_STATION_RATING_TOOLTIP_AGE, lastof(this->data[line_nr]));
line_nr++;
@ -2857,9 +2870,11 @@ public:
total_rating = Clamp(total_rating, 0, 255);
SetDParam(0, ToPercent8(total_rating));
GetString(this->data[line_nr], STR_STATION_RATING_TOOLTIP_TOTAL_RATING, lastof(this->data[line_nr]));
line_nr++;
if (detailed) {
SetDParam(0, ToPercent8(total_rating));
GetString(this->data[line_nr], STR_STATION_RATING_TOOLTIP_TOTAL_RATING, lastof(this->data[line_nr]));
line_nr++;
}
this->data[line_nr][0] = '\0';
}
@ -2874,8 +2889,9 @@ public:
if (StrEmpty(this->data[i])) break;
uint width = GetStringBoundingBox(this->data[i]).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT + 2;
if (this->newgrf_rating_used && i >= 2 && i <= 4)
if (this->newgrf_rating_used && i >= 2 && i <= 4) {
width += RATING_TOOLTIP_NEWGRF_INDENT;
}
size->width = std::max(size->width, width);
size->height += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
}
@ -2895,7 +2911,7 @@ public:
const int right0 = r.right - WD_FRAMETEXT_RIGHT - 1;
DrawString(left0, right0, y, this->data[0], TC_LIGHT_BLUE, SA_CENTER);
y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
for (uint i = 1; i <= RATING_TOOLTIP_MAX_LINES; i++) {

@ -5467,6 +5467,19 @@ strhelp = STR_CONFIG_SETTING_SHADED_TREES_ON_SLOPES_HELPTEXT
proc = RedrawScreen
cat = SC_BASIC
[SDTC_VAR]
var = gui.station_rating_tooltip_mode
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_MULTISTRING
def = 1
min = 0
max = 2
str = STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE
strhelp = STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE_HELPTEXT
strval = STR_CONFIG_SETTING_STATION_RATING_TOOLTIP_MODE_OFF
cat = SC_BASIC
; For the dedicated build we'll enable dates in logs by default.
[SDTC_BOOL]
ifdef = DEDICATED

Loading…
Cancel
Save