31#include "table/strings.h"
47 typedef std::vector<LayoutCacheElement> LayoutCache;
49 enum class ElementFloat : uint8_t {
65 static const std::initializer_list<GUIStoryPageList::SortFunction * const> page_sorter_funcs;
66 static const std::initializer_list<GUIStoryPageElementList::SortFunction * const> page_element_sorter_funcs;
72 this->story_pages.clear();
76 this->story_pages.push_back(p);
83 this->story_pages.
Sort();
96 this->story_page_elements.clear();
101 if (pe->page == p->index) {
102 this->story_page_elements.push_back(pe);
110 this->story_page_elements.
Sort();
147 for (
const StoryPage *p : this->story_pages) {
148 if (p->index == this->selected_page_id) {
165 return this->story_pages.front()->index == this->selected_page_id;
177 if (this->story_pages.size() <= 1)
return true;
178 const StoryPage *last = this->story_pages.back();
179 return last->index == this->selected_page_id;
189 if (page !=
nullptr && page->
title.empty()) {
213 last_available =
nullptr;
214 for (
const StoryPage *p : this->story_pages) {
215 if (p->index == this->selected_page_id) {
216 if (last_available ==
nullptr)
return;
232 for (
auto iter = this->story_pages.begin(); iter != this->story_pages.end(); iter++) {
234 if (p->index == this->selected_page_id) {
237 if (iter != this->story_pages.end()) {
252 uint16_t page_num = 1;
253 for (
const StoryPage *p : this->story_pages) {
254 bool current_page = p->index == this->selected_page_id;
255 if (!p->title.empty()) {
286 if (page ==
nullptr)
return 0;
307 if (g ==
nullptr)
return SPR_IMG_GOAL_BROKEN_REF;
308 return g->
completed ? SPR_IMG_GOAL_COMPLETED : SPR_IMG_GOAL;
311 return SPR_IMG_VIEW_LOCATION;
332 return sprite_dim.height;
362 return ElementFloat::None;
366 return ElementFloat::None;
393 this->layout_cache.clear();
400 if (!this->layout_cache.empty())
return;
403 if (page ==
nullptr)
return;
412 int right_y = main_y;
417 std::vector<size_t> left_floats;
418 std::vector<size_t> right_floats;
424 if (fl == ElementFloat::None) {
427 int left_offset = (left_width == 0) ? 0 : (left_width + element_dist);
428 int right_offset = (right_width == 0) ? 0 : (right_width + element_dist);
429 if (left_offset + right_offset + min_required_width >= max_width) {
431 main_y = std::max(main_y, left_y);
432 main_y = std::max(main_y, right_y);
433 left_width = right_width = 0;
434 left_offset = right_offset = 0;
438 const int available_width = max_width - left_offset - right_offset;
441 if (left_offset == 0 && right_offset == 0) {
446 left_offset = right_offset = available_width / 5;
454 ce.bounds.left = left_offset;
455 ce.bounds.right = max_width - right_offset;
456 ce.bounds.top = main_y;
458 ce.bounds.bottom = main_y;
459 this->layout_cache.push_back(ce);
460 main_y += element_dist;
462 left_width = right_width = 0;
463 left_y = right_y = main_y = std::max({main_y, left_y, right_y});
465 right_floats.clear();
468 int &cur_width = (fl == ElementFloat::Left) ? left_width : right_width;
469 int &cur_y = (fl == ElementFloat::Left) ? left_y : right_y;
470 std::vector<size_t> &cur_floats = (fl == ElementFloat::Left) ? left_floats : right_floats;
474 ce.bounds.left = (fl == ElementFloat::Left) ? 0 : (max_width - cur_width);
475 ce.bounds.right = (fl == ElementFloat::Left) ? cur_width : max_width;
476 ce.bounds.top = cur_y;
478 ce.bounds.bottom = cur_y;
479 cur_floats.push_back(this->layout_cache.size());
480 this->layout_cache.push_back(ce);
481 cur_y += element_dist;
483 for (
size_t index : cur_floats) {
485 ce.bounds.left = (fl == ElementFloat::Left) ? 0 : (max_width - cur_width);
486 ce.bounds.right = (fl == ElementFloat::Left) ? cur_width : max_width;
501 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); });
519 uint element_height = std::max(sprite_dim.height, (uint)line_height);
521 uint sprite_top = y_offset + (element_height - sprite_dim.height) / 2;
522 uint text_top = y_offset + (element_height - line_height) / 2;
524 DrawSprite(action_sprite, PAL_NONE, 0, sprite_top);
527 y_offset += element_height;
555 this->active_button_id = pe.index;
559 Command<Commands::StoryPageButton>::Post(
TileIndex{}, pe.index, VehicleID::Invalid());
563 if (this->active_button_id == pe.index) {
565 this->active_button_id = StoryPageElementID::Invalid();
569 this->active_button_id = pe.index;
575 if (this->active_button_id == pe.index) {
577 this->active_button_id = StoryPageElementID::Invalid();
581 this->active_button_id = pe.index;
599 this->story_pages.
SetSortFuncs(StoryBookWindow::page_sorter_funcs);
602 this->story_page_elements.
SetSortFuncs(StoryBookWindow::page_element_sorter_funcs);
606 this->
owner = this->window_number;
609 this->selected_generic_title.clear();
610 this->selected_page_id = StoryPageID::Invalid();
612 this->active_button_id = StoryPageElementID::Invalid();
634 if (this->selected_page_id != page_index) {
636 this->active_button_id = StoryPageElementID::Invalid();
637 this->selected_page_id = page_index;
652 if (this->window_number == CompanyID::Invalid()) {
653 return GetString(STR_STORY_BOOK_SPECTATOR_CAPTION);
655 return GetString(STR_STORY_BOOK_CAPTION, this->window_number);
668 if (this->vscroll->
GetCount() != this->GetContentHeight()) {
682 if (page ==
nullptr)
return;
695 const int scrollpos = this->vscroll->
GetPosition();
696 int y_offset = -scrollpos;
702 y_offset += line_height;
711 if (ce.bounds.bottom - scrollpos < fr.top)
continue;
713 y_offset = ce.bounds.top - scrollpos;
714 if (y_offset > fr.bottom)
return;
716 switch (ce.pe->type) {
731 ce.pe->text.GetDecodedString());
738 const FrameFlags frame = this->active_button_id == ce.pe->index ?
FrameFlag::Lowered : FrameFlags{};
741 DrawFrameRect(ce.bounds.left, ce.bounds.top - scrollpos, ce.bounds.right, ce.bounds.bottom - scrollpos - 1, bgcolour, frame);
748 default: NOT_REACHED();
765 for (
size_t i = 0; i < this->story_pages.size(); i++) {
766 const StoryPage *s = this->story_pages[i];
769 if (title_d.width > d.width) {
770 d.width = title_d.width;
774 d.width += padding.width;
775 d.height += padding.height;
805 for (
size_t i = 0; i < this->story_pages.size(); i++) {
806 const StoryPage *p = this->story_pages[i];
807 if (p->index == this->selected_page_id)
break;
829 if (clicked_y >= ce.bounds.top && clicked_y < ce.bounds.bottom && pt.x >= ce.bounds.left && pt.x < ce.bounds.right) {
853 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
855 if (!gui_scope)
return;
865 if (this->story_pages.empty()) {
866 this->selected_generic_title.clear();
871 this->selected_page_id = StoryPageID::Invalid();
873 if (this->selected_page_id == StoryPageID::Invalid() && !this->story_pages.empty()) {
883 }
else if (data >= 0 && this->selected_page_id == data) {
890 this->active_button_id = StoryPageElementID::Invalid();
899 this->active_button_id = StoryPageElementID::Invalid();
904 Command<Commands::StoryPageButton>::Post(tile, pe->index, VehicleID::Invalid());
908 bool OnVehicleSelect(
const Vehicle *v)
override
913 this->active_button_id = StoryPageElementID::Invalid();
923 Command<Commands::StoryPageButton>::Post(
TileIndex{}, pe->index, v->index);
930 this->active_button_id = StoryPageElementID::Invalid();
935const std::initializer_list<GUIStoryPageList::SortFunction * const> StoryBookWindow::page_sorter_funcs = {
939const std::initializer_list<GUIStoryPageElementList::SortFunction * const> StoryBookWindow::page_element_sorter_funcs = {
940 &PageElementOrderSorter,
943static constexpr std::initializer_list<NWidgetPart> _nested_story_book_widgets = {
967 WindowClass::StoryBook, WindowClass::None,
969 _nested_story_book_widgets
975 WindowClass::StoryBook, WindowClass::None,
977 _nested_story_book_widgets
1038 default:
return SPR_CURSOR_QUERY;
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.
@ 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.