diff options
author | stormcone <48624099+stormcone@users.noreply.github.com> | 2019-07-07 19:44:08 +0200 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-07-22 21:41:08 +0200 |
commit | 2817cd41f1b42a7d3901a92c6cda85a90765600a (patch) | |
tree | 83bb45e0cf7d8f31c685ab66b25be1b3dfc1bb3d /src/waypoint_cmd.cpp | |
parent | 196d586849684e62aa9a40093f2a1ce60e1cd53f (diff) | |
download | openttd-2817cd41f1b42a7d3901a92c6cda85a90765600a.tar.xz |
Fix #7250: Viewport kdtree not being updated for waypoints when sign moved.
Code based on the patch by JGRennison.
JGRennison/OpenTTD-patches@ac84f34062ef1f3ffcdee49dc595d574e4efb4d5
Diffstat (limited to 'src/waypoint_cmd.cpp')
-rw-r--r-- | src/waypoint_cmd.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index 20e600b5e..652173a94 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -48,6 +48,21 @@ void Waypoint::UpdateVirtCoord() } /** + * Move the waypoint main coordinate somewhere else. + * @param new_xy new tile location of the sign + */ +void Waypoint::MoveSign(TileIndex new_xy) +{ + if (this->xy == new_xy) return; + + _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index)); + + this->BaseStation::MoveSign(new_xy); + + _viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeWaypoint(this->index)); +} + +/** * Find a deleted waypoint close to a tile. * @param tile to search from * @param str the string to get the 'type' of |