OpenTTD Source: src/story.cpp Source File

OpenTTD Source 15.3

story.cpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#include "stdafx.h"
11#include "story_base.h"
12#include "core/pool_func.hpp"
13#include "command_func.h"
14#include "company_base.h"
15#include "company_func.h"
16#include "string_func.h"
17#include "timer/timer_game_calendar.h"
18#include "tile_map.h"
19#include "goal_type.h"
20#include "goal_base.h"
21#include "window_func.h"
22#include "gui.h"
23#include "vehicle_base.h"
24#include "game/game.hpp"
25#include "script/api/script_story_page.hpp"
26#include "script/api/script_event_types.hpp"
27#include "story_cmd.h"
28
29#include "safeguards.h"
30
31
32uint32_t _story_page_element_next_sort_value;
33uint32_t _story_page_next_sort_value;
34
35 StoryPageElementPool _story_page_element_pool("StoryPageElement");
36 StoryPagePool _story_page_pool("StoryPage");
37 INSTANTIATE_POOL_METHODS(StoryPageElement)
38 INSTANTIATE_POOL_METHODS(StoryPage)
39
40StoryPage::~StoryPage()
41{
42 if (CleaningPool()) return;
43
44 for (StoryPageElement *spe : StoryPageElement::Iterate()) {
45 if (spe->page == this->index) delete spe;
46 }
47}
48
59 static bool VerifyElementContentParameters(StoryPageID page_id, StoryPageElementType type, TileIndex tile, uint32_t reference, const EncodedString &text)
60{
61 StoryPageButtonData button_data{ reference };
62
63 switch (type) {
64 case SPET_TEXT:
65 if (text.empty()) return false;
66 break;
67 case SPET_LOCATION:
68 if (text.empty()) return false;
69 if (!IsValidTile(tile)) return false;
70 break;
71 case SPET_GOAL:
72 if (!Goal::IsValidID((GoalID)reference)) return false;
73 /* Reject company specific goals on global pages */
74 if (StoryPage::Get(page_id)->company == CompanyID::Invalid() && Goal::Get((GoalID)reference)->company != CompanyID::Invalid()) return false;
75 break;
76 case SPET_BUTTON_PUSH:
77 if (!button_data.ValidateColour()) return false;
78 if (!button_data.ValidateFlags()) return false;
79 return true;
80 case SPET_BUTTON_TILE:
81 if (!button_data.ValidateColour()) return false;
82 if (!button_data.ValidateFlags()) return false;
83 if (!button_data.ValidateCursor()) return false;
84 return true;
85 case SPET_BUTTON_VEHICLE:
86 if (!button_data.ValidateColour()) return false;
87 if (!button_data.ValidateFlags()) return false;
88 if (!button_data.ValidateCursor()) return false;
89 if (!button_data.ValidateVehicleType()) return false;
90 return true;
91 default:
92 return false;
93 }
94
95 return true;
96}
97
106 static void UpdateElement(StoryPageElement &pe, TileIndex tile, uint32_t reference, const EncodedString &text)
107{
108 switch (pe.type) {
109 case SPET_TEXT:
110 pe.text = text;
111 break;
112 case SPET_LOCATION:
113 pe.text = text;
114 pe.referenced_id = tile.base();
115 break;
116 case SPET_GOAL:
117 pe.referenced_id = reference;
118 break;
119 case SPET_BUTTON_PUSH:
120 case SPET_BUTTON_TILE:
121 case SPET_BUTTON_VEHICLE:
122 pe.text = text;
123 pe.referenced_id = reference;
124 break;
125 default: NOT_REACHED();
126 }
127}
128
130 void StoryPageButtonData::SetColour(Colours button_colour)
131{
132 assert(button_colour < COLOUR_END);
133 SB(this->referenced_id, 0, 8, button_colour);
134}
135
136void StoryPageButtonData::SetFlags(StoryPageButtonFlags flags)
137{
138 SB(this->referenced_id, 24, 8, flags);
139}
140
142 void StoryPageButtonData::SetCursor(StoryPageButtonCursor cursor)
143{
144 assert(cursor < SPBC_END);
145 SB(this->referenced_id, 8, 8, cursor);
146}
147
149 void StoryPageButtonData::SetVehicleType(VehicleType vehtype)
150{
151 assert(vehtype == VEH_INVALID || vehtype < VEH_COMPANY_END);
152 SB(this->referenced_id, 16, 8, vehtype);
153}
154
156Colours StoryPageButtonData::GetColour() const
157{
158 Colours colour = static_cast<Colours>(GB(this->referenced_id, 0, 8));
159 if (!IsValidColours(colour)) return INVALID_COLOUR;
160 return colour;
161}
162
163 StoryPageButtonFlags StoryPageButtonData::GetFlags() const
164{
165 return (StoryPageButtonFlags)GB(this->referenced_id, 24, 8);
166}
167
169 StoryPageButtonCursor StoryPageButtonData::GetCursor() const
170{
171 StoryPageButtonCursor cursor = (StoryPageButtonCursor)GB(this->referenced_id, 8, 8);
172 if (!IsValidStoryPageButtonCursor(cursor)) return INVALID_SPBC;
173 return cursor;
174}
175
177 VehicleType StoryPageButtonData::GetVehicleType() const
178{
179 return (VehicleType)GB(this->referenced_id, 16, 8);
180}
181
183 bool StoryPageButtonData::ValidateColour() const
184{
185 return GB(this->referenced_id, 0, 8) < COLOUR_END;
186}
187
188bool StoryPageButtonData::ValidateFlags() const
189{
190 uint8_t flags = GB(this->referenced_id, 24, 8);
191 /* Don't allow float left and right together */
192 if ((flags & SPBF_FLOAT_LEFT) && (flags & SPBF_FLOAT_RIGHT)) return false;
193 /* Don't allow undefined flags */
194 if (flags & ~(SPBF_FLOAT_LEFT | SPBF_FLOAT_RIGHT)) return false;
195 return true;
196}
197
199 bool StoryPageButtonData::ValidateCursor() const
200{
201 return GB(this->referenced_id, 8, 8) < SPBC_END;
202}
203
205 bool StoryPageButtonData::ValidateVehicleType() const
206{
207 uint8_t vehtype = GB(this->referenced_id, 16, 8);
208 return vehtype == VEH_INVALID || vehtype < VEH_COMPANY_END;
209}
210
218std::tuple<CommandCost, StoryPageID> CmdCreateStoryPage(DoCommandFlags flags, CompanyID company, const EncodedString &text)
219{
220 if (!StoryPage::CanAllocateItem()) return { CMD_ERROR, StoryPageID::Invalid() };
221
222 if (_current_company != OWNER_DEITY) return { CMD_ERROR, StoryPageID::Invalid() };
223 if (company != CompanyID::Invalid() && !Company::IsValidID(company)) return { CMD_ERROR, StoryPageID::Invalid() };
224
225 if (flags.Test(DoCommandFlag::Execute)) {
226 if (StoryPage::GetNumItems() == 0) {
227 /* Initialize the next sort value variable. */
228 _story_page_next_sort_value = 0;
229 }
230
231 StoryPage *s = new StoryPage(_story_page_next_sort_value, TimerGameCalendar::date, company, text);
232
233 InvalidateWindowClassesData(WC_STORY_BOOK, -1);
234 if (StoryPage::GetNumItems() == 1) InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
235
236 _story_page_next_sort_value++;
237 return { CommandCost(), s->index };
238 }
239
240 return { CommandCost(), StoryPageID::Invalid() };
241}
242
253std::tuple<CommandCost, StoryPageElementID> CmdCreateStoryPageElement(DoCommandFlags flags, TileIndex tile, StoryPageID page_id, StoryPageElementType type, uint32_t reference, const EncodedString &text)
254{
255 if (!StoryPageElement::CanAllocateItem()) return { CMD_ERROR, StoryPageElementID::Invalid() };
256
257 /* Allow at most 128 elements per page. */
258 uint16_t element_count = 0;
259 for (StoryPageElement *iter : StoryPageElement::Iterate()) {
260 if (iter->page == page_id) element_count++;
261 }
262 if (element_count >= 128) return { CMD_ERROR, StoryPageElementID::Invalid() };
263
264 if (_current_company != OWNER_DEITY) return { CMD_ERROR, StoryPageElementID::Invalid() };
265 if (!StoryPage::IsValidID(page_id)) return { CMD_ERROR, StoryPageElementID::Invalid() };
266 if (!VerifyElementContentParameters(page_id, type, tile, reference, text)) return { CMD_ERROR, StoryPageElementID::Invalid() };
267
268
269 if (flags.Test(DoCommandFlag::Execute)) {
270 if (StoryPageElement::GetNumItems() == 0) {
271 /* Initialize the next sort value variable. */
272 _story_page_element_next_sort_value = 0;
273 }
274
275 StoryPageElement *pe = new StoryPageElement(_story_page_element_next_sort_value, type, page_id);
276 UpdateElement(*pe, tile, reference, text);
277
278 InvalidateWindowClassesData(WC_STORY_BOOK, page_id);
279
280 _story_page_element_next_sort_value++;
281 return { CommandCost(), pe->index };
282 }
283
284 return { CommandCost(), StoryPageElementID::Invalid() };
285}
286
296 CommandCost CmdUpdateStoryPageElement(DoCommandFlags flags, TileIndex tile, StoryPageElementID page_element_id, uint32_t reference, const EncodedString &text)
297{
298 if (_current_company != OWNER_DEITY) return CMD_ERROR;
299 if (!StoryPageElement::IsValidID(page_element_id)) return CMD_ERROR;
300
301 StoryPageElement *pe = StoryPageElement::Get(page_element_id);
302 StoryPageID page_id = pe->page;
303 StoryPageElementType type = pe->type;
304
305 if (!VerifyElementContentParameters(page_id, type, tile, reference, text)) return CMD_ERROR;
306
307 if (flags.Test(DoCommandFlag::Execute)) {
308 UpdateElement(*pe, tile, reference, text);
309 InvalidateWindowClassesData(WC_STORY_BOOK, pe->page);
310 }
311
312 return CommandCost();
313}
314
322 CommandCost CmdSetStoryPageTitle(DoCommandFlags flags, StoryPageID page_id, const EncodedString &text)
323{
324 if (_current_company != OWNER_DEITY) return CMD_ERROR;
325 if (!StoryPage::IsValidID(page_id)) return CMD_ERROR;
326
327 if (flags.Test(DoCommandFlag::Execute)) {
328 StoryPage *p = StoryPage::Get(page_id);
329 p->title = text;
330
331 InvalidateWindowClassesData(WC_STORY_BOOK, page_id);
332 }
333
334 return CommandCost();
335}
336
344 CommandCost CmdSetStoryPageDate(DoCommandFlags flags, StoryPageID page_id, TimerGameCalendar::Date date)
345{
346 if (_current_company != OWNER_DEITY) return CMD_ERROR;
347 if (!StoryPage::IsValidID(page_id)) return CMD_ERROR;
348
349 if (flags.Test(DoCommandFlag::Execute)) {
350 StoryPage *p = StoryPage::Get(page_id);
351 p->date = date;
352
353 InvalidateWindowClassesData(WC_STORY_BOOK, page_id);
354 }
355
356 return CommandCost();
357}
358
366 CommandCost CmdShowStoryPage(DoCommandFlags flags, StoryPageID page_id)
367{
368 if (_current_company != OWNER_DEITY) return CMD_ERROR;
369 if (!StoryPage::IsValidID(page_id)) return CMD_ERROR;
370
371 if (flags.Test(DoCommandFlag::Execute)) {
372 StoryPage *g = StoryPage::Get(page_id);
373 if ((g->company != CompanyID::Invalid() && g->company == _local_company) || (g->company == CompanyID::Invalid() && Company::IsValidID(_local_company))) ShowStoryBook(_local_company, page_id, true);
374 }
375
376 return CommandCost();
377}
384 CommandCost CmdRemoveStoryPage(DoCommandFlags flags, StoryPageID page_id)
385{
386 if (_current_company != OWNER_DEITY) return CMD_ERROR;
387 if (!StoryPage::IsValidID(page_id)) return CMD_ERROR;
388
389 if (flags.Test(DoCommandFlag::Execute)) {
390 StoryPage *p = StoryPage::Get(page_id);
391
392 for (StoryPageElement *pe : StoryPageElement::Iterate()) {
393 if (pe->page == p->index) {
394 delete pe;
395 }
396 }
397
398 delete p;
399
400 InvalidateWindowClassesData(WC_STORY_BOOK, -1);
401 if (StoryPage::GetNumItems() == 0) InvalidateWindowData(WC_MAIN_TOOLBAR, 0);
402 }
403
404 return CommandCost();
405}
406
413 CommandCost CmdRemoveStoryPageElement(DoCommandFlags flags, StoryPageElementID page_element_id)
414{
415 if (_current_company != OWNER_DEITY) return CMD_ERROR;
416 if (!StoryPageElement::IsValidID(page_element_id)) return CMD_ERROR;
417
418 if (flags.Test(DoCommandFlag::Execute)) {
419 StoryPageElement *pe = StoryPageElement::Get(page_element_id);
420 StoryPageID page_id = pe->page;
421
422 delete pe;
423
424 InvalidateWindowClassesData(WC_STORY_BOOK, page_id);
425 }
426
427 return CommandCost();
428}
429
438 CommandCost CmdStoryPageButton(DoCommandFlags flags, TileIndex tile, StoryPageElementID page_element_id, VehicleID reference)
439{
440 if (!StoryPageElement::IsValidID(page_element_id)) return CMD_ERROR;
441 const StoryPageElement *const pe = StoryPageElement::Get(page_element_id);
442
443 /* Check the player belongs to the company that owns the page. */
444 const StoryPage *const sp = StoryPage::Get(pe->page);
445 if (sp->company != CompanyID::Invalid() && sp->company != _current_company) return CMD_ERROR;
446
447 switch (pe->type) {
448 case SPET_BUTTON_PUSH:
449 /* No validation required */
450 if (flags.Test(DoCommandFlag::Execute)) Game::NewEvent(new ScriptEventStoryPageButtonClick(_current_company, pe->page, page_element_id));
451 break;
452 case SPET_BUTTON_TILE:
453 if (!IsValidTile(tile)) return CMD_ERROR;
454 if (flags.Test(DoCommandFlag::Execute)) Game::NewEvent(new ScriptEventStoryPageTileSelect(_current_company, pe->page, page_element_id, tile));
455 break;
456 case SPET_BUTTON_VEHICLE:
457 if (!Vehicle::IsValidID(reference)) return CMD_ERROR;
458 if (flags.Test(DoCommandFlag::Execute)) Game::NewEvent(new ScriptEventStoryPageVehicleSelect(_current_company, pe->page, page_element_id, reference));
459 break;
460 default:
461 /* Invalid page element type, not a button. */
462 return CMD_ERROR;
463 }
464
465 return CommandCost();
466}
467
SB
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
Definition bitmath_func.hpp:58
GB
static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
Definition bitmath_func.hpp:32
BaseBitSet::Test
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
Definition base_bitset_type.hpp:141
CommandCost
Common return value for all commands.
Definition command_type.h:24
EncodedString
Container for an encoded string, created by GetEncodedString.
Definition strings_type.h:98
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
Game::NewEvent
static void NewEvent(class ScriptEvent *event)
Queue a new event for a Game Script.
Definition game_core.cpp:136
TimerGameCalendar::date
static Date date
Current date in days (day counter).
Definition timer_game_calendar.h:33
command_func.h
Functions related to commands.
CMD_ERROR
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
Definition command_func.h:28
DoCommandFlag::Execute
@ Execute
execute the given command
company_base.h
Definition of stuff that is very close to a company, like the company struct itself.
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition company_cmd.cpp:55
_current_company
CompanyID _current_company
Company currently doing an action.
Definition company_cmd.cpp:56
company_func.h
Functions related to companies.
OWNER_DEITY
static constexpr Owner OWNER_DEITY
The object is owned by a superuser / goal script.
Definition company_type.h:28
game.hpp
Base functions for all Games.
goal_base.h
Goal base class.
goal_type.h
basic types related to goals
gui.h
GUI functions that shouldn't be here.
ShowStoryBook
void ShowStoryBook(CompanyID company, StoryPageID page_id=StoryPageID::Invalid(), bool centered=false)
Raise or create the story book window for company, at page page_id.
Definition story_gui.cpp:1043
IsValidColours
bool IsValidColours(Colours colours)
Checks if a Colours value is valid.
Definition palette_func.h:65
pool_func.hpp
Some methods of Pool are placed here in order to reduce compilation time and binary size.
INSTANTIATE_POOL_METHODS
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
Definition pool_func.hpp:210
safeguards.h
A number of safeguards to prevent using unsafe methods.
stdafx.h
Definition of base types and functions in a cross-platform compatible way.
CmdCreateStoryPageElement
std::tuple< CommandCost, StoryPageElementID > CmdCreateStoryPageElement(DoCommandFlags flags, TileIndex tile, StoryPageID page_id, StoryPageElementType type, uint32_t reference, const EncodedString &text)
Create a new story page element.
Definition story.cpp:253
VerifyElementContentParameters
static bool VerifyElementContentParameters(StoryPageID page_id, StoryPageElementType type, TileIndex tile, uint32_t reference, const EncodedString &text)
This helper for Create/Update PageElement Cmd procedure verifies if the page element parameters are c...
Definition story.cpp:59
CmdCreateStoryPage
std::tuple< CommandCost, StoryPageID > CmdCreateStoryPage(DoCommandFlags flags, CompanyID company, const EncodedString &text)
Create a new story page.
Definition story.cpp:218
CmdUpdateStoryPageElement
CommandCost CmdUpdateStoryPageElement(DoCommandFlags flags, TileIndex tile, StoryPageElementID page_element_id, uint32_t reference, const EncodedString &text)
Update a new story page element.
Definition story.cpp:296
UpdateElement
static void UpdateElement(StoryPageElement &pe, TileIndex tile, uint32_t reference, const EncodedString &text)
This helper for Create/Update PageElement Cmd procedure updates a page element with new content data.
Definition story.cpp:106
CmdRemoveStoryPageElement
CommandCost CmdRemoveStoryPageElement(DoCommandFlags flags, StoryPageElementID page_element_id)
Remove a story page element.
Definition story.cpp:413
CmdRemoveStoryPage
CommandCost CmdRemoveStoryPage(DoCommandFlags flags, StoryPageID page_id)
Remove a story page and associated story page elements.
Definition story.cpp:384
CmdStoryPageButton
CommandCost CmdStoryPageButton(DoCommandFlags flags, TileIndex tile, StoryPageElementID page_element_id, VehicleID reference)
Clicked/used a button on a story page.
Definition story.cpp:438
CmdSetStoryPageTitle
CommandCost CmdSetStoryPageTitle(DoCommandFlags flags, StoryPageID page_id, const EncodedString &text)
Update title of a story page.
Definition story.cpp:322
CmdSetStoryPageDate
CommandCost CmdSetStoryPageDate(DoCommandFlags flags, StoryPageID page_id, TimerGameCalendar::Date date)
Update date of a story page.
Definition story.cpp:344
CmdShowStoryPage
CommandCost CmdShowStoryPage(DoCommandFlags flags, StoryPageID page_id)
Display a story page for all clients that are allowed to view the story page.
Definition story.cpp:366
story_base.h
StoryPage base class.
StoryPageButtonFlags
StoryPageButtonFlags
Flags available for buttons.
Definition story_base.h:43
StoryPageElementType
StoryPageElementType
Definition story_base.h:31
SPET_LOCATION
@ SPET_LOCATION
An element that references a tile along with a one-line text.
Definition story_base.h:33
SPET_GOAL
@ SPET_GOAL
An element that references a goal.
Definition story_base.h:34
SPET_BUTTON_PUSH
@ SPET_BUTTON_PUSH
A push button that triggers an immediate event.
Definition story_base.h:35
SPET_BUTTON_TILE
@ SPET_BUTTON_TILE
A button that allows the player to select a tile, and triggers an event with the tile.
Definition story_base.h:36
SPET_TEXT
@ SPET_TEXT
A text element.
Definition story_base.h:32
SPET_BUTTON_VEHICLE
@ SPET_BUTTON_VEHICLE
A button that allows the player to select a vehicle, and triggers an event with the vehicle.
Definition story_base.h:37
StoryPageButtonCursor
StoryPageButtonCursor
Mouse cursors usable by story page buttons.
Definition story_base.h:51
IsValidStoryPageButtonCursor
bool IsValidStoryPageButtonCursor(StoryPageButtonCursor cursor)
Checks if a StoryPageButtonCursor value is valid.
Definition story_base.h:117
story_cmd.h
Command definitions related to stories.
string_func.h
Functions related to low-level strings.
PoolID< uint16_t, struct StoryPageIDTag, 64000, 0xFFFF >
Pool::PoolItem<&_story_page_pool >::Iterate
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Definition pool_type.hpp:436
Pool::PoolItem<&_story_page_pool >::Get
static Titem * Get(auto index)
Returns Titem with given index.
Definition pool_type.hpp:387
Pool::PoolItem<&_story_page_pool >::GetNumItems
static size_t GetNumItems()
Returns number of valid items in the pool.
Definition pool_type.hpp:417
Pool::PoolItem::index
Tindex index
Index of this pool item.
Definition pool_type.hpp:286
Pool::PoolItem<&_story_page_pool >::CanAllocateItem
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
Definition pool_type.hpp:357
Pool::PoolItem<&_goal_pool >::IsValidID
static bool IsValidID(auto index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition pool_type.hpp:376
Pool::PoolItem<&_story_page_pool >::CleaningPool
static bool CleaningPool()
Returns current state of pool cleaning - yes or no.
Definition pool_type.hpp:366
Pool
Base class for all pools.
Definition pool_type.hpp:133
StoryPageButtonData
Helper to construct packed "id" values for button-type StoryPageElement.
Definition story_base.h:123
StoryPageButtonData::GetColour
Colours GetColour() const
Get the button background colour.
Definition story.cpp:156
StoryPageButtonData::GetVehicleType
VehicleType GetVehicleType() const
Get the type of vehicles that are accepted by the button.
Definition story.cpp:177
StoryPageButtonData::SetColour
void SetColour(Colours button_colour)
Set the button background colour.
Definition story.cpp:130
StoryPageButtonData::ValidateVehicleType
bool ValidateVehicleType() const
Verity that the data stored a valid VehicleType value.
Definition story.cpp:205
StoryPageButtonData::ValidateColour
bool ValidateColour() const
Verify that the data stored a valid Colour value.
Definition story.cpp:183
StoryPageButtonData::SetVehicleType
void SetVehicleType(VehicleType vehtype)
Set the type of vehicles that are accepted by the button.
Definition story.cpp:149
StoryPageButtonData::GetCursor
StoryPageButtonCursor GetCursor() const
Get the mouse cursor used while waiting for input for the button.
Definition story.cpp:169
StoryPageButtonData::ValidateCursor
bool ValidateCursor() const
Verify that the data stores a valid StoryPageButtonCursor value.
Definition story.cpp:199
StoryPageButtonData::SetCursor
void SetCursor(StoryPageButtonCursor cursor)
Set the mouse cursor used while waiting for input for the button.
Definition story.cpp:142
StoryPageElement
Struct about story page elements.
Definition story_base.h:145
StoryPageElement::referenced_id
uint32_t referenced_id
Id of referenced object (location, goal etc.)
Definition story_base.h:150
StoryPageElement::text
EncodedString text
Static content text of page element.
Definition story_base.h:151
StoryPageElement::type
StoryPageElementType type
Type of page element.
Definition story_base.h:148
StoryPageElement::page
StoryPageID page
Id of the page which the page element belongs to.
Definition story_base.h:147
StoryPage
Struct about stories, current and completed.
Definition story_base.h:167
StoryPage::title
EncodedString title
Title of story page.
Definition story_base.h:172
StoryPage::company
CompanyID company
StoryPage is for a specific company; CompanyID::Invalid() if it is global.
Definition story_base.h:170
StoryPage::date
TimerGameCalendar::Date date
Date when the page was created.
Definition story_base.h:169
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
tile_map.h
Map writing/reading functions for tiles.
IsValidTile
bool IsValidTile(Tile tile)
Checks if a tile is valid.
Definition tile_map.h:161
timer_game_calendar.h
Definition of the game-calendar-timer.
vehicle_base.h
Base class for all vehicles.
VehicleType
VehicleType
Available vehicle types.
Definition vehicle_type.h:22
VEH_INVALID
@ VEH_INVALID
Non-existing type of vehicle.
Definition vehicle_type.h:36
VEH_COMPANY_END
@ VEH_COMPANY_END
Last company-ownable type.
Definition vehicle_type.h:30
InvalidateWindowData
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
Definition window.cpp:3297
InvalidateWindowClassesData
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
Definition window.cpp:3314
window_func.h
Window functions not directly related to making/drawing windows.
WC_STORY_BOOK
@ WC_STORY_BOOK
Story book; Window numbers:
Definition window_type.h:301
WC_MAIN_TOOLBAR
@ WC_MAIN_TOOLBAR
Main toolbar (the long bar at the top); Window numbers:
Definition window_type.h:63