Go to the documentation of this file.
32 #include "table/strings.h"
50 typedef std::vector<LayoutCacheElement> LayoutCache;
52 enum class ElementFloat {
75 this->story_pages.clear();
78 if (this->IsPageAvailable(p)) {
79 this->story_pages.push_back(p);
83 this->story_pages.shrink_to_fit();
87 this->story_pages.
Sort();
100 this->story_page_elements.clear();
105 if (pe->page == p->
index) {
106 this->story_page_elements.push_back(pe);
111 this->story_page_elements.shrink_to_fit();
115 this->story_page_elements.
Sort();
130 bool IsPageAvailable(
const StoryPage *page)
const
152 for (
const StoryPage *p : this->story_pages) {
153 if (p->index == this->selected_page_id) {
167 if (!_story_page_pool.
IsValidID(this->selected_page_id))
return false;
178 if (!_story_page_pool.
IsValidID(this->selected_page_id))
return false;
180 if (this->story_pages.size() <= 1)
return true;
181 const StoryPage *last = this->story_pages.back();
192 if (page !=
nullptr && page->
title ==
nullptr) {
213 if (!_story_page_pool.
IsValidID(this->selected_page_id))
return;
217 last_available =
nullptr;
218 for (
const StoryPage *p : this->story_pages) {
219 if (p->index == this->selected_page_id) {
220 if (last_available ==
nullptr)
return;
233 if (!_story_page_pool.
IsValidID(this->selected_page_id))
return;
236 for (
auto iter = this->story_pages.begin(); iter != this->story_pages.end(); iter++) {
238 if (p->
index == this->selected_page_id) {
241 if (iter != this->story_pages.end()) {
256 for (
const StoryPage *p : this->story_pages) {
259 if (p->title !=
nullptr) {
265 str_item->SetParam(0, page_num);
269 list.emplace_back(item);
294 if (page ==
nullptr)
return 0;
316 if (g ==
nullptr)
return SPR_IMG_GOAL_BROKEN_REF;
317 return g->
completed ? SPR_IMG_GOAL_COMPLETED : SPR_IMG_GOAL;
320 return SPR_IMG_VIEW_LOCATION;
342 return sprite_dim.height;
370 if (
flags & SPBF_FLOAT_LEFT)
return ElementFloat::Left;
371 if (
flags & SPBF_FLOAT_RIGHT)
return ElementFloat::Right;
372 return ElementFloat::None;
376 return ElementFloat::None;
403 this->layout_cache.clear();
410 if (!this->layout_cache.empty())
return;
413 if (page ==
nullptr)
return;
422 int right_y = main_y;
427 std::vector<size_t> left_floats;
428 std::vector<size_t> right_floats;
434 if (fl == ElementFloat::None) {
437 int left_offset = (left_width == 0) ? 0 : (left_width + element_dist);
438 int right_offset = (right_width == 0) ? 0 : (right_width + element_dist);
439 if (left_offset + right_offset + min_required_width >= max_width) {
441 main_y = std::max(main_y, left_y);
442 main_y = std::max(main_y, right_y);
443 left_width = right_width = 0;
444 left_offset = right_offset = 0;
448 const int available_width = max_width - left_offset - right_offset;
451 if (left_offset == 0 && right_offset == 0) {
456 left_offset = right_offset = available_width / 5;
464 ce.bounds.left = left_offset;
465 ce.bounds.right = max_width - right_offset;
466 ce.bounds.top = main_y;
468 ce.bounds.bottom = main_y;
469 this->layout_cache.push_back(ce);
470 main_y += element_dist;
472 left_width = right_width = 0;
473 left_y = right_y = main_y = std::max({main_y, left_y, right_y});
475 right_floats.clear();
478 int &cur_width = (fl == ElementFloat::Left) ? left_width : right_width;
479 int &cur_y = (fl == ElementFloat::Left) ? left_y : right_y;
480 std::vector<size_t> &cur_floats = (fl == ElementFloat::Left) ? left_floats : right_floats;
484 ce.bounds.left = (fl == ElementFloat::Left) ? 0 : (max_width - cur_width);
485 ce.bounds.right = (fl == ElementFloat::Left) ? cur_width : max_width;
486 ce.bounds.top = cur_y;
488 ce.bounds.bottom = cur_y;
489 cur_floats.push_back(this->layout_cache.size());
490 this->layout_cache.push_back(ce);
491 cur_y += element_dist;
493 for (
size_t index : cur_floats) {
495 ce.bounds.left = (fl == ElementFloat::Left) ? 0 : (max_width - cur_width);
496 ce.bounds.right = (fl == ElementFloat::Left) ? cur_width : max_width;
511 uint max_y = std::accumulate(this->layout_cache.begin(), this->layout_cache.end(), 0, [](uint max_y,
const LayoutCacheElement &ce) -> uint { return std::max<uint>(max_y, ce.bounds.bottom); });
530 uint element_height = std::max(sprite_dim.height, (uint)line_height);
532 uint sprite_top = y_offset + (element_height - sprite_dim.height) / 2;
533 uint text_top = y_offset + (element_height - line_height) / 2;
535 DrawSprite(action_sprite, PAL_NONE, 0, sprite_top);
538 y_offset += element_height;
566 this->active_button_id = pe.
index;
574 if (this->active_button_id == pe.
index) {
576 this->active_button_id = INVALID_STORY_PAGE_ELEMENT;
580 this->active_button_id = pe.
index;
586 if (this->active_button_id == pe.
index) {
588 this->active_button_id = INVALID_STORY_PAGE_ELEMENT;
592 this->active_button_id = pe.
index;
610 this->story_pages.
SetSortFuncs(StoryBookWindow::page_sorter_funcs);
613 this->story_page_elements.
SetSortFuncs(StoryBookWindow::page_element_sorter_funcs);
620 this->selected_generic_title[0] =
'\0';
621 this->selected_page_id = INVALID_STORY_PAGE;
623 this->active_button_id = INVALID_STORY_PAGE_ELEMENT;
645 if (this->selected_page_id != page_index) {
647 this->active_button_id = INVALID_STORY_PAGE_ELEMENT;
648 this->selected_page_id = page_index;
664 SetDParam(0, STR_STORY_BOOK_SPECTATOR_CAPTION);
679 if (this->vscroll->
GetCount() != this->GetContentHeight()) {
693 if (page ==
nullptr)
return;
707 const int scrollpos = this->vscroll->
GetPosition();
708 int y_offset = -scrollpos;
713 DrawString(0, fr.right, y_offset, STR_JUST_DATE_LONG, TC_BLACK);
715 y_offset += line_height;
724 y_offset = ce.bounds.top - scrollpos;
725 switch (ce.pe->type) {
728 y_offset =
DrawStringMultiLine(ce.bounds.left, ce.bounds.right, ce.bounds.top - scrollpos, ce.bounds.bottom - scrollpos, STR_JUST_RAW_STRING, TC_BLACK,
SA_TOP |
SA_LEFT);
733 StringID string_id = g ==
nullptr ? STR_STORY_BOOK_INVALID_GOAL_REF : STR_JUST_RAW_STRING;
751 DrawFrameRect(ce.bounds.left, ce.bounds.top - scrollpos, ce.bounds.right, ce.bounds.bottom - scrollpos - 1, bgcolour, frame);
758 default: NOT_REACHED();
778 for (
size_t i = 0; i < this->story_pages.size(); i++) {
779 const StoryPage *s = this->story_pages[i];
781 if (s->
title !=
nullptr) {
788 if (title_d.width > d.width) {
789 d.width = title_d.width;
793 d.width += padding.width;
794 d.height += padding.height;
824 for (
size_t i = 0; i < this->story_pages.size(); i++) {
825 const StoryPage *p = this->story_pages[i];
826 if (p->
index == this->selected_page_id)
break;
848 if (clicked_y >= ce.bounds.top && clicked_y < ce.bounds.bottom && pt.x >= ce.bounds.left && pt.x < ce.bounds.right) {
874 if (!gui_scope)
return;
884 if (this->story_pages.size() == 0) {
885 this->selected_generic_title[0] =
'\0';
889 if (!_story_page_pool.
IsValidID(this->selected_page_id)) {
890 this->selected_page_id = INVALID_STORY_PAGE;
892 if (this->selected_page_id == INVALID_STORY_PAGE && this->story_pages.size() > 0) {
902 }
else if (data >= 0 && this->selected_page_id == data) {
909 this->active_button_id = INVALID_STORY_PAGE_ELEMENT;
918 this->active_button_id = INVALID_STORY_PAGE_ELEMENT;
927 bool OnVehicleSelect(
const Vehicle *v)
override
932 this->active_button_id = INVALID_STORY_PAGE_ELEMENT;
939 VehicleType wanted_vehtype = data.GetVehicleType();
940 if (wanted_vehtype !=
VEH_INVALID && wanted_vehtype != v->
type)
return false;
949 this->active_button_id = INVALID_STORY_PAGE_ELEMENT;
959 &PageElementOrderSorter,
962 static const NWidgetPart _nested_story_book_widgets[] = {
987 _nested_story_book_widgets,
lengthof(_nested_story_book_widgets)
994 case SPBC_ZZZ:
return SPR_CURSOR_ZZZ;
995 case SPBC_BUOY:
return SPR_CURSOR_BUOY;
996 case SPBC_QUERY:
return SPR_CURSOR_QUERY;
997 case SPBC_HQ:
return SPR_CURSOR_HQ;
998 case SPBC_SHIP_DEPOT:
return SPR_CURSOR_SHIP_DEPOT;
999 case SPBC_SIGN:
return SPR_CURSOR_SIGN;
1000 case SPBC_TREE:
return SPR_CURSOR_TREE;
1001 case SPBC_BUY_LAND:
return SPR_CURSOR_BUY_LAND;
1002 case SPBC_LEVEL_LAND:
return SPR_CURSOR_LEVEL_LAND;
1003 case SPBC_TOWN:
return SPR_CURSOR_TOWN;
1004 case SPBC_INDUSTRY:
return SPR_CURSOR_INDUSTRY;
1005 case SPBC_ROCKY_AREA:
return SPR_CURSOR_ROCKY_AREA;
1006 case SPBC_DESERT:
return SPR_CURSOR_DESERT;
1007 case SPBC_TRANSMITTER:
return SPR_CURSOR_TRANSMITTER;
1008 case SPBC_AIRPORT:
return SPR_CURSOR_AIRPORT;
1009 case SPBC_DOCK:
return SPR_CURSOR_DOCK;
1010 case SPBC_CANAL:
return SPR_CURSOR_CANAL;
1011 case SPBC_LOCK:
return SPR_CURSOR_LOCK;
1012 case SPBC_RIVER:
return SPR_CURSOR_RIVER;
1013 case SPBC_AQUEDUCT:
return SPR_CURSOR_AQUEDUCT;
1014 case SPBC_BRIDGE:
return SPR_CURSOR_BRIDGE;
1015 case SPBC_RAIL_STATION:
return SPR_CURSOR_RAIL_STATION;
1016 case SPBC_TUNNEL_RAIL:
return SPR_CURSOR_TUNNEL_RAIL;
1017 case SPBC_TUNNEL_ELRAIL:
return SPR_CURSOR_TUNNEL_ELRAIL;
1018 case SPBC_TUNNEL_MONO:
return SPR_CURSOR_TUNNEL_MONO;
1019 case SPBC_TUNNEL_MAGLEV:
return SPR_CURSOR_TUNNEL_MAGLEV;
1020 case SPBC_AUTORAIL:
return SPR_CURSOR_AUTORAIL;
1021 case SPBC_AUTOELRAIL:
return SPR_CURSOR_AUTOELRAIL;
1022 case SPBC_AUTOMONO:
return SPR_CURSOR_AUTOMONO;
1023 case SPBC_AUTOMAGLEV:
return SPR_CURSOR_AUTOMAGLEV;
1024 case SPBC_WAYPOINT:
return SPR_CURSOR_WAYPOINT;
1025 case SPBC_RAIL_DEPOT:
return SPR_CURSOR_RAIL_DEPOT;
1026 case SPBC_ELRAIL_DEPOT:
return SPR_CURSOR_ELRAIL_DEPOT;
1027 case SPBC_MONO_DEPOT:
return SPR_CURSOR_MONO_DEPOT;
1028 case SPBC_MAGLEV_DEPOT:
return SPR_CURSOR_MAGLEV_DEPOT;
1029 case SPBC_CONVERT_RAIL:
return SPR_CURSOR_CONVERT_RAIL;
1030 case SPBC_CONVERT_ELRAIL:
return SPR_CURSOR_CONVERT_ELRAIL;
1031 case SPBC_CONVERT_MONO:
return SPR_CURSOR_CONVERT_MONO;
1032 case SPBC_CONVERT_MAGLEV:
return SPR_CURSOR_CONVERT_MAGLEV;
1033 case SPBC_AUTOROAD:
return SPR_CURSOR_AUTOROAD;
1034 case SPBC_AUTOTRAM:
return SPR_CURSOR_AUTOTRAM;
1035 case SPBC_ROAD_DEPOT:
return SPR_CURSOR_ROAD_DEPOT;
1036 case SPBC_BUS_STATION:
return SPR_CURSOR_BUS_STATION;
1037 case SPBC_TRUCK_STATION:
return SPR_CURSOR_TRUCK_STATION;
1038 case SPBC_ROAD_TUNNEL:
return SPR_CURSOR_ROAD_TUNNEL;
1039 case SPBC_CLONE_TRAIN:
return SPR_CURSOR_CLONE_TRAIN;
1040 case SPBC_CLONE_ROADVEH:
return SPR_CURSOR_CLONE_ROADVEH;
1041 case SPBC_CLONE_SHIP:
return SPR_CURSOR_CLONE_SHIP;
1042 case SPBC_CLONE_AIRPLANE:
return SPR_CURSOR_CLONE_AIRPLANE;
1048 default:
return SPR_CURSOR_QUERY;
1061 StoryBookWindow *w = AllocateWindowDescFront<StoryBookWindow>(&_story_book_desc, company,
true);
uint32 sort_value
A number that increases for every created story page element. Used for sorting. The id of a story pag...
bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
void SetTimeout()
Set the timeout flag of the window and initiate the timer.
@ SPET_TEXT
A text element.
Struct about goals, current and completed.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
int GetSelPageNum() const
Get the page number of selected page.
int Height() const
Get height of Rect.
static Titem * Get(size_t index)
Returns Titem with given index.
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
void ShowGoalsList(CompanyID company)
Open a goal list window.
String list item with parameters.
void ShowExtraViewportWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
Dimensions (a width and height) of a rectangle in 2D.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
bool Sort(Comp compare)
Sort the list.
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
static const CursorID ANIMCURSOR_RAISELAND
696 - 698 - raise land tool
StoryPageButtonFlags
Flags available for buttons.
int GetPageElementFloatWidth(const StoryPageElement &pe) const
Get the width a page element would use if it was floating left or right.
@ WID_SB_NEXT_PAGE
Next button.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
SpriteID GetPageElementSprite(const StoryPageElement &pe) const
Decides which sprite to display for a given page element.
uint GetAvailablePageContentWidth() const
Get the width available for displaying content on the page panel.
DropDownList BuildDropDownList() const
Builds the page selector drop down list.
FrameFlags
Flags to describe the look of the frame.
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
Tindex index
Index of this pool item.
List item containing a C char string.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
static const CursorID ANIMCURSOR_BUILDSIGNALS
1292 - 1293 - build signal
@ SPET_BUTTON_PUSH
A push button that triggers an immediate event.
LayoutCache layout_cache
Cached element layout.
bool _ctrl_pressed
Is Ctrl pressed?
void SelectNextPage()
Selects the next available page after the currently selected page.
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
@ SPET_GOAL
An element that references a goal.
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
uint32 sort_value
A number that increases for every created story page. Used for sorting. The id of a story page is the...
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
int32 WindowNumber
Number to differentiate different windows of the same class.
@ FR_LOWERED
If set the frame is lowered and the background colour brighter (ie. buttons when pressed)
Owner
Enum for all companies/owners.
void OnTimeout() override
Called when this window's timeout has been reached.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
@ WID_SB_PAGE_PANEL
Page body.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
uint32 referenced_id
Id of referenced object (location, goal etc.)
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
char selected_generic_title[255]
If the selected page doesn't have a custom title, this buffer is used to store a generic page title.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
@ SPET_BUTTON_VEHICLE
A button that allows the player to select a vehicle, and triggers an event wih the vehicle.
High level window description.
@ WC_STORY_BOOK
Story book; Window numbers:
static const CursorID ANIMCURSOR_PICKSTATION
716 - 718 - goto-order icon
Scrollbar * vscroll
Scrollbar of the page text.
@ SPET_BUTTON_TILE
A button that allows the player to select a tile, and triggers an event with the tile.
ResizeInfo resize
Resize information.
StoryPageElementType type
Type of page element.
uint32 CursorID
The number of the cursor (sprite)
@ FS_NORMAL
Index of the normal font in the font tables.
@ SA_TOP
Top align the text.
Rect Translate(int x, int y) const
Copy and translate Rect by x,y pixels.
GUIStoryPageElementList story_page_elements
Sorted list of page elements that belong to the current page.
int height
Height of the window (number of pixels down in y direction)
uint16 StoryPageID
ID of a story page.
bool SortFunction(const const StoryPage * &, const const StoryPage * &)
Signature of sort function.
void SelectPrevPage()
Selects the previous available page before the currently selected page.
uint Horizontal() const
Get total horizontal padding of RectPadding.
StoryPage * GetSelPage() const
Get instance of selected page.
void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width, bool auto_width, bool instant_close)
Show a drop down list.
void InvalidateStoryPageElementLayout()
Invalidate the current page layout.
Struct about stories, current and completed.
void RefreshSelectedPage()
Updates the content of selected page.
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
uint GetHeadHeight(int max_width) const
Counts how many pixels of height that are used by Date and Title (excluding marginal after Title,...
@ WID_SB_CAPTION
Caption of the window.
void OnPageElementClick(const StoryPageElement &pe)
Internal event handler for when a page element is clicked.
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
WindowFlags flags
Window flags.
@ VEH_INVALID
Non-existing type of vehicle.
StoryPageID selected_page_id
Pool index of selected page.
@ SPET_LOCATION
An element that references a tile along with a one-line text.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
void SetSelectedPage(uint16 page_index)
Sets the selected page.
Coordinates of a point in 2D.
StoryPageButtonCursor
Mouse cursors usable by story page buttons.
uint GetPageElementHeight(const StoryPageElement &pe, int max_width) const
Get the height in pixels used by a page element.
WindowNumber window_number
Window number within the window class.
VehicleType
Available vehicle types.
uint Vertical() const
Get total vertical padding of RectPadding.
char * title
Title of story page.
Titem * Get(size_t index)
Returns Titem with given index.
void ShowStoryBook(CompanyID company, uint16 page_id)
Raise or create the story book window for company, at page page_id.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
@ SA_HOR_CENTER
Horizontally center the text.
void OnDropdownSelect(int widget, int index) override
A dropdown option associated to this window has been selected.
@ HT_VEHICLE
vehicle is accepted as target as well (bitmask)
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
int GetStringHeight(const char *str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
bool NeedRebuild() const
Check if a rebuild is needed.
bool IsFirstPageSelected()
Check if the selected page is also the first available page.
void DrawActionElement(int &y_offset, int width, int line_height, SpriteID action_sprite, StringID string_id=STR_JUST_RAW_STRING) const
Draws a page element that is composed of a sprite to the left and a single line of text after that.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
static bool PageElementOrderSorter(const StoryPageElement *const &a, const StoryPageElement *const &b)
Sort story page elements by order value.
static const Date INVALID_DATE
Representation of an invalid date.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
bool completed
Is the goal completed or not?
@ WID_SB_PREV_PAGE
Prev button.
void OnResize() override
Called after the window got resized.
GUIStoryPageList story_pages
Sorted list of pages.
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
uint16 StoryPageElementID
ID of a story page element.
@ HT_RECT
rectangle (stations, depots, ...)
Struct about story page elements.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
@ SA_LEFT
Left align the text.
void ForceRebuild()
Force that a rebuild is needed.
@ SA_CENTER
Center both horizontally and vertically.
#define lengthof(x)
Return the length of an fixed size array.
int width
width of the window (number of pixels to the right in x direction)
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w)
Change the cursor and mouse click/drag handling to a mode for performing special operations like tile...
@ INVALID_COMPANY
An invalid company.
char * text
Static content text of page element.
static const CursorID SPR_CURSOR_MOUSE
Cursor sprite numbers.
Helper to construct packed "id" values for button-type StoryPageElement.
static bool PageOrderSorter(const StoryPage *const &a, const StoryPage *const &b)
Sort story pages by order value.
Data structure for an opened window.
void RebuildDone()
Notify the sortlist that the rebuild is done.
@ WID_SB_SEL_PAGE
Page selector.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
VehicleType type
Type of vehicle.
void DrawWidgets() const
Paint all widgets of a window.
void UpdatePrevNextDisabledState()
Updates the disabled state of the prev/next buttons.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
int Width() const
Get width of Rect.
void BuildStoryPageList()
(Re)Build story page list.
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
@ WID_SB_SCROLLBAR
Scrollbar of the goal list.
uint16 GoalID
ID of a goal.
Specification of a rectangle with absolute coordinates of all edges.
uint GetContentHeight()
Get the total height of the content displayed in this window.
Date date
Date when the page was created.
#define lastof(x)
Get the last element of an fixed size array.
CompanyID company
StoryPage is for a specific company; INVALID_COMPANY if it is global.
bool IsLastPageSelected()
Check if the selected page is also the last available page.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
@ WDP_CENTER
Center the window.
void OnPaint() override
The window must be repainted.
ElementFloat GetPageElementFloat(const StoryPageElement &pe) const
Get the float style of a page element.
char * text
Text of the goal.
void SetDParamStr(uint n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
void BuildStoryPageElementList()
(Re)Build story page element list.
void SetSortFuncs(SortFunction *const *n_funcs)
Hand the array of sort function pointers to the sort list.
Data about how and where to blit pixels.
void EnsureStoryPageElementLayout() const
Create the page layout if it is missing.
StoryPageElementID active_button_id
Which button element the player is currently using.
static const CursorID ANIMCURSOR_LOWERLAND
699 - 701 - lower land tool