diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 558db46a06..b7832faf48 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -755,6 +755,16 @@ struct BuildRailToolbarWindow : Window { DeleteWindowByClass(WC_BUILD_BRIDGE); } + virtual void SelectLastTool() + { + // User misplaced something - activate last selected tool again + if (this->last_user_action == WIDGET_LIST_END) + return; + Point dummy = {0, 0}; + this->RaiseWidget(this->last_user_action); + this->OnClick(dummy, this->last_user_action, 0); + } + virtual void OnPlacePresize(Point pt, TileIndex tile_from) { TileIndex tile_to = tile_from; diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index 1cabec456c..d1bea9352c 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -25,6 +25,7 @@ #include "../fileio_func.h" #include "../settings_type.h" #include "../tilehighlight_func.h" +#include "../viewport_func.h" #include "sdl_v.h" #include #ifdef __ANDROID__ @@ -621,7 +622,7 @@ int VideoDriver_SDL::PollEvent() // Two-finger click - hacky way to determine if the right mouse button is already pressed without processing the left button event // Cancel whatewer action we were doing, to allow two finger scrolling ResetObjectToPlace(); - SelectLastTool(); + ToolbarSelectLastTool(); } #endif } else if (ev.button.button == SDL_BUTTON_RIGHT) {