# HG changeset patch # User frosch # Date 2008-08-23 16:34:05 # Node ID 70a888f9bda936070b79a77b69e31d7c93599986 # Parent fce227083d3afea0110044c075bda3268231d098 (svn r14143) -Codechange: Recenter viewport of waypoint window when relocating the waypoint. diff --git a/src/waypoint.cpp b/src/waypoint.cpp --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -249,6 +249,7 @@ CommandCost CmdBuildTrainWaypoint(TileIn RedrawWaypointSign(wp); wp->xy = tile; + InvalidateWindowData(WC_WAYPOINT_VIEW, wp->index); } const StationSpec* statspec; diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -77,6 +77,13 @@ public: } } + virtual void OnInvalidateData(int data) + { + int x = TileX(this->wp->xy) * TILE_SIZE; + int y = TileY(this->wp->xy) * TILE_SIZE; + ScrollWindowTo(x,y, this); + } + virtual void OnQueryTextFinished(char *str) { if (!StrEmpty(str)) {