summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lang/english.txt2
-rw-r--r--src/rail_gui.cpp14
-rw-r--r--src/toolbar_gui.cpp7
3 files changed, 21 insertions, 2 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 285fb677b..9cd6458d4 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -4118,3 +4118,5 @@ STR_BUS :{BLACK}{BUS}
STR_LORRY :{BLACK}{LORRY}
STR_PLANE :{BLACK}{PLANE}
STR_SHIP :{BLACK}{SHIP}
+
+STR_TOOLBAR_RAILTYPE_VELOCITY :{STRING} ({VELOCITY})
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 4564ebacb..c30e63017 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -617,6 +617,8 @@ static const RailBuildingGUIButtonData _rail_build_button_data[] = {
* @param clicked_widget Widget clicked in the toolbar
*/
struct BuildRailToolbarWindow : Window {
+ RailType railtype;
+
BuildRailToolbarWindow(const WindowDesc *desc, WindowNumber window_number, RailType railtype) : Window()
{
this->InitNested(desc);
@@ -636,10 +638,11 @@ struct BuildRailToolbarWindow : Window {
*/
void SetupRailToolbar(RailType railtype)
{
+ this->railtype = railtype;
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
assert(railtype < RAILTYPE_END);
- this->GetWidget<NWidgetCore>(RTW_CAPTION)->widget_data = rti->strings.toolbar_caption;
+ this->GetWidget<NWidgetCore>(RTW_CAPTION)->widget_data = rti->max_speed > 0 ? STR_TOOLBAR_RAILTYPE_VELOCITY : STR_JUST_STRING;
this->GetWidget<NWidgetCore>(RTW_BUILD_NS)->widget_data = rti->gui_sprites.build_ns_rail;
this->GetWidget<NWidgetCore>(RTW_BUILD_X)->widget_data = rti->gui_sprites.build_x_rail;
this->GetWidget<NWidgetCore>(RTW_BUILD_EW)->widget_data = rti->gui_sprites.build_ew_rail;
@@ -689,6 +692,15 @@ struct BuildRailToolbarWindow : Window {
}
}
+ virtual void SetStringParameters(int widget) const
+ {
+ if (widget == RTW_CAPTION) {
+ const RailtypeInfo *rti = GetRailTypeInfo(this->railtype);
+ SetDParam(0, rti->strings.toolbar_caption);
+ SetDParam(1, rti->max_speed);
+ }
+ }
+
virtual void OnPaint()
{
this->DrawWidgets();
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 8814f5551..1ac6d1705 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -650,7 +650,12 @@ static void ToolbarBuildRailClick(Window *w)
const RailtypeInfo *rti = GetRailTypeInfo(rt);
/* Skip rail type if it has no label */
if (rti->label == 0) continue;
- list->push_back(new DropDownListStringItem(rti->strings.menu_text, rt, !HasBit(c->avail_railtypes, rt)));
+
+ StringID str = rti->max_speed > 0 ? STR_TOOLBAR_RAILTYPE_VELOCITY : STR_JUST_STRING;
+ DropDownListParamStringItem *item = new DropDownListParamStringItem(str, rt, !HasBit(c->avail_railtypes, rt));
+ item->SetParam(0, rti->strings.menu_text);
+ item->SetParam(1, rti->max_speed);
+ list->push_back(item);
}
ShowDropDownList(w, list, _last_built_railtype, TBN_RAILS, 140, true, true);
SndPlayFx(SND_15_BEEP);