diff options
author | terkhen <terkhen@openttd.org> | 2010-10-15 19:14:43 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2010-10-15 19:14:43 +0000 |
commit | 780f120c3275a78b33271596fb8daaa45dd41c7c (patch) | |
tree | b226e22d9e172ca9a17733603fca4a474472e8a0 /src | |
parent | 46ca8778b41836cc5e154c0ae6dc37eddb88655a (diff) | |
download | openttd-780f120c3275a78b33271596fb8daaa45dd41c7c.tar.xz |
(svn r20932) -Add [FS#4153]: Highlight all destination tiles when building a lock. (uni657)
Diffstat (limited to 'src')
-rw-r--r-- | src/dock_gui.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 642a01558..a89312815 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -126,7 +126,7 @@ static void BuildDocksClick_Canal(Window *w) */ static void BuildDocksClick_Lock(Window *w) { - HandlePlacePushButton(w, DTW_LOCK, SPR_CURSOR_LOCK, HT_RECT, PlaceDocks_BuildLock); + HandlePlacePushButton(w, DTW_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL, PlaceDocks_BuildLock); } /** @@ -201,8 +201,11 @@ static OnButtonClick * const _build_docks_button_proc[] = { }; struct BuildDocksToolbarWindow : Window { + DockToolbarWidgets last_clicked_widget; ///< Contains the last widget that has been clicked on this toolbar. + BuildDocksToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window() { + this->last_clicked_widget = DTW_END; this->InitNested(desc, window_number); this->OnInvalidateData(); if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); @@ -229,6 +232,7 @@ struct BuildDocksToolbarWindow : Window { virtual void OnClick(Point pt, int widget, int click_count) { + this->last_clicked_widget = (DockToolbarWidgets)widget; if (widget >= DTW_BUTTONS_BEGIN) _build_docks_button_proc[widget - DTW_BUTTONS_BEGIN](this); } @@ -287,6 +291,7 @@ struct BuildDocksToolbarWindow : Window { { DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from, NULL)); TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile_from, ReverseDiagDir(dir)) : tile_from); + tile_from = this->last_clicked_widget == DTW_LOCK && dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile_from, dir) : tile_from; VpSetPresizeRange(tile_from, tile_to); } |