32#include "table/strings.h"
48 typedef std::vector<LayoutCacheElement> LayoutCache;
50 enum class ElementFloat : uint8_t {
66 static const std::initializer_list<GUIStoryPageList::SortFunction * const> page_sorter_funcs;
67 static const std::initializer_list<GUIStoryPageElementList::SortFunction * const> page_element_sorter_funcs;
73 this->story_pages.clear();
77 this->story_pages.push_back(p);
84 this->story_pages.
Sort();
97 this->story_page_elements.clear();
102 if (pe->page == p->index) {
103 this->story_page_elements.push_back(pe);
111 this->story_page_elements.
Sort();
148 for (
const StoryPage *p : this->story_pages) {
149 if (p->index == this->selected_page_id) {
166 return this->story_pages.front()->index == this->selected_page_id;
178 if (this->story_pages.size() <= 1)
return true;
179 const StoryPage *last = this->story_pages.back();
180 return last->index == this->selected_page_id;
190 if (page !=
nullptr && page->
title.empty()) {
214 last_available =
nullptr;
215 for (
const StoryPage *p : this->story_pages) {
216 if (p->index == this->selected_page_id) {
217 if (last_available ==
nullptr)
return;
233 for (
auto iter = this->story_pages.begin(); iter != this->story_pages.end(); iter++) {
235 if (p->index == this->selected_page_id) {
238 if (iter != this->story_pages.end()) {
253 uint16_t page_num = 1;
254 for (
const StoryPage *p : this->story_pages) {
255 bool current_page = p->index == this->selected_page_id;
256 if (!p->title.empty()) {
287 if (page ==
nullptr)
return 0;
308 if (g ==
nullptr)
return SPR_IMG_GOAL_BROKEN_REF;
309 return g->
completed ? SPR_IMG_GOAL_COMPLETED : SPR_IMG_GOAL;
312 return SPR_IMG_VIEW_LOCATION;
333 return sprite_dim.height;
363 return ElementFloat::None;
367 return ElementFloat::None;
394 this->layout_cache.clear();
401 if (!this->layout_cache.empty())
return;
404 if (page ==
nullptr)
return;
413 int right_y = main_y;
418 std::vector<size_t> left_floats;
419 std::vector<size_t> right_floats;
425 if (fl == ElementFloat::None) {
428 int left_offset = (left_width == 0) ? 0 : (left_width + element_dist);
429 int right_offset = (right_width == 0) ? 0 : (right_width + element_dist);
430 if (left_offset + right_offset + min_required_width >= max_width) {
432 main_y = std::max(main_y, left_y);
433 main_y = std::max(main_y, right_y);
434 left_width = right_width = 0;
435 left_offset = right_offset = 0;
439 const int available_width = max_width - left_offset - right_offset;
442 if (left_offset == 0 && right_offset == 0) {
447 left_offset = right_offset = available_width / 5;
455 ce.bounds.left = left_offset;
456 ce.bounds.right = max_width - right_offset;
457 ce.bounds.top = main_y;
459 ce.bounds.bottom = main_y;
460 this->layout_cache.push_back(ce);
461 main_y += element_dist;
463 left_width = right_width = 0;
464 left_y = right_y = main_y = std::max({main_y, left_y, right_y});
466 right_floats.clear();
469 int &cur_width = (fl == ElementFloat::Left) ? left_width : right_width;
470 int &cur_y = (fl == ElementFloat::Left) ? left_y : right_y;
471 std::vector<size_t> &cur_floats = (fl == ElementFloat::Left) ? left_floats : right_floats;
475 ce.bounds.left = (fl == ElementFloat::Left) ? 0 : (max_width - cur_width);
476 ce.bounds.right = (fl == ElementFloat::Left) ? cur_width : max_width;
477 ce.bounds.top = cur_y;
479 ce.bounds.bottom = cur_y;
480 cur_floats.push_back(this->layout_cache.size());
481 this->layout_cache.push_back(ce);
482 cur_y += element_dist;
484 for (
size_t index : cur_floats) {
486 ce.bounds.left = (fl == ElementFloat::Left) ? 0 : (max_width - cur_width);
487 ce.bounds.right = (fl == ElementFloat::Left) ? cur_width : max_width;
502 int32_t max_y = std::accumulate(this->layout_cache.begin(), this->layout_cache.end(), 0, [](int32_t max_y,
const LayoutCacheElement &ce) -> int32_t { return std::max<int32_t>(max_y, ce.bounds.bottom); });
520 uint element_height = std::max(sprite_dim.height, (uint)line_height);
522 uint sprite_top = y_offset + (element_height - sprite_dim.height) / 2;
523 uint text_top = y_offset + (element_height - line_height) / 2;
525 DrawSprite(action_sprite, PAL_NONE, 0, sprite_top);
528 y_offset += element_height;
556 this->active_button_id = pe.index;
560 Command<Commands::StoryPageButton>::Post(
TileIndex{}, pe.index, VehicleID::Invalid());
564 if (this->active_button_id == pe.index) {
566 this->active_button_id = StoryPageElementID::Invalid();
570 this->active_button_id = pe.index;
576 if (this->active_button_id == pe.index) {
578 this->active_button_id = StoryPageElementID::Invalid();
582 this->active_button_id = pe.index;
600 this->story_pages.
SetSortFuncs(StoryBookWindow::page_sorter_funcs);
603 this->story_page_elements.
SetSortFuncs(StoryBookWindow::page_element_sorter_funcs);
607 this->
owner = this->window_number;
610 this->selected_generic_title.clear();
611 this->selected_page_id = StoryPageID::Invalid();
613 this->active_button_id = StoryPageElementID::Invalid();
635 if (this->selected_page_id != page_index) {
637 this->active_button_id = StoryPageElementID::Invalid();
638 this->selected_page_id = page_index;
653 if (this->window_number == CompanyID::Invalid()) {
654 return GetString(STR_STORY_BOOK_SPECTATOR_CAPTION);
656 return GetString(STR_STORY_BOOK_CAPTION, this->window_number);
669 if (this->vscroll->
GetCount() != this->GetContentHeight()) {
683 if (page ==
nullptr)
return;
696 const int scrollpos = this->vscroll->
GetPosition();
697 int y_offset = -scrollpos;
703 y_offset += line_height;
712 if (ce.bounds.bottom - scrollpos < fr.top)
continue;
714 y_offset = ce.bounds.top - scrollpos;
715 if (y_offset > fr.bottom)
return;
717 switch (ce.pe->type) {
732 ce.pe->text.GetDecodedString());
742 DrawFrameRect(ce.bounds.left, ce.bounds.top - scrollpos, ce.bounds.right, ce.bounds.bottom - scrollpos - 1, bgcolour, frame);
749 default: NOT_REACHED();
766 for (
size_t i = 0; i < this->story_pages.size(); i++) {
767 const StoryPage *s = this->story_pages[i];
770 if (title_d.width > d.width) {
771 d.width = title_d.width;
775 d.width += padding.width;
776 d.height += padding.height;
806 for (
size_t i = 0; i < this->story_pages.size(); i++) {
807 const StoryPage *p = this->story_pages[i];
808 if (p->index == this->selected_page_id)
break;
830 if (clicked_y >= ce.bounds.top && clicked_y < ce.bounds.bottom && pt.x >= ce.bounds.left && pt.x < ce.bounds.right) {
854 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
856 if (!gui_scope)
return;
866 if (this->story_pages.empty()) {
867 this->selected_generic_title.clear();
872 this->selected_page_id = StoryPageID::Invalid();
874 if (this->selected_page_id == StoryPageID::Invalid() && !this->story_pages.empty()) {
884 }
else if (data >= 0 && this->selected_page_id == data) {
891 this->active_button_id = StoryPageElementID::Invalid();
900 this->active_button_id = StoryPageElementID::Invalid();
905 Command<Commands::StoryPageButton>::Post(tile, pe->index, VehicleID::Invalid());
909 bool OnVehicleSelect(
const Vehicle *v)
override
914 this->active_button_id = StoryPageElementID::Invalid();
924 Command<Commands::StoryPageButton>::Post(
TileIndex{}, pe->index, v->index);
931 this->active_button_id = StoryPageElementID::Invalid();
936const std::initializer_list<GUIStoryPageList::SortFunction * const> StoryBookWindow::page_sorter_funcs = {
940const std::initializer_list<GUIStoryPageElementList::SortFunction * const> StoryBookWindow::page_element_sorter_funcs = {
941 &PageElementOrderSorter,
944static constexpr std::initializer_list<NWidgetPart> _nested_story_book_widgets = {
968 WindowClass::StoryBook, WindowClass::None,
970 _nested_story_book_widgets
976 WindowClass::StoryBook, WindowClass::None,
978 _nested_story_book_widgets
1039 default:
return SPR_CURSOR_QUERY;
@ None
Tile is not animated.
std::string GetDecodedString() const
Decode the encoded string.
List template of 'things' T to sort in a GUI.
void RebuildDone()
Notify the sortlist that the rebuild is done.
bool NeedRebuild() const
Check if a rebuild is needed.
void ForceRebuild()
Force that a rebuild is needed.
bool Sort(Comp compare)
Sort the list.
void SetSortFuncs(std::span< SortFunction *const > n_funcs)
Hand the sort function pointers to the GUIList.
static constexpr TimerGame< struct Calendar >::Date INVALID_DATE
Functions related to commands.
Definition of stuff that is very close to a company, like the company struct itself.
Functions related to companies.
std::unique_ptr< DropDownListItem > MakeDropDownListStringItem(StringID str, int value, bool masked, bool shaded)
Creates new DropDownListStringItem.
void ShowDropDownList(Window *w, DropDownList &&list, int selected, WidgetID button, uint width, DropDownOptions options, std::string *const persistent_filter_text)
Show a drop down list.
Functions related to the drop down widget.
Types related to the drop down widget.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
int GetStringHeight(std::string_view 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.
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
bool _ctrl_pressed
Is Ctrl pressed?
int DrawStringMultiLine(int left, int right, int top, int bottom, std::string_view str, ExtendedTextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
int DrawString(int left, int right, int top, std::string_view str, ExtendedTextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
bool DrawStringMultiLineWithClipping(int left, int right, int top, int bottom, std::string_view str, ExtendedTextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw a multiline string, possibly over multiple lines, if the region is within the current display cl...
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
@ Normal
Index of the normal font in the font tables.
uint32_t CursorID
The number of the cursor (sprite).
@ SA_TOP
Top align the text.
@ SA_LEFT
Left align the text.
@ SA_HOR_CENTER
Horizontally center the text.
@ SA_CENTER
Center both horizontally and vertically.
Colours
One of 16 base colours used for companies and windows/widgets.
void ShowGoalsList(CompanyID company)
Open a goal list window.
PoolID< uint16_t, struct GoalIDTag, 64000, 0xFFFF > GoalID
ID of a goal.
GUI functions that shouldn't be here.
void ShowExtraViewportWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
#define Point
Macro that prevents name conflicts between included headers.
A number of safeguards to prevent using unsafe methods.
Base types for having sorted lists in GUIs.
This file contains all sprite-related enums and defines.
static const CursorID ANIMCURSOR_PICKSTATION
716 - 718 - goto-order icon
static const CursorID ANIMCURSOR_BUILDSIGNALS
1292 - 1293 - build signal
static const CursorID SPR_CURSOR_MOUSE
Cursor sprite numbers.
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
static const CursorID ANIMCURSOR_LOWERLAND
699 - 701 - lower land tool
static const CursorID ANIMCURSOR_RAISELAND
696 - 698 - raise land tool
Definition of base types and functions in a cross-platform compatible way.
@ Goal
An element that references a goal.
@ ButtonTile
A button that allows the player to select a tile, and triggers an event with the tile.
@ ButtonVehicle
A button that allows the player to select a vehicle, and triggers an event with the vehicle.
@ ButtonPush
A push button that triggers an immediate event.
@ Location
An element that references a tile along with a one-line text.
StoryPageButtonCursor
Mouse cursors usable by story page buttons.
@ Desert
Use the Desert cursor.
@ Dock
Use the Dock cursor.
@ BuyLand
Use the Buy Land cursor.
@ River
Use the River cursor.
@ AutoRail
Use the Auto Rail cursor.
@ LowerLand
Use the Lower Land cursor.
@ Waypoint
Use the Waypoint cursor.
@ TruckStation
Use the Truck Station cursor.
@ ConvertMono
Use the Convert Mono cursor.
@ PickStation
Use the Pick Station cursor.
@ MonoDepot
Use the Mono Depot cursor.
@ Sign
Use the Sign cursor.
@ Transmitter
Use the Transmitter cursor.
@ Tree
Use the Tree cursor.
@ Demolish
Use the Demolish cursor.
@ Industry
Use the Industry cursor.
@ AutoMono
Use the Auto Mono cursor.
@ BuildSignals
Use the Build Signals cursor.
@ ConvertRail
Use the Convert Rail cursor.
@ RockyArea
Use the RockyArea cursor.
@ AutoTram
Use the Auto Tram cursor.
@ RailDepot
Use the Rail Depot cursor.
@ Query
Use the Query cursor.
@ RailStation
Use the Rail Station cursor.
@ RoadDepot
Use the Road Depot cursor.
@ TunnelElrail
Use the Tunnel Elrail cursor.
@ MaglevDepot
Use the Maglev Depot cursor.
@ CloneAirplane
Use the Clone Airplane cursor.
@ CloneRoadVeh
Use the Clone Road Veh cursor.
@ RaiseLand
Use the Raise Land cursor.
@ ConvertMaglev
Use the Convert Maglev cursor.
@ CloneShip
Use the Clone Ship cursor.
@ RoadTunnel
Use the Road Tunnel cursor.
@ ShipDepot
Use the Ship Depot cursor.
@ TunnelRail
Use the Tunnel Rail cursor.
@ Canal
Use the Canal cursor.
@ CloneTrain
Use the Clone Train cursor.
@ TunnelMaglev
Use the Tunnel Maglev cursor.
@ Buoy
Use the Buoy cursor.
@ AutoRoad
Use the Auto Road cursor.
@ Lock
Use the Lock cursor.
@ BusStation
Use the Bus Station cursor.
@ Aqueduct
Use the Aqueduct cursor.
@ Town
Use the Town cursor.
@ TunnelMono
Use the Tunnel Mono cursor.
@ ConvertElrail
Use the Convert Elrail cursor.
@ AutoElrail
Use the Auto Elrail cursor.
@ LevelLand
Use the Level Land cursor.
@ Bridge
Use the Bridge cursor.
@ Airport
Use the Airport cursor.
@ ElrailDepot
Use the Elrail Depot cursor.
@ Mouse
Use the Mouse cursor.
@ AutoMaglev
Use the Auto Maglev cursor.
@ FloatLeft
Button will float on the left.
@ FloatRight
Button will float on the right.
EnumBitSet< StoryPageButtonFlag, uint8_t > StoryPageButtonFlags
Bitset of StoryPageButtonFlag elements.
Command definitions related to stories.
void ShowStoryBook(CompanyID company, StoryPageID page_id, bool centered)
Raise or create the story book window for company, at page page_id.
static WindowDesc _story_book_desc(WindowPosition::Automatic, "view_story", 400, 300, WindowClass::StoryBook, WindowClass::None, {}, _nested_story_book_widgets)
Window definition for the story book window.
static WindowDesc _story_book_gs_desc(WindowPosition::Center, "view_story_gs", 400, 300, WindowClass::StoryBook, WindowClass::None, {}, _nested_story_book_widgets)
Window definition for the game script window.
PoolID< uint16_t, struct StoryPageIDTag, 64000, 0xFFFF > StoryPageID
ID of a story page.
PoolID< uint16_t, struct StoryPageElementIDTag, 64000, 0xFFFF > StoryPageElementID
ID of a story page element.
Types related to the story widgets.
@ WID_SB_PAGE_PANEL
Page body.
@ WID_SB_SEL_PAGE
Page selector.
@ WID_SB_SCROLLBAR
Scrollbar of the goal list.
@ WID_SB_CAPTION
Caption of the window.
@ WID_SB_PREV_PAGE
Prev button.
@ WID_SB_NEXT_PAGE
Next button.
std::string GetString(StringID string)
Resolve the given StringID into a std::string with formatting but no parameters.
Functions related to OTTD's strings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Class to backup a specific variable and restore it upon destruction of this object to prevent stack v...
VehicleType type
Type of vehicle.
Dimensions (a width and height) of a rectangle in 2D.
Data about how and where to blit pixels.
Struct about goals, current and completed.
EncodedString text
Text of the goal.
bool completed
Is the goal completed or not?
static Pool::IterateWrapper< StoryPage > Iterate(size_t from=0)
static StoryPage * Get(auto index)
static bool IsValidID(auto index)
static StoryPageElement * GetIfValid(auto index)
Specification of a rectangle with absolute coordinates of all edges.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Rect Translate(int x, int y) const
Copy and translate Rect by x,y pixels.
void OnTimeout() override
Called when this window's timeout has been reached.
void BuildStoryPageList()
(Re)Build story page list.
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
std::string selected_generic_title
If the selected page doesn't have a custom title, this buffer is used to store a generic page title.
void OnPageElementClick(const StoryPageElement &pe)
Internal event handler for when a page element is clicked.
void OnResize() override
Called after the window got resized.
static bool PageElementOrderSorter(const StoryPageElement *const &a, const StoryPageElement *const &b)
Sort story page elements by order value.
uint GetAvailablePageContentWidth() const
Get the width available for displaying content on the page panel.
void OnPaint() override
The window must be repainted.
void SetSelectedPage(StoryPageID page_index)
Sets the selected page.
bool IsFirstPageSelected()
Check if the selected page is also the first available page.
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
DropDownList BuildDropDownList() const
Builds the page selector drop down list.
int GetPageElementFloatWidth(const StoryPageElement &pe) const
Get the width a page element would use if it was floating left or right.
LayoutCache layout_cache
Cached element layout.
void UpdatePrevNextDisabledState()
Updates the disabled state of the prev/next buttons.
Scrollbar * vscroll
Scrollbar of the page text.
void OnDropdownSelect(WidgetID widget, int index, int) override
A dropdown option associated to this window has been selected.
void SelectNextPage()
Selects the next available page after the currently selected page.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
bool IsPageAvailable(const StoryPage *page) const
Checks if a given page should be visible in the story book.
void SelectPrevPage()
Selects the previous available page before the currently selected page.
void RefreshSelectedPage()
Updates the content of selected page.
StoryPageID selected_page_id
Pool index of selected page.
bool IsLastPageSelected()
Check if the selected page is also the last available page.
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
GUIStoryPageList story_pages
Sorted list of pages.
void InvalidateStoryPageElementLayout()
Invalidate the current page layout.
void DrawActionElement(int &y_offset, int width, int line_height, SpriteID action_sprite, const std::string &text) const
Draws a page element that is composed of a sprite to the left and a single line of text after that.
void BuildStoryPageElementList()
(Re)Build story page element list.
StoryPage * GetSelPage() const
Get instance of selected page.
static bool PageOrderSorter(const StoryPage *const &a, const StoryPage *const &b)
Sort story pages by order value.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
StoryPageElementID active_button_id
Which button element the player is currently using.
int32_t GetContentHeight()
Get the total height of the content displayed in this window.
uint GetHeadHeight(int max_width) const
Counts how many pixels of height that are used by Date and Title (excluding marginal after Title,...
uint GetPageElementHeight(const StoryPageElement &pe, int max_width) const
Get the height in pixels used by a page element.
int GetSelPageNum() const
Get the page number of selected page.
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
SpriteID GetPageElementSprite(const StoryPageElement &pe) const
Decides which sprite to display for a given page element.
void EnsureStoryPageElementLayout() const
Create the page layout if it is missing.
GUIStoryPageElementList story_page_elements
Sorted list of page elements that belong to the current page.
ElementFloat GetPageElementFloat(const StoryPageElement &pe) const
Get the float style of a page element.
Helper to construct packed "id" values for button-type StoryPageElement.
Colours GetColour() const
Get the button background colour.
VehicleType GetVehicleType() const
Get the type of vehicles that are accepted by the button.
StoryPageButtonFlags GetFlags() const
Get the button flags.
StoryPageButtonCursor GetCursor() const
Get the mouse cursor used while waiting for input for the button.
Struct about story page elements.
uint32_t referenced_id
Id of referenced object (location, goal etc.).
EncodedString text
Static content text of page element.
uint32_t sort_value
A number that increases for every created story page element. Used for sorting. The id of a story pag...
StoryPageElementType type
Type of page element.
Struct about stories, current and completed.
EncodedString title
Title of story page.
uint32_t sort_value
A number that increases for every created story page. Used for sorting. The id of a story page is the...
CompanyID company
StoryPage is for a specific company; CompanyID::Invalid() if it is global.
TimerGameCalendar::Date date
Date when the page was created.
High level window description.
Number to differentiate different windows of the same class.
Data structure for an opened window.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
void DrawWidgets() const
Paint all widgets of a window.
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
virtual std::string GetWidgetString(WidgetID widget, StringID stringid) const
Get the raw string for a widget.
ResizeInfo resize
Resize information.
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
void SetTimeout()
Set the timeout flag of the window and initiate the timer.
Window(WindowDesc &desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
const NWID * GetWidget(WidgetID widnum) const
Get the nested widget with number widnum from the nested widget tree.
WindowFlags flags
Window flags.
const Scrollbar * GetScrollbar(WidgetID widnum) const
Return the Scrollbar to a widget index.
void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
int height
Height of the window (number of pixels down in y direction).
int width
width of the window (number of pixels to the right in x direction)
WindowNumber window_number
Window number within the window class.
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
Functions related to tile highlights.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
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...
@ HT_RECT
rectangle (stations, depots, ...)
@ HT_VEHICLE
vehicle is accepted as target as well (bitmask)
Base class for all vehicles.
VehicleType
Available vehicle types.
@ Invalid
Non-existing type of vehicle.
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Functions related to (drawing on) viewports.
Window functions not directly related to making/drawing windows.
Functions, definitions and such used only by the GUI.
EnumBitSet< FrameFlag, uint8_t > FrameFlags
Bitset of FrameFlag elements.
@ Lowered
If set the frame is lowered and the background colour brighter (ie. buttons when pressed).
Twindow * AllocateWindowDescFront(WindowDesc &desc, WindowNumber window_number, Targs... extra_arguments)
Open a new window.
@ Automatic
Find a place automatically.
@ Center
Center the window.