author | KUDr |
Sat, 21 Apr 2007 08:23:57 +0000 | |
branch | cpp_gui |
changeset 6308 | 646711c5feaa |
parent 6303 | 84c215fc8eb8 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6303 | 3 |
/** @file news.h */ |
4 |
||
0 | 5 |
#ifndef NEWS_H |
6 |
#define NEWS_H |
|
7 |
||
6298
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
8 |
#include "window.h" |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
9 |
|
0 | 10 |
struct NewsItem { |
11 |
StringID string_id; |
|
12 |
uint16 duration; |
|
4289
ff1b2b915cab
(svn r5919) -Cleanup: use the type Date when the variable really is a date
rubidium
parents:
3140
diff
changeset
|
13 |
Date date; |
0 | 14 |
byte flags; |
15 |
byte display_mode; |
|
16 |
byte type; |
|
17 |
byte callback; |
|
18 |
||
19 |
TileIndex data_a; |
|
20 |
TileIndex data_b; |
|
21 |
||
22 |
uint32 params[10]; |
|
23 |
}; |
|
24 |
||
715
83805642c830
(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.
dominik
parents:
427
diff
changeset
|
25 |
typedef bool ValidationProc ( uint data_a, uint data_b ); |
6258
a2f86b8fd99b
(svn r8801) [cpp_gui] -Codechange: few changes towards OO GUI:
KUDr
parents:
5726
diff
changeset
|
26 |
typedef void DrawNewsCallbackProc(BaseWindow *w); |
2101
763d0d48f39c
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
715
diff
changeset
|
27 |
typedef StringID GetNewsStringCallbackProc(const NewsItem *ni); |
0 | 28 |
|
6308 | 29 |
#define NEWS_FLAGS(mode, flag, type, cb) ((cb) << 24 | (type) << 16 | (flag) << 8 | (mode)) |
0 | 30 |
void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b); |
6298
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
31 |
void NewsLoop(); |
6258
a2f86b8fd99b
(svn r8801) [cpp_gui] -Codechange: few changes towards OO GUI:
KUDr
parents:
5726
diff
changeset
|
32 |
void DrawNewsBorder(const BaseWindow *w); |
6298
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
33 |
void InitNewsItemStructs(); |
0 | 34 |
|
35 |
VARDEF NewsItem _statusbar_news_item; |
|
36 |
||
4873
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
37 |
enum NewsType { |
6298
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
38 |
NT_ARRIVAL_PLAYER, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
39 |
NT_ARRIVAL_OTHER, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
40 |
NT_ACCIDENT, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
41 |
NT_COMPANY_INFO, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
42 |
NT_OPENCLOSE, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
43 |
NT_ECONOMY, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
44 |
NT_ADVICE, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
45 |
NT_NEW_VEHICLES, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
46 |
NT_ACCEPTANCE, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
47 |
NT_SUBSIDIES, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
48 |
NT_GENERAL, |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
49 |
NT_END, |
0 | 50 |
}; |
51 |
||
6298
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
52 |
extern const char *_news_display_name[NT_END]; |
c30fe89622df
(svn r9119) [cpp_gui] -Sync with trunk (r9003:9100)
bjarni
parents:
6285
diff
changeset
|
53 |
|
0 | 54 |
enum NewsMode { |
4873
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
55 |
NM_SMALL = 0, ///< Show only a small popup informing us about vehicle age for example |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
56 |
NM_NORMAL = 1, ///< Show a simple news message (height 170 pixels) |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
57 |
NM_THIN = 2, ///< Show a simple news message (height 130 pixels) |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
58 |
NM_CALLBACK = 3, ///< Do some special processing before displaying news message. Which callback to call is in NewsCallback |
0 | 59 |
}; |
60 |
||
61 |
enum NewsFlags { |
|
4873
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
62 |
NF_VIEWPORT = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening) |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
63 |
NF_TILE = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a/data_b |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
64 |
NF_VEHICLE = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
65 |
NF_FORCE_BIG = (1 << 4), ///< Force the appearance of a news message if it has already been shown (internal) |
4874
b95cdd66085f
(svn r6804) -Codechange: Remove the unused NF_NOEXPIRE flag.
Darkvater
parents:
4873
diff
changeset
|
66 |
NF_INCOLOR = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white |
0 | 67 |
}; |
68 |
||
4873
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
69 |
enum NewsCallback { |
6285
187e3ef04cc9
(svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents:
6258
diff
changeset
|
70 |
DNC_VEHICLEAVAIL = 0, ///< Show new vehicle available message. StringID is EngineID |
187e3ef04cc9
(svn r9004) [cpp_gui] -Sync with trunk (r8900..r9003)
KUDr
parents:
6258
diff
changeset
|
71 |
DNC_BANKRUPCY = 1, ///< Show bankrupcy message. StringID is PlayerID (0-3) and NewsBankrupcy (4-7) |
4873
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
72 |
}; |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
73 |
|
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
74 |
enum NewsBankrupcy { |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
75 |
NB_BTROUBLE = (1 << 4), ///< Company is in trouble (warning) |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
76 |
NB_BMERGER = (2 << 4), ///< Company has been bought by another company |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
77 |
NB_BBANKRUPT = (3 << 4), ///< Company has gone bankrupt |
7cb19235cf60
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
78 |
NB_BNEWCOMPANY = (4 << 4), ///< A new company has been started |
0 | 79 |
}; |
80 |
||
3139
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
81 |
/** |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
82 |
* Delete a news item type about a vehicle |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
83 |
* if the news item type is INVALID_STRING_ID all news about the vehicle get |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
84 |
* deleted |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
85 |
*/ |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
86 |
void DeleteVehicleNews(VehicleID, StringID news); |
4c950c7ec5c9
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
87 |
|
0 | 88 |
#endif /* NEWS_H */ |