summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx22 <glx@openttd.org>2021-05-23 16:23:33 +0200
committerLoïc Guilloux <glx22@users.noreply.github.com>2021-05-23 21:51:58 +0200
commit7c0762da65e1a568d686505ea5caad729cc659d5 (patch)
treeae0bd04f3a22a66c2a76279812bf8e418f32c8f1
parente99352a5d9dea15f3d405f0551fd1b828124fe62 (diff)
downloadopenttd-7c0762da65e1a568d686505ea5caad729cc659d5.tar.xz
Change: Show what is affected by "wagon removal" toggle
-rw-r--r--src/autoreplace_gui.cpp19
-rw-r--r--src/lang/english.txt3
2 files changed, 20 insertions, 2 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index e04eba302..a4d7bcb7d 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -379,11 +379,14 @@ public:
const Group *g = Group::GetIfValid(this->sel_group);
if (g != nullptr) {
remove_wagon = HasBit(g->flags, GroupFlags::GF_REPLACE_WAGON_REMOVAL);
+ SetDParam(0, STR_GROUP_NAME);
+ SetDParam(1, sel_group);
} else {
const Company *c = Company::Get(_local_company);
remove_wagon = c->settings.renew_keep_length;
+ SetDParam(0, STR_GROUP_DEFAULT_TRAINS + this->window_number);
}
- SetDParam(0, remove_wagon ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
+ SetDParam(2, remove_wagon ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
break;
}
@@ -642,6 +645,20 @@ public:
}
}
+ bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override
+ {
+ if (widget != WID_RV_TRAIN_WAGONREMOVE_TOGGLE) return false;
+
+ if (Group::IsValidID(this->sel_group)) {
+ uint64 params[1];
+ params[0] = STR_REPLACE_REMOVE_WAGON_HELP;
+ GuiShowTooltips(this, STR_REPLACE_REMOVE_WAGON_GROUP_HELP, 1, params, close_cond);
+ } else {
+ GuiShowTooltips(this, STR_REPLACE_REMOVE_WAGON_HELP, 0, nullptr, close_cond);
+ }
+ return true;
+ }
+
void OnResize() override
{
this->vscroll[0]->SetCapacityFromWidget(this, WID_RV_LEFT_MATRIX);
diff --git a/src/lang/english.txt b/src/lang/english.txt
index f38a4e46c..db74c230b 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -3811,8 +3811,9 @@ STR_REPLACE_MAGLEV_VEHICLES :Maglev Vehicles
STR_REPLACE_ROAD_VEHICLES :Road Vehicles
STR_REPLACE_TRAM_VEHICLES :Tramway Vehicles
-STR_REPLACE_REMOVE_WAGON :{BLACK}Wagon removal: {ORANGE}{STRING}
+STR_REPLACE_REMOVE_WAGON :{BLACK}Wagon removal ({STRING1}): {ORANGE}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Make autoreplace keep the length of a train the same by removing wagons (starting at the front), if replacing the engine would make the train longer
+STR_REPLACE_REMOVE_WAGON_GROUP_HELP :{STRING}. Ctrl+Click to also apply to sub-groups
# Vehicle view
STR_VEHICLE_VIEW_CAPTION :{WHITE}{VEHICLE}