summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorstormcone <48624099+stormcone@users.noreply.github.com>2019-04-04 23:06:38 +0200
committerNiels Martin Hansen <nielsm@indvikleren.dk>2020-01-04 18:42:35 +0100
commitb524f1ae21487caf8ed460d8e20a51c3dd7e11a6 (patch)
tree421c770d1ec2d9947200b0d43e404d9a604acc6f /src
parente04ca904a9455afc63aa87db775fe4463ab899b7 (diff)
downloadopenttd-b524f1ae21487caf8ed460d8e20a51c3dd7e11a6.tar.xz
Feature: Show the name of the NewGRF in the build vehicle window.
Diffstat (limited to 'src')
-rw-r--r--src/build_vehicle_gui.cpp8
-rw-r--r--src/lang/english.txt2
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/settings_type.h1
-rw-r--r--src/table/settings.ini9
5 files changed, 21 insertions, 0 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index c457b0f19..c3252f7b9 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -928,6 +928,14 @@ int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number,
/* Additional text from NewGRF */
y = ShowAdditionalText(left, right, y, engine_number);
+ /* The NewGRF's name which the vehicle comes from */
+ const GRFConfig *config = GetGRFConfig(e->GetGRFID());
+ if (_settings_client.gui.show_newgrf_name && config != nullptr)
+ {
+ DrawString(left, right, y, config->GetName(), TC_BLACK);
+ y += FONT_HEIGHT_NORMAL;
+ }
+
return y;
}
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 36d0199ea..d0fa352bd 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1312,6 +1312,8 @@ STR_CONFIG_SETTING_POPULATION_IN_LABEL :Show town popul
STR_CONFIG_SETTING_POPULATION_IN_LABEL_HELPTEXT :Display the population of towns in their label on the map
STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS :Thickness of lines in graphs: {STRING2}
STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS_HELPTEXT :Width of the line in the graphs. A thin line is more precisely readable, a thicker line is easier to see and colours are easier to distinguish
+STR_CONFIG_SETTING_SHOW_NEWGRF_NAME :Show the NewGRF's name in the build vehicle window
+STR_CONFIG_SETTING_SHOW_NEWGRF_NAME_HELPTEXT :Add a line to the build vehicle window, showing which NewGRF the selected vehicle comes from.
STR_CONFIG_SETTING_LANDSCAPE :Landscape: {STRING2}
STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Landscapes define basic gameplay scenarios with different cargos and town growth requirements. NewGRF and Game Scripts allow finer control though
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 187ea2892..fbccc1d43 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1566,6 +1566,7 @@ static SettingsContainer &GetSettingsTree()
interface->Add(new SettingEntry("gui.timetable_in_ticks"));
interface->Add(new SettingEntry("gui.timetable_arrival_departure"));
interface->Add(new SettingEntry("gui.expenses_layout"));
+ interface->Add(new SettingEntry("gui.show_newgrf_name"));
}
SettingsPage *advisors = main->Add(new SettingsPage(STR_CONFIG_SETTING_ADVISORS));
diff --git a/src/settings_type.h b/src/settings_type.h
index 0bc5a1a68..fdb2b0f86 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -145,6 +145,7 @@ struct GUISettings {
uint8 graph_line_thickness; ///< the thickness of the lines in the various graph guis
uint8 osk_activation; ///< Mouse gesture to trigger the OSK.
byte starting_colour; ///< default color scheme for the company to start a new game with
+ bool show_newgrf_name; ///< Show the name of the NewGRF in the build vehicle window
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.
diff --git a/src/table/settings.ini b/src/table/settings.ini
index 3e07fcc59..43bd3aec3 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -3240,6 +3240,15 @@ strhelp = STR_CONFIG_SETTING_GRAPH_LINE_THICKNESS_HELPTEXT
strval = STR_JUST_COMMA
proc = RedrawScreen
+[SDTC_BOOL]
+var = gui.show_newgrf_name
+flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
+def = false
+str = STR_CONFIG_SETTING_SHOW_NEWGRF_NAME
+strhelp = STR_CONFIG_SETTING_SHOW_NEWGRF_NAME_HELPTEXT
+proc = RedrawScreen
+cat = SC_ADVANCED
+
; For the dedicated build we'll enable dates in logs by default.
[SDTC_BOOL]
ifdef = DEDICATED