From 01c051793c8f0e7945c0c8ff61ca1f67ad7d418c Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 21 Jan 2021 22:55:30 +0000 Subject: [PATCH] Allow referencing waypoints in news items --- src/news_gui.cpp | 2 +- src/waypoint.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/news_gui.cpp b/src/news_gui.cpp index f0681a304c..35bbf329f4 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -71,7 +71,7 @@ static TileIndex GetReferenceTile(NewsReferenceType reftype, uint32 ref) { switch (reftype) { case NR_TILE: return (TileIndex)ref; - case NR_STATION: return Station::Get((StationID)ref)->xy; + case NR_STATION: return BaseStation::Get((StationID)ref)->xy; case NR_INDUSTRY: return Industry::Get((IndustryID)ref)->location.tile + TileDiffXY(1, 1); case NR_TOWN: return Town::Get((TownID)ref)->xy; default: return INVALID_TILE; diff --git a/src/waypoint.cpp b/src/waypoint.cpp index ba8197fbf1..3d04f1113a 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -16,6 +16,7 @@ #include "viewport_kdtree.h" #include "tracerestrict.h" #include "newgrf_debug.h" +#include "news_func.h" #include "safeguards.h" @@ -58,4 +59,7 @@ Waypoint::~Waypoint() RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index); if (_viewport_sign_kdtree_valid && this->sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeWaypoint(this->index)); TraceRestrictRemoveDestinationID(TROCAF_WAYPOINT, this->index); + + /* Remove all news items */ + DeleteStationNews(this->index); }