summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/waypoint_base.h2
-rw-r--r--src/waypoint_cmd.cpp15
2 files changed, 17 insertions, 0 deletions
diff --git a/src/waypoint_base.h b/src/waypoint_base.h
index c11c2f2b2..be1d0bd0d 100644
--- a/src/waypoint_base.h
+++ b/src/waypoint_base.h
@@ -27,6 +27,8 @@ struct Waypoint FINAL : SpecializedStation<Waypoint, true> {
void UpdateVirtCoord() override;
+ void MoveSign(TileIndex new_xy) override;
+
inline bool TileBelongsToRailStation(TileIndex tile) const override
{
return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
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