|
9826
|
1 |
/* $Id$ */
|
|
|
2 |
|
|
|
3 |
/** @file news_type.h Types related to news. */
|
|
|
4 |
|
|
|
5 |
#ifndef NEWS_TYPE_H
|
|
|
6 |
#define NEWS_TYPE_H
|
|
|
7 |
|
|
|
8 |
#include "window_type.h"
|
|
|
9 |
#include "date_type.h"
|
|
|
10 |
#include "strings_type.h"
|
|
|
11 |
|
|
|
12 |
/**
|
|
|
13 |
* Type of news.
|
|
|
14 |
*/
|
|
|
15 |
enum NewsType {
|
|
|
16 |
NT_ARRIVAL_PLAYER, ///< Cargo arrived for player
|
|
|
17 |
NT_ARRIVAL_OTHER, ///< Cargo arrived for competitor
|
|
|
18 |
NT_ACCIDENT, ///< An accident or disaster has occurred
|
|
|
19 |
NT_COMPANY_INFO, ///< Company info (new companies, bankrupcy messages)
|
|
|
20 |
NT_OPENCLOSE, ///< Opening and closing of industries
|
|
|
21 |
NT_ECONOMY, ///< Economic changes (recession, industry up/dowm)
|
|
|
22 |
NT_INDUSTRY_PLAYER, ///< Production changes of industry serviced by local player
|
|
|
23 |
NT_INDUSTRY_OTHER, ///< Production changes of industry serviced by competitor(s)
|
|
|
24 |
NT_INDUSTRY_NOBODY, ///< Other industry production changes
|
|
|
25 |
NT_ADVICE, ///< Bits of news about vehicles of the player
|
|
|
26 |
NT_NEW_VEHICLES, ///< New vehicle has become available
|
|
|
27 |
NT_ACCEPTANCE, ///< A type of cargo is (no longer) accepted
|
|
|
28 |
NT_SUBSIDIES, ///< News about subsidies (announcements, expirations, acceptance)
|
|
|
29 |
NT_GENERAL, ///< General news (from towns)
|
|
|
30 |
NT_END, ///< end-of-array marker
|
|
|
31 |
};
|
|
|
32 |
|
|
|
33 |
/**
|
|
|
34 |
* News mode.
|
|
|
35 |
*/
|
|
|
36 |
enum NewsMode {
|
|
|
37 |
NM_SMALL = 0, ///< Show only a small popup informing us about vehicle age for example
|
|
|
38 |
NM_NORMAL = 1, ///< Show a simple news message (height 170 pixels)
|
|
|
39 |
NM_THIN = 2, ///< Show a simple news message (height 130 pixels)
|
|
|
40 |
NM_CALLBACK = 3, ///< Do some special processing before displaying news message. Which callback to call is in NewsCallback
|
|
|
41 |
};
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* Various OR-able news-item flags.
|
|
|
45 |
* note: NF_INCOLOR is set automatically if needed
|
|
|
46 |
*/
|
|
|
47 |
enum NewsFlag {
|
|
|
48 |
NF_NONE = 0, ///< No flag is set.
|
|
|
49 |
NF_VIEWPORT = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening)
|
|
|
50 |
NF_TILE = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a/data_b
|
|
|
51 |
NF_VEHICLE = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a
|
|
|
52 |
NF_FORCE_BIG = (1 << 4), ///< Force the appearance of a news message if it has already been shown (internal)
|
|
|
53 |
NF_INCOLOR = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white
|
|
|
54 |
};
|
|
|
55 |
DECLARE_ENUM_AS_BIT_SET(NewsFlag);
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
/**
|
|
|
59 |
* Special news items
|
|
|
60 |
*/
|
|
|
61 |
enum NewsCallback {
|
|
|
62 |
DNC_VEHICLEAVAIL = 0, ///< Show new vehicle available message. StringID is EngineID
|
|
|
63 |
DNC_BANKRUPCY = 1, ///< Show bankrupcy message. StringID is PlayerID (0-3) and NewsBankrupcy (4-7)
|
|
|
64 |
DNC_NONE = 0xFF, ///< No news callback.
|
|
|
65 |
};
|
|
|
66 |
|
|
|
67 |
/**
|
|
|
68 |
* Kinds of bankrupcy
|
|
|
69 |
*/
|
|
|
70 |
enum NewsBankrupcy {
|
|
|
71 |
NB_BTROUBLE, ///< Company is in trouble (warning)
|
|
|
72 |
NB_BMERGER, ///< Company has been bought by another company
|
|
|
73 |
NB_BBANKRUPT, ///< Company has gone bankrupt
|
|
|
74 |
NB_BNEWCOMPANY, ///< A new company has been started
|
|
|
75 |
};
|
|
|
76 |
|
|
|
77 |
struct NewsItem {
|
|
|
78 |
StringID string_id; ///< Message text (sometimes also used for storing other info)
|
|
|
79 |
uint16 duration; ///< Remaining time for showing this news message
|
|
|
80 |
Date date; ///< Date of the news
|
|
|
81 |
NewsFlag flags; ///< NewsFlags bits @see NewsFlag
|
|
|
82 |
NewsMode display_mode; ///< Display mode value @see NewsMode
|
|
|
83 |
NewsType type; ///< News category @see NewsType
|
|
|
84 |
NewsCallback callback; ///< Call-back function
|
|
|
85 |
|
|
|
86 |
uint data_a; ///< Reference to tile or vehicle
|
|
|
87 |
uint data_b; ///< Reference to second tile or vehicle
|
|
|
88 |
|
|
|
89 |
uint64 params[10];
|
|
|
90 |
};
|
|
|
91 |
|
|
|
92 |
typedef bool ValidationProc(uint data_a, uint data_b);
|
|
|
93 |
typedef void DrawNewsCallbackProc(Window *w, const NewsItem *ni);
|
|
|
94 |
typedef StringID GetNewsStringCallbackProc(const NewsItem *ni);
|
|
|
95 |
|
|
|
96 |
#endif /* NEWS_TYPE_H */
|