summaryrefslogtreecommitdiff
path: root/src/news_func.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-08-10 20:06:39 +0000
committerfrosch <frosch@openttd.org>2009-08-10 20:06:39 +0000
commit52f9b8ffbd5fe9222da34e968d69876982b9a810 (patch)
treeac1f89eacfa91e22cdd80d1c7d39ba898bd0944f /src/news_func.h
parent238b0e43bbaa997acb7e53f1de118a963bb330fa (diff)
downloadopenttd-52f9b8ffbd5fe9222da34e968d69876982b9a810.tar.xz
(svn r17147) -Fix [FS#3048]: Keep vehicle news and viewports following vehicles, when autoreplacing/renewing them.
Diffstat (limited to 'src/news_func.h')
-rw-r--r--src/news_func.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/news_func.h b/src/news_func.h
index 1f77d2970..031446044 100644
--- a/src/news_func.h
+++ b/src/news_func.h
@@ -17,6 +17,15 @@ static inline void AddCompanyNewsItem(StringID string, NewsSubtype subtype, Comp
AddNewsItem(string, subtype, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, cni);
}
+/**
+ * Adds a newsitem referencing a vehicle.
+ *
+ * @warning
+ * Be careful!
+ * Vehicles are a special case, as news are kept when vehicles are autoreplaced/renewed.
+ * You have to make sure, #ChangeVehicleNews catches the DParams of your message.
+ * This is NOT ensured by the references.
+ */
static inline void AddVehicleNewsItem(StringID string, NewsSubtype subtype, VehicleID vehicle, StationID station = INVALID_STATION)
{
AddNewsItem(string, subtype, NR_VEHICLE, vehicle, station == INVALID_STATION ? NR_NONE : NR_STATION, station);