author | rubidium |
Thu, 01 Feb 2007 15:49:12 +0000 | |
changeset 5893 | 7e431a4abebb |
parent 5475 | 2e6990a8c7c4 |
child 6209 | 3a1a90cd67f3 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#ifndef NEWS_H |
4 |
#define NEWS_H |
|
5 |
||
6 |
struct NewsItem { |
|
7 |
StringID string_id; |
|
8 |
uint16 duration; |
|
4289
8981ce44336d
(svn r5919) -Cleanup: use the type Date when the variable really is a date
rubidium
parents:
3140
diff
changeset
|
9 |
Date date; |
0 | 10 |
byte flags; |
11 |
byte display_mode; |
|
12 |
byte type; |
|
13 |
byte callback; |
|
14 |
||
15 |
TileIndex data_a; |
|
16 |
TileIndex data_b; |
|
17 |
||
18 |
uint32 params[10]; |
|
19 |
}; |
|
20 |
||
715
28dd55cc55ae
(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
|
21 |
typedef bool ValidationProc ( uint data_a, uint data_b ); |
28dd55cc55ae
(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
|
22 |
typedef void DrawNewsCallbackProc(Window *w); |
2101
822f0b48ce64
(svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents:
715
diff
changeset
|
23 |
typedef StringID GetNewsStringCallbackProc(const NewsItem *ni); |
0 | 24 |
|
25 |
#define NEWS_FLAGS(mode,flag,type,cb) ((cb)<<24 | (type)<<16 | (flag)<<8 | (mode)) |
|
26 |
void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b); |
|
427 | 27 |
void NewsLoop(void); |
28 |
void DrawNewsBorder(const Window *w); |
|
29 |
void InitNewsItemStructs(void); |
|
0 | 30 |
|
31 |
VARDEF NewsItem _statusbar_news_item; |
|
32 |
||
4873
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
33 |
enum NewsType { |
0 | 34 |
NT_ARRIVAL_PLAYER = 0, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
35 |
NT_ARRIVAL_OTHER = 1, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
36 |
NT_ACCIDENT = 2, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
37 |
NT_COMPANY_INFO = 3, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
38 |
NT_ECONOMY = 4, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
39 |
NT_ADVICE = 5, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
40 |
NT_NEW_VEHICLES = 6, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
41 |
NT_ACCEPTANCE = 7, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
42 |
NT_SUBSIDIES = 8, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4289
diff
changeset
|
43 |
NT_GENERAL = 9, |
0 | 44 |
}; |
45 |
||
46 |
enum NewsMode { |
|
4873
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
47 |
NM_SMALL = 0, ///< Show only a small popup informing us about vehicle age for example |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
48 |
NM_NORMAL = 1, ///< Show a simple news message (height 170 pixels) |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
49 |
NM_THIN = 2, ///< Show a simple news message (height 130 pixels) |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
50 |
NM_CALLBACK = 3, ///< Do some special processing before displaying news message. Which callback to call is in NewsCallback |
0 | 51 |
}; |
52 |
||
53 |
enum NewsFlags { |
|
4873
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
54 |
NF_VIEWPORT = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening) |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
55 |
NF_TILE = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a/data_b |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
56 |
NF_VEHICLE = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
57 |
NF_FORCE_BIG = (1 << 4), ///< Force the appearance of a news message if it has already been shown (internal) |
4874
afafed841c6d
(svn r6804) -Codechange: Remove the unused NF_NOEXPIRE flag.
Darkvater
parents:
4873
diff
changeset
|
58 |
NF_INCOLOR = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white |
0 | 59 |
}; |
60 |
||
4873
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
61 |
enum NewsCallback { |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
62 |
DNC_TRAINAVAIL = 0, ///< Show new train available message. StringID is EngineID |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
63 |
DNC_ROADAVAIL = 1, ///< Show new road vehicle available message. StringID is EngineID |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
64 |
DNC_SHIPAVAIL = 2, ///< Show new ship available message. StringID is EngineID |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
65 |
DNC_AIRCRAFTAVAIL = 3, ///< Show new aircraft available message. StringID is EngineID |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
66 |
DNC_BANKRUPCY = 4, ///< Show bankrupcy message. StringID is PlayerID (0-3) and NewsBankrupcy (4-7) |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
67 |
}; |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
68 |
|
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
69 |
enum NewsBankrupcy { |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
70 |
NB_BTROUBLE = (1 << 4), ///< Company is in trouble (warning) |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
71 |
NB_BMERGER = (2 << 4), ///< Company has been bought by another company |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
72 |
NB_BBANKRUPT = (3 << 4), ///< Company has gone bankrupt |
11880cbbc9f6
(svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents:
4344
diff
changeset
|
73 |
NB_BNEWCOMPANY = (4 << 4), ///< A new company has been started |
0 | 74 |
}; |
75 |
||
3139
b17abef09e15
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
76 |
/** |
b17abef09e15
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
77 |
* Delete a news item type about a vehicle |
b17abef09e15
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
78 |
* if the news item type is INVALID_STRING_ID all news about the vehicle get |
b17abef09e15
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
79 |
* deleted |
b17abef09e15
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
80 |
*/ |
b17abef09e15
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
81 |
void DeleteVehicleNews(VehicleID, StringID news); |
b17abef09e15
(svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents:
2186
diff
changeset
|
82 |
|
0 | 83 |
#endif /* NEWS_H */ |