mirror of https://github.com/OpenTTD/OpenTTD.git
Fix #7250: Viewport kdtree not being updated for waypoints when sign moved.
Code based on the patch by JGRennison. JGRennison/OpenTTD-patches@ac84f34062
This commit is contained in:
parent
196d586849
commit
2817cd41f1
|
@ -27,6 +27,8 @@ struct Waypoint FINAL : SpecializedStation<Waypoint, true> {
|
||||||
|
|
||||||
void UpdateVirtCoord() override;
|
void UpdateVirtCoord() override;
|
||||||
|
|
||||||
|
void MoveSign(TileIndex new_xy) override;
|
||||||
|
|
||||||
inline bool TileBelongsToRailStation(TileIndex tile) const override
|
inline bool TileBelongsToRailStation(TileIndex tile) const override
|
||||||
{
|
{
|
||||||
return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
|
return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
|
||||||
|
|
|
@ -47,6 +47,21 @@ void Waypoint::UpdateVirtCoord()
|
||||||
InvalidateWindowData(WC_WAYPOINT_VIEW, this->index);
|
InvalidateWindowData(WC_WAYPOINT_VIEW, this->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Find a deleted waypoint close to a tile.
|
||||||
* @param tile to search from
|
* @param tile to search from
|
||||||
|
|
Loading…
Reference in New Issue