summaryrefslogtreecommitdiff
path: root/src/news_func.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-05-24 16:52:42 +0000
committerfrosch <frosch@openttd.org>2009-05-24 16:52:42 +0000
commita4557c7da4329188e3561d9404891c0346f8f70e (patch)
tree96e7ba45ee42e5b0d0c8ca2867b081a56ebef645 /src/news_func.h
parentb7d065ce99886e2cf86883469a077f653428e5b8 (diff)
downloadopenttd-a4557c7da4329188e3561d9404891c0346f8f70e.tar.xz
(svn r16416) -Fix [FS#2912]: Rework deleting of news when referenced vehicles/stations/industries are deleted.
Diffstat (limited to 'src/news_func.h')
-rw-r--r--src/news_func.h26
1 files changed, 23 insertions, 3 deletions
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 */