From 9900af38f58c84a90bd1a3830b9acd08438c46c5 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Sun, 1 Dec 2019 23:17:33 +0100 Subject: Fix #7847: Use ViewportSign coordinates for sign Kdtree coordinates (#7849) Ensure the same coordinates are used for station/town/player signs regardless of how the landscape changes below it after the coordinates were first determined. By keeping track of whether each ViewportSign is valid for Kdtree use (and only ever registering the viewport sign when the object is valid) a lot of code can be simplified and become more robust at the same time. --- src/waypoint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/waypoint.cpp') diff --git a/src/waypoint.cpp b/src/waypoint.cpp index cf3e746d7..f602eee6d 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -53,5 +53,5 @@ Waypoint::~Waypoint() if (CleaningPool()) return; DeleteWindowById(WC_WAYPOINT_VIEW, this->index); RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index); - _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index)); + if (this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index)); } -- cgit v1.2.3-54-g00ecf