src/news.h
author rubidium
Mon, 04 Jun 2007 19:39:16 +0000
changeset 7291 b77a88be0fd8
parent 6987 b0f13039bda2
child 6720 35756db7e577
permissions -rw-r--r--
(svn r10034) -Change: remove the string changed in r10033 from the translations, so it will be properly translated in all languages.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2101
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2101
diff changeset
     2
6674
64f4781b4653 (svn r9385) -Cleanup: doxygen changes. Today, we are exploring the letter N.
belugas
parents: 6609
diff changeset
     3
/** @file news.h */
64f4781b4653 (svn r9385) -Cleanup: doxygen changes. Today, we are exploring the letter N.
belugas
parents: 6609
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#ifndef NEWS_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
#define NEWS_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
struct NewsItem {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
	StringID string_id;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
	uint16 duration;
4289
ff1b2b915cab (svn r5919) -Cleanup: use the type Date when the variable really is a date
rubidium
parents: 3140
diff changeset
    11
	Date date;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
	byte flags;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
	byte display_mode;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
	byte type;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
	byte callback;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    17
	TileIndex data_a;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
	TileIndex data_b;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
	uint32 params[10];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
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
    23
typedef bool ValidationProc ( uint data_a, uint data_b );
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
    24
typedef void DrawNewsCallbackProc(Window *w);
2101
763d0d48f39c (svn r2611) - CodeChange: use standardized truncutation with the newsmessage-history window as well
Darkvater
parents: 715
diff changeset
    25
typedef StringID GetNewsStringCallbackProc(const NewsItem *ni);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    26
6987
b0f13039bda2 (svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents: 6674
diff changeset
    27
#define NEWS_FLAGS(mode, flag, type, cb) ((cb) << 24 | (type) << 16 | (flag) << 8 | (mode))
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b);
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6535
diff changeset
    29
void NewsLoop();
427
d87c7d677d2f (svn r626) Merge r438 to trunk:
tron
parents: 0
diff changeset
    30
void DrawNewsBorder(const Window *w);
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6535
diff changeset
    31
void InitNewsItemStructs();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
VARDEF NewsItem _statusbar_news_item;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
4873
7cb19235cf60 (svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents: 4344
diff changeset
    35
enum NewsType {
6605
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    36
	NT_ARRIVAL_PLAYER,
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    37
	NT_ARRIVAL_OTHER,
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    38
	NT_ACCIDENT,
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    39
	NT_COMPANY_INFO,
6609
7c466c7c850a (svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents: 6605
diff changeset
    40
	NT_OPENCLOSE,
6605
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    41
	NT_ECONOMY,
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    42
	NT_ADVICE,
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    43
	NT_NEW_VEHICLES,
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    44
	NT_ACCEPTANCE,
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    45
	NT_SUBSIDIES,
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    46
	NT_GENERAL,
0d727f17ee17 (svn r9089) -Codechange: Remove the 32 widgets limit on News Options window.
belugas
parents: 6573
diff changeset
    47
	NT_END,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    48
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
6609
7c466c7c850a (svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents: 6605
diff changeset
    50
extern const char *_news_display_name[NT_END];
7c466c7c850a (svn r9097) -Fix [FS#525]: open and close messages now have their own setting, so you can hide economy changes, but do show open/close of industries
truelight
parents: 6605
diff changeset
    51
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    52
enum NewsMode {
4873
7cb19235cf60 (svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents: 4344
diff changeset
    53
	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
    54
	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
    55
	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
    56
	NM_CALLBACK = 3, ///< Do some special processing before displaying news message. Which callback to call is in NewsCallback
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
enum NewsFlags {
4873
7cb19235cf60 (svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents: 4344
diff changeset
    60
	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
    61
	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
    62
	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
    63
	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
    64
	NF_INCOLOR   = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
4873
7cb19235cf60 (svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents: 4344
diff changeset
    67
enum NewsCallback {
6535
1a5437f36d78 (svn r9001) -Codechange: remove duplication of functions and strings with respect to the news of new vehicles.
rubidium
parents: 5726
diff changeset
    68
	DNC_VEHICLEAVAIL  = 0, ///< Show new vehicle available message. StringID is EngineID
1a5437f36d78 (svn r9001) -Codechange: remove duplication of functions and strings with respect to the news of new vehicles.
rubidium
parents: 5726
diff changeset
    69
	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
    70
};
7cb19235cf60 (svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents: 4344
diff changeset
    71
7cb19235cf60 (svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents: 4344
diff changeset
    72
enum NewsBankrupcy {
7cb19235cf60 (svn r6803) -Codechange: Substitute magic numbers by an enum for the news windows
Darkvater
parents: 4344
diff changeset
    73
	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
    74
	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
    75
	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
    76
	NB_BNEWCOMPANY = (4 << 4), ///< A new company has been started
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    77
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
3139
4c950c7ec5c9 (svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents: 2186
diff changeset
    79
/**
4c950c7ec5c9 (svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents: 2186
diff changeset
    80
 * 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
    81
 * 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
    82
 * deleted
4c950c7ec5c9 (svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents: 2186
diff changeset
    83
 */
4c950c7ec5c9 (svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents: 2186
diff changeset
    84
void DeleteVehicleNews(VehicleID, StringID news);
4c950c7ec5c9 (svn r3757) -Feature: Delete news items about vehicles, when they get stale
tron
parents: 2186
diff changeset
    85
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    86
#endif /* NEWS_H */