43#include "table/strings.h"
101 return std::visit(visitor{}, reference);
105static constexpr NWidgetPart _nested_normal_news_widgets[] = {
133 _nested_normal_news_widgets
137static constexpr NWidgetPart _nested_vehicle_news_widgets[] = {
181 _nested_vehicle_news_widgets
185static constexpr NWidgetPart _nested_company_news_widgets[] = {
226 _nested_company_news_widgets
230static constexpr NWidgetPart _nested_thin_news_widgets[] = {
260 _nested_thin_news_widgets
264static constexpr NWidgetPart _nested_small_news_widgets[] = {
270 SetAspect(WidgetDimensions::ASPECT_VEHICLE_ICON),
272 SetToolTip(STR_NEWS_SHOW_VEHICLE_GROUP_TOOLTIP),
296 _nested_small_news_widgets
325 NewsTypeData(
"news_display.accident_other", 90, SND_BEGIN ),
326 NewsTypeData(
"news_display.company_info", 60, SND_BEGIN ),
330 NewsTypeData(
"news_display.production_player", 30, SND_BEGIN ),
331 NewsTypeData(
"news_display.production_other", 30, SND_BEGIN ),
332 NewsTypeData(
"news_display.production_nobody", 30, SND_BEGIN ),
335 NewsTypeData(
"news_display.acceptance", 90, SND_BEGIN ),
336 NewsTypeData(
"news_display.subsidies", 180, SND_BEGIN ),
364 this->chat_height = (w !=
nullptr) ? w->
height : 0;
372 if (std::holds_alternative<VehicleID>(
ni->
ref1) &&
nwid !=
nullptr) {
396 if (nvp !=
nullptr) {
397 if (std::holds_alternative<VehicleID>(
ni->
ref1)) {
413 void DrawNewsBorder(
const Rect &r)
const
427 Point pt = { 0, _screen.height };
457 str = this->GetNewVehicleMessageString(widget);
468 if (std::holds_alternative<VehicleID>(
ni->
ref1)) {
490 d.width = (
d.width >= padding.width) ?
d.width - padding.width : 0;
491 d.height = (
d.height >= padding.height) ?
d.height - padding.height : 0;
493 d.width += padding.width;
494 d.height += padding.height;
519 this->DrawNewsBorder(r);
553 DrawVehicleEngine(r.left, r.right,
CenterBounds(r.left, r.right, 0),
CenterBounds(r.top, r.bottom, 0), engine,
GetEnginePalette(engine,
_local_company),
EIT_PREVIEW);
576 if (std::holds_alternative<VehicleID>(
ni->
ref1)) {
586 if (std::holds_alternative<VehicleID>(
ni->
ref1)) {
592 if (std::holds_alternative<VehicleID>(
ni->
ref1)) {
617 if (!std::holds_alternative<VehicleID>(
ni->
ref1)) {
623 if (wid !=
nullptr) {
625 if (
wid->UpdateVerticalSize(y)) this->
ReInit(0, 0);
638 int newtop = this->
top + this->chat_height - data;
639 this->chat_height = data;
656 int newtop = std::max(this->
top - 2 *
static_cast<int>(count), _screen.height -
this->height -
this->status_height -
this->chat_height);
667 if (this->
top == newtop)
return;
677 std::string GetNewVehicleMessageString(
WidgetID widget)
const
703 new NewsWindow(GetNewsWindowLayout(ni->style), ni);
732 if (ni ==
nullptr)
return true;
760 if (std::empty(
_news))
return;
771 default: NOT_REACHED();
798 if (std::empty(
_news))
return;
809 default: NOT_REACHED();
824static std::list<NewsItem>::iterator
DeleteNewsItem(std::list<NewsItem>::iterator ni)
829 if (updateCurrentNews) {
836 if (updateStatusbarNews) {
843 ni =
_news.erase(ni);
845 if (updateCurrentNews) {
851 if (updateStatusbarNews) {
873 headline(std::move(headline)), date(
TimerGameCalendar::date), economy_date(
TimerGameEconomy::date), type(type), advice_type(advice_type), style(style), flags(flags), ref1(ref1), ref2(ref2), data(std::move(data))
879std::string NewsItem::GetStatusText()
const
881 if (this->
data !=
nullptr) {
884 return GetString(STR_MESSAGE_NEWS_FORMAT, cni.title, this->headline.GetDecodedString());
904 if (_game_mode == GM_MENU)
return;
907 _news.emplace_front(std::move(headline), type, style, flags, ref1, ref2, std::move(data), advice_type);
925 uint32_t operator()(
const std::monostate &) {
return 0; }
926 uint32_t operator()(
const TileIndex &t) {
return t.base(); }
927 uint32_t operator()(
const VehicleID v) {
return v.base(); }
928 uint32_t operator()(
const StationID s) {
return s.base(); }
929 uint32_t operator()(
const IndustryID i) {
return i.base(); }
930 uint32_t operator()(
const TownID t) {
return t.base(); }
931 uint32_t operator()(
const EngineID e) {
return e.base(); }
934 return std::visit(visitor{}, reference);
956 bool operator()(
const std::monostate &) {
return true; }
965 if (!std::visit(visitor{}, reference))
return CMD_ERROR;
981template <
size_t Tmin = 0,
class Tpredicate>
985 for (
auto it = std::rbegin(
_news); it != std::rend(
_news); ) {
986 if constexpr (Tmin > 0) {
987 if (std::size(
_news) <= Tmin)
break;
989 if (predicate(*it)) {
990 it = std::make_reverse_iterator(
DeleteNewsItem(std::prev(it.base())));
1000static bool IsReferenceObject(
const NewsReference &reference, T
id)
1002 return std::holds_alternative<T>(reference) && std::get<T>(reference) == id;
1005template <
typename T>
1006static bool HasReferenceObject(
const NewsItem &ni, T
id)
1008 return IsReferenceObject(ni.
ref1,
id) || IsReferenceObject(ni.
ref2,
id);
1020 return HasReferenceObject(ni, vid) && (advice_type == AdviceType::Invalid || ni.
advice_type == advice_type);
1032 return HasReferenceObject(ni, sid);
1043 return HasReferenceObject(ni, iid);
1049 if (!std::holds_alternative<EngineID>(reference))
return false;
1051 EngineID eid = std::get<EngineID>(reference);
1061 return IsInvalidEngineNews(ni.
ref1) || IsInvalidEngineNews(ni.
ref2);
1065static void RemoveOldNewsItems()
1067 DeleteNews<MIN_NEWS_AMOUNT>([](
const auto &ni) {
1072template <
typename T>
1073static void ChangeObject(
NewsReference reference, T from, T to)
1075 if (!std::holds_alternative<T>(reference))
return;
1076 if (std::get<T>(reference) == from) reference = to;
1087 for (
auto &ni :
_news) {
1088 ChangeObject(ni.
ref1, from_index, to_index);
1089 ChangeObject(ni.
ref2, from_index, to_index);
1097 if (std::empty(
_news))
return;
1102 RemoveOldNewsItems();
1113 assert(!std::empty(
_news));
1134 if (w ==
nullptr)
return false;
1142 if (std::empty(
_news))
return;
1151 ni = std::begin(
_news);
1158 ni = std::begin(
_news);
1171 if (ni == std::end(
_news)) {
1174 ni = std::begin(
_news);
1200 int line_height = 0;
1217 resize.height = this->line_height;
1224 size.width = std::max(200u, size.width);
1239 for (
auto ni = first; ni !=
last; ++ni) {
1243 y += this->line_height;
1266 if (ni == std::end(
_news))
return;
1278static constexpr NWidgetPart _nested_message_history[] = {
1301 _nested_message_history
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
constexpr Timpl & Set()
Set all bits.
Common return value for all commands.
Container for an encoded string, created by GetEncodedString.
std::string GetDecodedString() const
Decode the encoded string.
EncodedString ReplaceParam(size_t param, StringParameter &&value) const
Replace a parameter of this EncodedString.
An interval timer will fire every interval, and will continue to fire until it is deleted.
Timer that is increased every 27ms, and counts towards ticks / days / months / years.
static Date ConvertYMDToDate(Year year, Month month, Day day)
Converts a tuple of Year, Month and Day to a Date.
static Year year
Current year, starting at 0.
static constexpr TimerGame< struct Calendar >::Year ORIGINAL_MAX_YEAR
The maximum year of the original TTD.
Timer that is increased every 27ms, and counts towards economy time units, expressed in days / months...
static Date date
Current date in days (day counter).
static Month month
Current month (0..11).
uint8_t Month
Type for the month, note: 0 based, i.e.
Functions related to commands.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
@ Execute
execute the given command
Definition of stuff that is very close to a company, like the company struct itself.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
CompanyID _current_company
Company currently doing an action.
Functions related to companies.
void DrawCompanyManagerFace(CompanyManagerFace cmf, Colours colour, const Rect &r)
Draws the face of a company manager's face.
Functionality related to the company manager's face.
static constexpr Owner OWNER_DEITY
The object is owned by a superuser / goal script.
static constexpr Owner INVALID_OWNER
An invalid owner.
std::string GetEngineInfoString(EngineID engine)
Get a multi-line string with some technical data, describing the engine.
StringID GetEngineCategoryName(EngineID engine)
Return the category of an engine.
void DrawVehicleEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type)
Draw an engine.
Engine GUI functions, used by build_vehicle_gui and autoreplace_gui
uint64_t PackEngineNameDParam(EngineID engine_id, EngineNameContext context, uint32_t extra_data=0)
Combine an engine ID and a name context to an engine name dparam.
@ PreviewNews
Name is shown in exclusive preview or newspaper.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23)
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 GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
int DrawString(int left, int right, int top, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
bool _ctrl_pressed
Is Ctrl pressed?
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
int DrawStringMultiLine(int left, int right, int top, int bottom, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
Dimension GetScaledSpriteSize(SpriteID sprid)
Scale sprite size for GUI.
int CenterBounds(int min, int max, int size)
Determine where to draw a centred object inside a widget.
FontSize
Available font sizes.
@ FS_SMALL
Index of the small font in the font tables.
@ FS_NORMAL
Index of the normal font in the font tables.
@ FS_LARGE
Index of the large font in the font tables.
@ SA_TOP
Top align the text.
@ SA_RIGHT
Right align the text (must be a single bit).
@ SA_CENTER
Center both horizontally and vertically.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
@ FILLRECT_RECOLOUR
Apply a recolour sprite to the screen content.
void AddDirtyBlock(int left, int top, int right, int bottom)
Extend the internal _invalid_rect rectangle to contain the rectangle defined by the given parameters.
void ShowCompanyGroupForVehicle(const Vehicle *v)
Show the group window for the given vehicle.
Functions/definitions that have something to do with groups.
GUI functions that shouldn't be here.
void ShowExtraViewportWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
Command definitions related to news messages.
Functions related to news.
static NewsContainer _news
List of news, with newest items at the start.
void AddNewsItem(EncodedString &&headline, NewsType type, NewsStyle style, NewsFlags flags, NewsReference ref1, NewsReference ref2, std::unique_ptr< NewsAllocatedData > &&data, AdviceType advice_type)
Add a new newsitem to be shown.
static void DrawNewsString(uint left, uint right, int y, TextColour colour, const NewsItem *ni)
Draw an unformatted news message truncated to a maximum length.
static void MoveToNextNewsItem()
Move to the next news item.
static void ShowTicker(NewsIterator ni)
Show news item in the ticker.
void DeleteNews(Tpredicate predicate)
Delete news items by predicate, and invalidate the message history if necessary.
static void ShowNewspaper(const NewsItem *ni)
Open up an own newspaper window for the news item.
static const uint MIN_NEWS_AMOUNT
preferred minimum amount of news messages.
static NewsTypeData _news_type_data[]
Per-NewsType data.
CommandCost CmdCustomNewsItem(DoCommandFlags flags, NewsType type, CompanyID company, NewsReference reference, const EncodedString &text)
Create a new custom news item.
static NewsIterator _forced_news
Forced news item.
void DeleteIndustryNews(IndustryID iid)
Remove news regarding given industry.
void DeleteStationNews(StationID sid)
Remove news regarding given station so there are no 'unknown station now accepts Mail' or 'First trai...
static TileIndex GetReferenceTile(const NewsReference &reference)
Get the position a news-reference is referencing.
void ShowLastNewsMessage()
Show previous news item.
static const uint MAX_NEWS_AMOUNT
Do not exceed this number of news messages.
uint32_t SerialiseNewsReference(const NewsReference &reference)
Encode a NewsReference for serialisation, e.g.
void DeleteInvalidEngineNews()
Remove engine announcements for invalid engines.
static bool ReadyForNextNewsItem()
Are we ready to show another news item? Only if no newspaper is displayed.
static std::list< NewsItem >::iterator DeleteNewsItem(std::list< NewsItem >::iterator ni)
Delete a news item from the queue.
bool HideActiveNewsMessage()
Close active news message window.
void ShowMessageHistory()
Display window with news messages history.
void ChangeVehicleNews(VehicleID from_index, VehicleID to_index)
Report a change in vehicle IDs (due to autoreplace) to affected vehicle news.
void InitNewsItemStructs()
Initialize the news-items data structures.
static void MoveToNextTickerItem()
Move to the next ticker item.
void DeleteVehicleNews(VehicleID vid, AdviceType advice_type)
Delete news with a given advice type about a vehicle.
const NewsContainer & GetNews()
Get read-only reference to all news items.
static void ShowNewsMessage(NewsIterator ni)
Do a forced show of a specific message.
static NewsIterator _current_news
Current news item (last item shown regularly).
const NewsItem * GetStatusbarNews()
Get pointer to the current status bar news item.
static bool ReadyForNextTickerItem()
Are we ready to show another ticker item? Only if nothing is in the newsticker is displayed.
static WindowDesc * _news_window_layout[]
Window layouts for news items.
static NewsIterator _statusbar_news
Current status bar news item.
NewsContainer::const_iterator NewsIterator
Iterator type for news items.
std::list< NewsItem > NewsContainer
Container type for storing news items.
NewsStyle
News Window Styles.
@ Normal
Normal news item. (Newspaper with text only)
AdviceType
Sub type of the NewsType::Advice to be able to remove specific news items.
std::variant< std::monostate, TileIndex, VehicleID, StationID, IndustryID, TownID, EngineID > NewsReference
References to objects in news.
@ NoTransparency
News item disables transparency in the viewport.
@ VehicleParam0
String param 0 contains a vehicle ID. (special autoreplace behaviour)
@ Shaded
News item uses shaded colours.
@ InColour
News item is shown in colour (otherwise it is shown in black & white).
NewsDisplay
News display options.
@ Off
Only show a reminder in the status bar.
static const uint8_t PC_GREY
Grey palette colour.
static const uint8_t PC_WHITE
White palette colour.
static const uint8_t PC_BLACK
Black palette colour.
A number of safeguards to prevent using unsafe methods.
static const SettingDesc * GetSettingFromName(const std::string_view name, const SettingTable &settings)
Given a name of setting, return a setting description from the table.
ClientSettings _settings_client
The current settings for this game.
Functions and types used internally for the settings configurations.
bool ScrollMainWindowTo(int x, int y, int z, bool instant)
Scrolls the main window to given coordinates.
Functions related to sound.
SoundFx
Sound effects from baseset.
@ SND_1D_APPLAUSE
27 == 0x1B News: first vehicle at station
@ SND_16_NEWS_TICKER
20 == 0x14 News ticker
@ SND_1E_NEW_ENGINE
28 == 0x1C News: new engine available
static const PaletteID PALETTE_NEWSPAPER
Recolour sprite for newspaper-greying.
Base classes/functions for stations.
bool IsNewsTickerShown()
Checks whether the news ticker is currently being used.
Functions, definitions and such used only by the GUI.
@ SBI_SHOW_REMINDER
show a reminder (dot on the right side of the statusbar)
@ SBI_SHOW_TICKER
start scrolling news
@ SBI_NEWS_DELETED
abort current news display (active news were deleted)
Definition of base types and functions in a cross-platform compatible way.
#define lengthof(array)
Return the length of an fixed size array.
static void StrMakeValid(T &dst, const char *str, const char *last, StringValidationSettings settings)
Copies the valid (UTF-8) characters from str up to last to the dst.
Functions related to low-level strings.
@ SVS_REPLACE_TAB_CR_NL_WITH_SPACE
Replace tabs ('\t'), carriage returns ('\r') and newlines (' ') with spaces.
std::string GetString(StringID string)
Resolve the given StringID into a std::string with formatting but no parameters.
TextDirection _current_text_dir
Text direction of the currently selected language.
Functions related to OTTD's strings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
@ TD_RTL
Text is written right-to-left by default.
TileIndex xy
Base tile of the station.
VehicleType type
Type of vehicle.
SoundSettings sound
sound effect settings
GUISettings gui
settings related to the GUI
Dimensions (a width and height) of a rectangle in 2D.
uint8_t news_message_timeout
how much longer than the news message "age" should we keep the message in the history
TimerGameCalendar::Year coloured_news_year
when does newspaper become coloured?
int32_t Read(const void *object) const
Read the integer from the the actual setting.
int date_width
< Height of a single line in the news history window including spacing.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void OnResize() override
Called after the window got resized.
Scrollbar * vscroll
< Width needed for the date part.
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.
Information about a single item of news.
TimerGameCalendar::Date date
Calendar date to show for the news.
std::unique_ptr< NewsAllocatedData > data
Custom data for the news item that will be deallocated (deleted) when the news item has reached its e...
NewsType type
Type of the news.
EncodedString headline
Headline of news.
AdviceType advice_type
The type of advice, to be able to remove specific advices later on.
TimerGameEconomy::Date economy_date
Economy date of the news item, never shown but used to calculate age.
NewsItem(EncodedString &&headline, NewsType type, NewsStyle style, NewsFlags flags, NewsReference ref1, NewsReference ref2, std::unique_ptr< NewsAllocatedData > &&data, AdviceType advice_type)
Create a new newsitem to be shown.
NewsFlags flags
Window style for the news.
NewsReference ref2
Reference 2 to some object: Used for scrolling after clicking on the news, and for deleting the news ...
NewsReference ref1
Reference 1 to some object: Used for a possible viewport, scrolling after clicking on the news,...
NewsDisplay GetDisplay() const
Return the news display option.
const char *const name
Name.
const SoundFx sound
Sound.
const uint8_t age
Maximum age of news items (in days)
Window class displaying a news item.
uint16_t chat_height
Height of the chat window.
void OnResize() override
Called after the window got resized.
static int duration
Remaining time for showing the current news message (may only be access while a news item is displaye...
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
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.
Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override
Compute the initial position of the window.
void OnRealtimeTick(uint delta_ms) override
Called periodically.
uint16_t status_height
Height of the status bar window.
const NewsItem * ni
News item to display.
void SetWindowTop(int newtop)
Moves the window to a new top coordinate.
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
IntervalTimer< TimerWindow > scroll_interval
Scroll the news message slowly up from the bottom.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Coordinates of a point in 2D.
static Titem * Get(auto index)
Returns Titem with given index.
static bool IsValidID(auto index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
constexpr uint Horizontal() const
Get total horizontal padding of RectPadding.
constexpr uint Vertical() const
Get total vertical padding of RectPadding.
Specification of a rectangle with absolute coordinates of all edges.
Rect WithWidth(int width, bool end) const
Copy Rect and set its width.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Rect Indent(int indent, bool end) const
Copy Rect and indent it from its position.
Properties of config file settings.
virtual bool IsIntSetting() const
Check whether this setting is an integer type setting.
const struct IntSettingDesc * AsIntSetting() const
Get the setting description of this setting as an integer setting.
bool news_ticker
Play a ticker sound when a news item is published.
bool news_full
Play sound effects associated to certain news types.
static bool IsValidID(auto index)
Tests whether given index is a valid index for station of this type.
static Station * Get(auto index)
Gets station with given index.
static T * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
int32_t z_pos
z coordinate.
int32_t y_pos
y coordinate.
int32_t x_pos
x coordinate.
int top
Screen coordinate top edge of the viewport.
High level window description.
Data structure for an opened window.
void ReInit(int rx=0, int ry=0, bool reposition=false)
Re-initialize a window, and optionally change its size.
virtual void Close(int data=0)
Hide the window and all its child windows, and mark them for a later deletion.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
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.
ViewportData * viewport
Pointer to viewport data, if present.
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
int left
x position of left edge of the window
int top
y position of top edge of the window
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.
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.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition of Interval and OneShot timers.
Definition of the game-calendar-timer.
Definition of the Window system.
PaletteID GetEnginePalette(EngineID engine_type, CompanyID company)
Get the colour map for an engine.
Base class for all vehicles.
Functions related to vehicles.
void ShowVehicleViewWindow(const Vehicle *v)
Shows the vehicle view window of the given vehicle.
Functions related to the vehicle's GUIs.
@ EIT_PREVIEW
Vehicle drawn in preview window, news, ...
@ VEH_ROAD
Road vehicle type.
@ VEH_AIRCRAFT
Aircraft vehicle type.
@ VEH_SHIP
Ship vehicle type.
@ VEH_TRAIN
Train vehicle type.
bool ScrollWindowToTile(TileIndex tile, Window *w, bool instant)
Scrolls the viewport in a window to a given location.
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Functions related to (drawing on) viewports.
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
Window * FindWindowByClass(WindowClass cls)
Find any window by its class.
int PositionNewsMessage(Window *w)
(Re)position news message window at the screen.
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-...
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
Window functions not directly related to making/drawing windows.
@ DisableVpScroll
Window does not do autoscroll,.
@ WDP_AUTO
Find a place automatically.
@ WDP_MANUAL
Manually align the window (so no automatic location finding)
@ WC_NEWS_WINDOW
News window; Window numbers:
@ WC_STATUS_BAR
Statusbar (at the bottom of your screen); Window numbers:
@ WC_SEND_NETWORK_MSG
Chatbox; Window numbers:
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
@ WC_MESSAGE_HISTORY
News history list; Window numbers:
Functions related to zooming.
ZoomLevel ScaleZoomGUI(ZoomLevel value)
Scale zoom level relative to GUI zoom.
@ ZOOM_LVL_NEWS
Default zoom level for the news messages.