Changeset - r11072:2e8ea3011436
[Not reviewed]
master
0 7 0
rubidium - 15 years ago 2009-02-08 15:45:34
rubidium@openttd.org
(svn r15413) -Fix [FS#2529/2533]: inconsistencies between station and bridge building w.r.t. tile selection and when the window should be closed.
7 files changed with 10 insertions and 26 deletions:
0 comments (0 inline, 0 general)
src/bridge_gui.cpp
Show inline comments
 
@@ -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();
src/dock_gui.cpp
Show inline comments
 
@@ -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)
src/rail_gui.cpp
Show inline comments
 
@@ -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)
src/road_gui.cpp
Show inline comments
 
@@ -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)
src/station_gui.cpp
Show inline comments
 
@@ -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(CommandC
 
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 {
src/tilehighlight_type.h
Show inline comments
 
@@ -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;
 
};
 

	
src/viewport.cpp
Show inline comments
 
@@ -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, 
 

	
 
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);
0 comments (0 inline, 0 general)