Changeset - r23787:94603685a34b
[Not reviewed]
master
0 2 0
stormcone - 5 years ago 2019-07-07 17:44:08
48624099+stormcone@users.noreply.github.com
Fix #7250: Viewport kdtree not being updated for waypoints when sign moved.

Code based on the patch by JGRennison.
JGRennison/OpenTTD-patches@ac84f34062ef1f3ffcdee49dc595d574e4efb4d5
2 files changed with 17 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/waypoint_base.h
Show inline comments
 
@@ -27,6 +27,8 @@ struct Waypoint FINAL : SpecializedStati
 

	
 
	void UpdateVirtCoord() override;
 

	
 
	void MoveSign(TileIndex new_xy) override;
 

	
 
	inline bool TileBelongsToRailStation(TileIndex tile) const override
 
	{
 
		return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
src/waypoint_cmd.cpp
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general)