mirror of https://github.com/OpenTTD/OpenTTD
(svn r15413) -Fix [FS#2529/2533]: inconsistencies between station and bridge building w.r.t. tile selection and when the window should be closed.
parent
748d4d2fb9
commit
856f26e35b
|
@ -124,6 +124,7 @@ public:
|
||||||
type(br_type),
|
type(br_type),
|
||||||
bridges(bl)
|
bridges(bl)
|
||||||
{
|
{
|
||||||
|
this->parent = FindWindowById(WC_BUILD_TOOLBAR, GB(this->type, 15, 2));
|
||||||
this->bridges->SetListing(this->last_sorting);
|
this->bridges->SetListing(this->last_sorting);
|
||||||
this->bridges->SetSortFuncs(this->sorter_funcs);
|
this->bridges->SetSortFuncs(this->sorter_funcs);
|
||||||
this->bridges->NeedResort();
|
this->bridges->NeedResort();
|
||||||
|
|
|
@ -244,6 +244,7 @@ struct BuildDocksToolbarWindow : Window {
|
||||||
delete FindWindowById(WC_BUILD_STATION, 0);
|
delete FindWindowById(WC_BUILD_STATION, 0);
|
||||||
delete FindWindowById(WC_BUILD_DEPOT, 0);
|
delete FindWindowById(WC_BUILD_DEPOT, 0);
|
||||||
delete FindWindowById(WC_SELECT_STATION, 0);
|
delete FindWindowById(WC_SELECT_STATION, 0);
|
||||||
|
delete FindWindowById(WC_BUILD_BRIDGE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPlacePresize(Point pt, TileIndex tile_from)
|
virtual void OnPlacePresize(Point pt, TileIndex tile_from)
|
||||||
|
|
|
@ -746,6 +746,7 @@ struct BuildRailToolbarWindow : Window {
|
||||||
delete FindWindowById(WC_BUILD_STATION, 0);
|
delete FindWindowById(WC_BUILD_STATION, 0);
|
||||||
delete FindWindowById(WC_BUILD_DEPOT, 0);
|
delete FindWindowById(WC_BUILD_DEPOT, 0);
|
||||||
delete FindWindowById(WC_SELECT_STATION, 0);
|
delete FindWindowById(WC_SELECT_STATION, 0);
|
||||||
|
delete FindWindowById(WC_BUILD_BRIDGE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPlacePresize(Point pt, TileIndex tile)
|
virtual void OnPlacePresize(Point pt, TileIndex tile)
|
||||||
|
|
|
@ -530,6 +530,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||||
delete FindWindowById(WC_TRUCK_STATION, 0);
|
delete FindWindowById(WC_TRUCK_STATION, 0);
|
||||||
delete FindWindowById(WC_BUILD_DEPOT, 0);
|
delete FindWindowById(WC_BUILD_DEPOT, 0);
|
||||||
delete FindWindowById(WC_SELECT_STATION, 0);
|
delete FindWindowById(WC_SELECT_STATION, 0);
|
||||||
|
delete FindWindowById(WC_BUILD_BRIDGE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
|
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
|
||||||
|
|
|
@ -1129,20 +1129,12 @@ struct SelectStationWindow : Window {
|
||||||
{
|
{
|
||||||
this->vscroll.cap = 6;
|
this->vscroll.cap = 6;
|
||||||
this->resize.step_height = 10;
|
this->resize.step_height = 10;
|
||||||
_thd.lock_pos = true;
|
|
||||||
_thd.lock_size = true;
|
|
||||||
|
|
||||||
FindStationsNearby(this->tile, this->size_x, this->size_y, true);
|
FindStationsNearby(this->tile, this->size_x, this->size_y, true);
|
||||||
|
|
||||||
this->FindWindowPlacementAndResize(desc);
|
this->FindWindowPlacementAndResize(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
~SelectStationWindow()
|
|
||||||
{
|
|
||||||
_thd.lock_pos = false;
|
|
||||||
_thd.lock_size = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void OnPaint()
|
virtual void OnPaint()
|
||||||
{
|
{
|
||||||
SetVScrollCount(this, _stations_nearby_list.Length() + 1);
|
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)
|
void ShowSelectStationIfNeeded(CommandContainer cmd, int w, int h)
|
||||||
{
|
{
|
||||||
if (StationJoinerNeeded(cmd, w, h)) {
|
if (StationJoinerNeeded(cmd, w, h)) {
|
||||||
|
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||||
if (BringWindowToFrontById(WC_SELECT_STATION, 0)) return;
|
if (BringWindowToFrontById(WC_SELECT_STATION, 0)) return;
|
||||||
new SelectStationWindow(&_select_station_desc, cmd, w, h);
|
new SelectStationWindow(&_select_station_desc, cmd, w, h);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -71,9 +71,6 @@ struct TileHighlightData {
|
||||||
ViewportPlaceMethod select_method;
|
ViewportPlaceMethod select_method;
|
||||||
ViewportDragDropSelectionProcess select_proc;
|
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;
|
TileIndex redsq;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2190,17 +2190,11 @@ void UpdateTileSelection()
|
||||||
/* clear the old selection? */
|
/* clear the old selection? */
|
||||||
if (_thd.drawstyle) SetSelectionTilesDirty();
|
if (_thd.drawstyle) SetSelectionTilesDirty();
|
||||||
|
|
||||||
if (!_thd.lock_pos) {
|
|
||||||
_thd.pos = _thd.new_pos;
|
|
||||||
_thd.drawstyle = _thd.new_drawstyle;
|
_thd.drawstyle = _thd.new_drawstyle;
|
||||||
}
|
_thd.pos = _thd.new_pos;
|
||||||
|
|
||||||
if (!_thd.lock_size) {
|
|
||||||
_thd.size = _thd.new_size;
|
_thd.size = _thd.new_size;
|
||||||
_thd.dirty = 0xff;
|
|
||||||
}
|
|
||||||
|
|
||||||
_thd.outersize = _thd.new_outersize;
|
_thd.outersize = _thd.new_outersize;
|
||||||
|
_thd.dirty = 0xff;
|
||||||
|
|
||||||
/* draw the new selection? */
|
/* draw the new selection? */
|
||||||
if (_thd.new_drawstyle) SetSelectionTilesDirty();
|
if (_thd.new_drawstyle) SetSelectionTilesDirty();
|
||||||
|
@ -2640,7 +2634,7 @@ calc_heightdiff_single_direction:;
|
||||||
y = sy + Clamp(y - sy, -limit, limit);
|
y = sy + Clamp(y - sy, -limit, limit);
|
||||||
} /* Fallthrough */
|
} /* Fallthrough */
|
||||||
case VPM_X_AND_Y: { /* drag an X by Y area */
|
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[] = {
|
static const StringID measure_strings_area[] = {
|
||||||
STR_NULL, STR_NULL, STR_MEASURE_AREA, STR_MEASURE_AREA_HEIGHTDIFF
|
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)
|
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 */
|
/* undo clicking on button and drag & drop */
|
||||||
if (_thd.place_mode != VHM_NONE || _special_mouse_mode == WSM_DRAGDROP) {
|
if (_thd.place_mode != VHM_NONE || _special_mouse_mode == WSM_DRAGDROP) {
|
||||||
Window *w = FindWindowById(_thd.window_class, _thd.window_number);
|
Window *w = FindWindowById(_thd.window_class, _thd.window_number);
|
||||||
|
|
Loading…
Reference in New Issue