summaryrefslogtreecommitdiff
path: root/news.h
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-12-19 09:39:19 +0000
committerdominik <dominik@openttd.org>2004-12-19 09:39:19 +0000
commitbb5dca016ddbd7d21373c052cefa96f894e1e2fc (patch)
tree67065372ddab844b0eca1fb7b664f60f5c1d957a /news.h
parentcf89cb12cd49333fba3b72001f52f1032c036f62 (diff)
downloadopenttd-bb5dca016ddbd7d21373c052cefa96f894e1e2fc.tar.xz
(svn r1167) Feature: Added the possibility to add validation functions to NewsItems. This is now done for "Train in depot" messages. Before displaying such a message, it checks if the train really still is in the depot. Can be applied to other news items as well.
Diffstat (limited to 'news.h')
-rw-r--r--news.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/news.h b/news.h
index 076f1b569..858d3923a 100644
--- a/news.h
+++ b/news.h
@@ -14,20 +14,26 @@ struct NewsItem {
TileIndex data_b;
uint32 params[10];
+
+ /* The validation functions for news items get called immediately
+ * before the news are supposed to be shown. If this funcion returns
+ * false, the news item won't be displayed. */
+ bool (*isValid) ( uint data_a, uint data_b );
};
+typedef bool ValidationProc ( uint data_a, uint data_b );
+typedef void DrawNewsCallbackProc(Window *w);
+typedef StringID GetNewsStringCallbackProc(NewsItem *ni);
#define NEWS_FLAGS(mode,flag,type,cb) ((cb)<<24 | (type)<<16 | (flag)<<8 | (mode))
void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b);
+void AddValidatedNewsItem(StringID string, uint32 flags, uint data_a, uint data_b, ValidationProc *validation);
void NewsLoop(void);
void DrawNewsBorder(const Window *w);
void InitNewsItemStructs(void);
VARDEF NewsItem _statusbar_news_item;
-typedef void DrawNewsCallbackProc(Window *w);
-typedef StringID GetNewsStringCallbackProc(NewsItem *ni);
-
enum {
NT_ARRIVAL_PLAYER = 0,
NT_ARRIVAL_OTHER = 1,