(svn r20242) -Change: remove the need for "{WHITE}" control codes in some of the railtype NewGRF strings

-Fix: make it possible to properly assess the length of the rail toolbar caption
This commit is contained in:
rubidium 2010-07-30 12:15:22 +00:00
parent 2dd77d0ef9
commit ab47c9dea7
2 changed files with 9 additions and 5 deletions

View File

@ -59,7 +59,7 @@ enum BuildVehicleWidgets {
static const NWidgetPart _nested_build_vehicle_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, BUILD_VEHICLE_WIDGET_CAPTION), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_CAPTION, COLOUR_GREY, BUILD_VEHICLE_WIDGET_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_GREY),
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),

View File

@ -644,7 +644,6 @@ struct BuildRailToolbarWindow : Window {
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
assert(railtype < RAILTYPE_END);
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;
@ -698,8 +697,13 @@ struct BuildRailToolbarWindow : Window {
{
if (widget == RTW_CAPTION) {
const RailtypeInfo *rti = GetRailTypeInfo(this->railtype);
SetDParam(0, rti->strings.toolbar_caption);
SetDParam(1, rti->max_speed);
if (rti->max_speed > 0) {
SetDParam(0, STR_TOOLBAR_RAILTYPE_VELOCITY);
SetDParam(1, rti->strings.toolbar_caption);
SetDParam(2, rti->max_speed);
} else {
SetDParam(0, rti->strings.toolbar_caption);
}
}
}
@ -846,7 +850,7 @@ Hotkey<BuildRailToolbarWindow> *_railtoolbar_hotkeys = BuildRailToolbarWindow::r
static const NWidgetPart _nested_build_rail_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, RTW_CAPTION), SetDataTip(STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, RTW_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
EndContainer(),
NWidget(NWID_HORIZONTAL),