summaryrefslogtreecommitdiff
path: root/src/waypoint_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-10-24 20:59:25 +0000
committerrubidium <rubidium@openttd.org>2010-10-24 20:59:25 +0000
commit1f5554c5c7ed7e705a3b605cde4b1980cb2382bf (patch)
tree1f4e22d72a7f1716c5def492db24aee7b6c12c4b /src/waypoint_gui.cpp
parent0568976c785417c8f01b7b4117ad36cc2b7282b8 (diff)
downloadopenttd-1f5554c5c7ed7e705a3b605cde4b1980cb2382bf.tar.xz
(svn r21035) -Fix [FS#4181] (r21020): crash when opening the buoy's viewport. Based on a patch by Krille.
Diffstat (limited to 'src/waypoint_gui.cpp')
-rw-r--r--src/waypoint_gui.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp
index b05172468..070e4eea7 100644
--- a/src/waypoint_gui.cpp
+++ b/src/waypoint_gui.cpp
@@ -46,7 +46,11 @@ private:
*/
TileIndex GetCenterTile() const
{
- return this->wp->IsInUse() ? this->wp->train_station.GetCenterTile() : this->wp->xy;
+ if (!this->wp->IsInUse()) return this->wp->xy;
+
+ TileArea ta;
+ this->wp->GetTileArea(&ta, this->vt == VEH_TRAIN ? STATION_WAYPOINT : STATION_BUOY);
+ return ta.GetCenterTile();
}
public: