diff options
author | frosch <frosch@openttd.org> | 2012-05-26 14:15:52 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-05-26 14:15:52 +0000 |
commit | 00b3ff80bbc76bc5546239cfcfa9a4c3591404a1 (patch) | |
tree | eb206b8a4320d8da851d723e83379f020573b9f2 /src/news_func.h | |
parent | c796801c4d6c87c554e84312b1c3afd866e0e49c (diff) | |
download | openttd-00b3ff80bbc76bc5546239cfcfa9a4c3591404a1.tar.xz |
(svn r24282) -Codechange: Add AddVehicleAdviceNewsItem function to preemptively deduplicate code.
Diffstat (limited to 'src/news_func.h')
-rw-r--r-- | src/news_func.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/news_func.h b/src/news_func.h index 542a307e4..e28f446a5 100644 --- a/src/news_func.h +++ b/src/news_func.h @@ -27,17 +27,23 @@ static inline void AddCompanyNewsItem(StringID string, CompanyNewsInformation *c /** * 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. + * @warning The DParams may not reference the vehicle due to autoreplace stuff. See AddVehicleAdviceNewsItem for how that can be done. */ 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); } +/** + * Adds a vehicle-advice news item. + * + * @warning DParam 0 must reference the vehicle! + */ +static inline void AddVehicleAdviceNewsItem(StringID string, VehicleID vehicle) +{ + AddNewsItem(string, NS_ADVICE, NR_VEHICLE, vehicle); +} + static inline void AddIndustryNewsItem(StringID string, NewsSubtype subtype, IndustryID industry) { AddNewsItem(string, subtype, NR_INDUSTRY, industry); |