From a4557c7da4329188e3561d9404891c0346f8f70e Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 24 May 2009 16:52:42 +0000 Subject: (svn r16416) -Fix [FS#2912]: Rework deleting of news when referenced vehicles/stations/industries are deleted. --- src/news_func.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/news_func.h') diff --git a/src/news_func.h b/src/news_func.h index 64edf636b..1f77d2970 100644 --- a/src/news_func.h +++ b/src/news_func.h @@ -8,8 +8,25 @@ #include "news_type.h" #include "vehicle_type.h" #include "station_type.h" +#include "industry_type.h" + +void AddNewsItem(StringID string, NewsSubtype subtype, NewsReferenceType reftype1 = NR_NONE, uint32 ref1 = UINT32_MAX, NewsReferenceType reftype2 = NR_NONE, uint32 ref2 = UINT32_MAX, void *free_data = NULL); + +static inline void AddCompanyNewsItem(StringID string, NewsSubtype subtype, CompanyNewsInformation *cni) +{ + AddNewsItem(string, subtype, NR_NONE, UINT32_MAX, NR_NONE, UINT32_MAX, cni); +} + +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); +} + +static inline void AddIndustryNewsItem(StringID string, NewsSubtype subtype, IndustryID industry) +{ + AddNewsItem(string, subtype, NR_INDUSTRY, industry); +} -void AddNewsItem(StringID string, NewsSubtype subtype, uint data_a, uint data_b, void *free_data = NULL); void NewsLoop(); void InitNewsItemStructs(); @@ -23,9 +40,12 @@ extern NewsTypeData _news_type_data[]; * if the news item type is INVALID_STRING_ID all news about the vehicle get * deleted */ -void DeleteVehicleNews(VehicleID, StringID news); +void DeleteVehicleNews(VehicleID vid, StringID news); + +/** Delete news associated with given station */ +void DeleteStationNews(StationID sid); /** Delete news associated with given station */ -void DeleteStationNews(StationID); +void DeleteIndustryNews(IndustryID iid); #endif /* NEWS_FUNC_H */ -- cgit v1.2.3-54-g00ecf