Changeset - r16107:0e7cd852debf
[Not reviewed]
master
0 1 0
rubidium - 14 years ago 2010-09-16 16:14:30
rubidium@openttd.org
(svn r20813) -Fix: make the waypoint viewport keep centered around the waypoint when resizing the window (Krille)
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/waypoint_gui.cpp
Show inline comments
 
@@ -101,32 +101,33 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
 
		/* You can only change your own waypoints */
 
		this->SetWidgetDisabledState(WAYPVW_RENAME, !this->wp->IsInUse() || (this->wp->owner != _local_company && this->wp->owner != OWNER_NONE));
 
		/* Disable the widget for waypoints with no use */
 
		this->SetWidgetDisabledState(WAYPVW_SHOW_VEHICLES, !this->wp->IsInUse());
 

	
 
		int x = TileX(this->wp->xy) * TILE_SIZE;
 
		int y = TileY(this->wp->xy) * TILE_SIZE;
 
		ScrollWindowTo(x, y, -1, this);
 
		ScrollWindowTo(x, y, -1, this, true);
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		if (this->viewport != NULL) {
 
			NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WAYPVW_VIEWPORT);
 
			nvp->UpdateViewportCoordinates(this);
 
			this->wp->UpdateVirtCoord();
 
		}
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
	{
 
		if (str == NULL) return;
 

	
 
		DoCommandP(0, this->window_number, 0, CMD_RENAME_WAYPOINT | CMD_MSG(STR_ERROR_CAN_T_CHANGE_WAYPOINT_NAME), NULL, str);
 
	}
 

	
 
};
 

	
0 comments (0 inline, 0 general)