OpenTTD: src/news_type.h Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

news_type.h
Go to the documentation of this file.
1 /* $Id: news_type.h 24843 2012-12-23 21:07:12Z frosch $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
9
12 #ifndef NEWS_TYPE_H
13 #define NEWS_TYPE_H
14
15 #include "core/enum_type.hpp"
16 #include "date_type.h"
17 #include "strings_type.h"
18 #include "sound_type.h"
19
21 enum MessageOptionsSpace {
22 MOS_WIDG_PER_SETTING = 4,
23
24 MOS_LEFT_EDGE = 6,
25 MOS_COLUMN_SPACING = 4,
26 MOS_RIGHT_EDGE = 6,
27 MOS_BUTTON_SPACE = 10,
28
29 MOS_ABOVE_GLOBAL_SETTINGS = 6,
30 MOS_BOTTOM_EDGE = 6,
31 };
32
36 enum NewsType {
37 NT_ARRIVAL_COMPANY,
38 NT_ARRIVAL_OTHER,
39 NT_ACCIDENT,
40 NT_COMPANY_INFO,
41 NT_INDUSTRY_OPEN,
42 NT_INDUSTRY_CLOSE,
43 NT_ECONOMY,
44 NT_INDUSTRY_COMPANY,
45 NT_INDUSTRY_OTHER,
46 NT_INDUSTRY_NOBODY,
47 NT_ADVICE,
48 NT_NEW_VEHICLES,
49 NT_ACCEPTANCE,
50 NT_SUBSIDIES,
51 NT_GENERAL,
52 NT_END,
53 };
54
64 enum NewsReferenceType {
65 NR_NONE,
66 NR_TILE,
67 NR_VEHICLE,
68 NR_STATION,
69 NR_INDUSTRY,
70 NR_TOWN,
71 NR_ENGINE,
72 };
73
78 enum NewsFlag {
79 NFB_INCOLOUR = 0,
80 NFB_NO_TRANSPARENT = 1,
81 NFB_SHADE = 2,
82 NFB_WINDOW_LAYOUT = 3,
83 NFB_WINDOW_LAYOUT_COUNT = 3,
84 NFB_VEHICLE_PARAM0 = 6,
85
86 NF_INCOLOUR = 1 << NFB_INCOLOUR,
87 NF_NO_TRANSPARENT = 1 << NFB_NO_TRANSPARENT,
88 NF_SHADE = 1 << NFB_SHADE,
89 NF_VEHICLE_PARAM0 = 1 << NFB_VEHICLE_PARAM0,
90
91 NF_THIN = 0 << NFB_WINDOW_LAYOUT,
92 NF_SMALL = 1 << NFB_WINDOW_LAYOUT,
93 NF_NORMAL = 2 << NFB_WINDOW_LAYOUT,
94 NF_VEHICLE = 3 << NFB_WINDOW_LAYOUT,
95 NF_COMPANY = 4 << NFB_WINDOW_LAYOUT,
96 };
97 DECLARE_ENUM_AS_BIT_SET(NewsFlag)
98
99
100
103 enum NewsDisplay {
104 ND_OFF,
105 ND_SUMMARY,
106 ND_FULL,
107 };
108
112 struct NewsTypeData {
113 const char * const name;
114 const byte age;
115 const SoundFx sound;
116
123 NewsTypeData(const char *name, byte age, SoundFx sound) :
124 name(name),
125 age(age),
126 sound(sound)
127 {
128 }
129
130 NewsDisplay GetDisplay() const;
131 };
132
134 struct NewsItem {
135 NewsItem *prev;
136 NewsItem *next;
137 StringID string_id;
138 Date date;
139 NewsType type;
140 NewsFlag flags;
141
142 NewsReferenceType reftype1;
143 NewsReferenceType reftype2;
144 uint32 ref1;
145 uint32 ref2;
146
147 void *free_data;
148
149 ~NewsItem()
150 {
151 free(this->free_data);
152 }
153
154 uint64 params[10];
155 };
156
163 struct CompanyNewsInformation {
164 char company_name[64];
165 char president_name[64];
166 char other_company_name[64];
167
168 uint32 face;
169 byte colour;
170
171 void FillData(const struct Company *c, const struct Company *other = NULL);
172 };
173
174 #endif /* NEWS_TYPE_H */