mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Move to GetWidgetString for road windows.
parent
039b5a2662
commit
c7846f4629
|
@ -438,18 +438,18 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
this->ReInit();
|
this->ReInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetStringParameters(WidgetID widget) const override
|
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
|
||||||
{
|
{
|
||||||
if (widget == WID_ROT_CAPTION) {
|
if (widget == WID_ROT_CAPTION) {
|
||||||
const RoadTypeInfo *rti = GetRoadTypeInfo(this->roadtype);
|
const RoadTypeInfo *rti = GetRoadTypeInfo(this->roadtype);
|
||||||
if (rti->max_speed > 0) {
|
if (rti->max_speed > 0) {
|
||||||
SetDParam(0, STR_TOOLBAR_RAILTYPE_VELOCITY);
|
return GetString(STR_TOOLBAR_RAILTYPE_VELOCITY, rti->strings.toolbar_caption, PackVelocity(rti->max_speed / 2, VEH_ROAD));
|
||||||
SetDParam(1, rti->strings.toolbar_caption);
|
|
||||||
SetDParam(2, PackVelocity(rti->max_speed / 2, VEH_ROAD));
|
|
||||||
} else {
|
|
||||||
SetDParam(0, rti->strings.toolbar_caption);
|
|
||||||
}
|
}
|
||||||
|
return GetString(rti->strings.toolbar_caption);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this->Window::GetWidgetString(widget, stringid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -902,7 +902,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
static constexpr NWidgetPart _nested_build_road_widgets[] = {
|
static constexpr NWidgetPart _nested_build_road_widgets[] = {
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
|
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
|
||||||
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_ROT_CAPTION), SetStringTip(STR_JUST_STRING2, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE),
|
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_ROT_CAPTION), SetTextStyle(TC_WHITE),
|
||||||
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
|
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
|
|
Loading…
Reference in New Issue