diff options
author | rubidium <rubidium@openttd.org> | 2009-02-08 15:45:34 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-02-08 15:45:34 +0000 |
commit | 856f26e35b51447dc3cb707dcf0dbd5a87cfe3c0 (patch) | |
tree | 1e36a2be5ddf63b800e78616aa7a9a247c017944 | |
parent | 748d4d2fb9b6e1813ac48075f4b694ece52d4e27 (diff) | |
download | openttd-856f26e35b51447dc3cb707dcf0dbd5a87cfe3c0.tar.xz |
(svn r15413) -Fix [FS#2529/2533]: inconsistencies between station and bridge building w.r.t. tile selection and when the window should be closed.
-rw-r--r-- | src/bridge_gui.cpp | 1 | ||||
-rw-r--r-- | src/dock_gui.cpp | 1 | ||||
-rw-r--r-- | src/rail_gui.cpp | 1 | ||||
-rw-r--r-- | src/road_gui.cpp | 1 | ||||
-rw-r--r-- | src/station_gui.cpp | 9 | ||||
-rw-r--r-- | src/tilehighlight_type.h | 3 | ||||
-rw-r--r-- | src/viewport.cpp | 20 |
7 files changed, 10 insertions, 26 deletions
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 56e0c2e4a..4004934f2 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -124,6 +124,7 @@ public: type(br_type), bridges(bl) { + this->parent = FindWindowById(WC_BUILD_TOOLBAR, GB(this->type, 15, 2)); this->bridges->SetListing(this->last_sorting); this->bridges->SetSortFuncs(this->sorter_funcs); this->bridges->NeedResort(); diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 61829988a..b79f5d36a 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -244,6 +244,7 @@ struct BuildDocksToolbarWindow : Window { delete FindWindowById(WC_BUILD_STATION, 0); delete FindWindowById(WC_BUILD_DEPOT, 0); delete FindWindowById(WC_SELECT_STATION, 0); + delete FindWindowById(WC_BUILD_BRIDGE, 0); } virtual void OnPlacePresize(Point pt, TileIndex tile_from) diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 036995b20..e00753c30 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -746,6 +746,7 @@ struct BuildRailToolbarWindow : Window { delete FindWindowById(WC_BUILD_STATION, 0); delete FindWindowById(WC_BUILD_DEPOT, 0); delete FindWindowById(WC_SELECT_STATION, 0); + delete FindWindowById(WC_BUILD_BRIDGE, 0); } virtual void OnPlacePresize(Point pt, TileIndex tile) diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 1f593c0fc..89d15ac72 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -530,6 +530,7 @@ struct BuildRoadToolbarWindow : Window { delete FindWindowById(WC_TRUCK_STATION, 0); delete FindWindowById(WC_BUILD_DEPOT, 0); delete FindWindowById(WC_SELECT_STATION, 0); + delete FindWindowById(WC_BUILD_BRIDGE, 0); } virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 675c7992d..c2a536ca0 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -1129,20 +1129,12 @@ struct SelectStationWindow : Window { { this->vscroll.cap = 6; this->resize.step_height = 10; - _thd.lock_pos = true; - _thd.lock_size = true; FindStationsNearby(this->tile, this->size_x, this->size_y, true); this->FindWindowPlacementAndResize(desc); } - ~SelectStationWindow() - { - _thd.lock_pos = false; - _thd.lock_size = false; - } - virtual void OnPaint() { SetVScrollCount(this, _stations_nearby_list.Length() + 1); @@ -1260,6 +1252,7 @@ static bool StationJoinerNeeded(CommandContainer cmd, int w, int h) void ShowSelectStationIfNeeded(CommandContainer cmd, int w, int h) { if (StationJoinerNeeded(cmd, w, h)) { + if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); if (BringWindowToFrontById(WC_SELECT_STATION, 0)) return; new SelectStationWindow(&_select_station_desc, cmd, w, h); } else { diff --git a/src/tilehighlight_type.h b/src/tilehighlight_type.h index 59fd3237c..1ad04d9ea 100644 --- a/src/tilehighlight_type.h +++ b/src/tilehighlight_type.h @@ -71,9 +71,6 @@ struct TileHighlightData { ViewportPlaceMethod select_method; ViewportDragDropSelectionProcess select_proc; - bool lock_pos; //< If position changes are taken, or not - bool lock_size; //< If size changes are taken, or not - TileIndex redsq; }; diff --git a/src/viewport.cpp b/src/viewport.cpp index b05c8694a..579f65205 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -2190,17 +2190,11 @@ void UpdateTileSelection() /* clear the old selection? */ if (_thd.drawstyle) SetSelectionTilesDirty(); - if (!_thd.lock_pos) { - _thd.pos = _thd.new_pos; - _thd.drawstyle = _thd.new_drawstyle; - } - - if (!_thd.lock_size) { - _thd.size = _thd.new_size; - _thd.dirty = 0xff; - } - + _thd.drawstyle = _thd.new_drawstyle; + _thd.pos = _thd.new_pos; + _thd.size = _thd.new_size; _thd.outersize = _thd.new_outersize; + _thd.dirty = 0xff; /* draw the new selection? */ if (_thd.new_drawstyle) SetSelectionTilesDirty(); @@ -2640,7 +2634,7 @@ calc_heightdiff_single_direction:; y = sy + Clamp(y - sy, -limit, limit); } /* Fallthrough */ case VPM_X_AND_Y: { /* drag an X by Y area */ - if (_settings_client.gui.measure_tooltip && !_thd.lock_size) { + if (_settings_client.gui.measure_tooltip) { static const StringID measure_strings_area[] = { STR_NULL, STR_NULL, STR_MEASURE_AREA, STR_MEASURE_AREA_HEIGHTDIFF }; @@ -2734,10 +2728,6 @@ void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num) { - /* unlock position and size */ - _thd.lock_pos = false; - _thd.lock_size = false; - /* undo clicking on button and drag & drop */ if (_thd.place_mode != VHM_NONE || _special_mouse_mode == WSM_DRAGDROP) { Window *w = FindWindowById(_thd.window_class, _thd.window_number); |