Auto-select last used tool for railroad
This commit is contained in:
@@ -755,6 +755,16 @@ struct BuildRailToolbarWindow : Window {
|
|||||||
DeleteWindowByClass(WC_BUILD_BRIDGE);
|
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)
|
virtual void OnPlacePresize(Point pt, TileIndex tile_from)
|
||||||
{
|
{
|
||||||
TileIndex tile_to = tile_from;
|
TileIndex tile_to = tile_from;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "../fileio_func.h"
|
#include "../fileio_func.h"
|
||||||
#include "../settings_type.h"
|
#include "../settings_type.h"
|
||||||
#include "../tilehighlight_func.h"
|
#include "../tilehighlight_func.h"
|
||||||
|
#include "../viewport_func.h"
|
||||||
#include "sdl_v.h"
|
#include "sdl_v.h"
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#ifdef __ANDROID__
|
#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
|
// 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
|
// Cancel whatewer action we were doing, to allow two finger scrolling
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
SelectLastTool();
|
ToolbarSelectLastTool();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (ev.button.button == SDL_BUTTON_RIGHT) {
|
} else if (ev.button.button == SDL_BUTTON_RIGHT) {
|
||||||
|
|||||||
Reference in New Issue
Block a user