Select last tool for waterways and terraform toolbars

This commit is contained in:
Sergii Pylypenko
2014-11-14 20:56:06 +02:00
parent ebe0f379a8
commit 4f77c25546
2 changed files with 20 additions and 0 deletions

View File

@@ -282,6 +282,16 @@ struct BuildDocksToolbarWindow : Window {
DeleteWindowByClass(WC_BUILD_BRIDGE);
}
virtual void SelectLastTool()
{
// User misplaced something - activate last selected tool again
if (this->last_clicked_widget == WIDGET_LIST_END)
return;
Point dummy = {0, 0};
this->RaiseWidget(this->last_clicked_widget);
this->OnClick(dummy, this->last_clicked_widget, 0);
}
virtual void OnPlacePresize(Point pt, TileIndex tile_from)
{
if (!IsValidTile(tile_from)) return;

View File

@@ -291,6 +291,16 @@ struct TerraformToolbarWindow : Window {
ResetObjectToPlace();
}
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);
}
static HotkeyList hotkeys;
};