OpenTTD Source 20241222-master-gc72542431a
cheat_gui.cpp
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#include "stdafx.h"
11#include "command_func.h"
12#include "cheat_type.h"
13#include "company_base.h"
14#include "company_func.h"
15#include "saveload/saveload.h"
16#include "vehicle_base.h"
17#include "textbuf_gui.h"
18#include "window_gui.h"
19#include "string_func.h"
20#include "strings_func.h"
21#include "window_func.h"
22#include "rail_gui.h"
23#include "settings_gui.h"
24#include "company_gui.h"
26#include "map_func.h"
27#include "tile_map.h"
28#include "newgrf.h"
29#include "error.h"
30#include "misc_cmd.h"
32#include "timer/timer.h"
35
37
38#include "table/sprites.h"
39
40#include "safeguards.h"
41
42
48static int32_t _money_cheat_amount = 10000000;
49
58static int32_t ClickMoneyCheat(int32_t, int32_t change_direction)
59{
62}
63
70static int32_t ClickChangeCompanyCheat(int32_t new_value, int32_t change_direction)
71{
72 while ((uint)new_value < Company::GetPoolSize()) {
73 if (Company::IsValidID((CompanyID)new_value)) {
74 SetLocalCompany((CompanyID)new_value);
75 return _local_company;
76 }
77 new_value += change_direction;
78 }
79
80 return _local_company;
81}
82
88static int32_t ClickSetProdCheat(int32_t new_value, int32_t)
89{
90 _cheats.setup_prod.value = (new_value != 0);
93}
94
95extern void CalendarEnginesMonthlyLoop();
96
102static int32_t ClickChangeDateCheat(int32_t new_value, int32_t)
103{
104 /* Don't allow changing to an invalid year, or the current year. */
106 if (new_year == TimerGameCalendar::year) return TimerGameCalendar::year.base();
107
108 TimerGameCalendar::YearMonthDay ymd = TimerGameCalendar::ConvertDateToYMD(TimerGameCalendar::date);
109 TimerGameCalendar::Date new_calendar_date = TimerGameCalendar::ConvertYMDToDate(new_year, ymd.month, ymd.day);
110
112
113 /* If not using wallclock units, we keep economy date in sync with calendar date and must change it also. */
115 /* Keep economy and calendar dates synced. */
116 TimerGameEconomy::Date new_economy_date = new_calendar_date.base();
117
118 /* Shift cached dates before we change the date. */
119 for (auto v : Vehicle::Iterate()) v->ShiftDates(new_economy_date - TimerGameEconomy::date);
121
122 /* Now it's safe to actually change the date. */
124 }
125
134 return TimerGameCalendar::year.base();
135}
136
143static int32_t ClickChangeMaxHlCheat(int32_t new_value, int32_t)
144{
145 new_value = Clamp(new_value, MIN_MAP_HEIGHT_LIMIT, MAX_MAP_HEIGHT_LIMIT);
146
147 /* Check if at least one mountain on the map is higher than the new value.
148 * If yes, disallow the change. */
149 for (const auto t : Map::Iterate()) {
150 if ((int32_t)TileHeight(t) > new_value) {
151 ShowErrorMessage(STR_CONFIG_SETTING_TOO_HIGH_MOUNTAIN, INVALID_STRING_ID, WL_ERROR);
152 /* Return old, unchanged value */
154 }
155 }
156
157 /* Execute the change and reload GRF Data */
160
161 /* The smallmap uses an index from heightlevels to colours. Trigger rebuilding it. */
163
165}
166
181
187typedef int32_t CheckButtonClick(int32_t new_value, int32_t change_direction);
188
197
202static const CheatEntry _cheats_ui[] = {
203 {SLE_INT32, STR_CHEAT_MONEY, &_money_cheat_amount, &_cheats.money.been_used, &ClickMoneyCheat },
204 {SLE_UINT8, STR_CHEAT_CHANGE_COMPANY, &_local_company, &_cheats.switch_company.been_used, &ClickChangeCompanyCheat },
205 {SLE_BOOL, STR_CHEAT_EXTRA_DYNAMITE, &_cheats.magic_bulldozer.value, &_cheats.magic_bulldozer.been_used, nullptr },
206 {SLE_BOOL, STR_CHEAT_CROSSINGTUNNELS, &_cheats.crossing_tunnels.value, &_cheats.crossing_tunnels.been_used, nullptr },
207 {SLE_BOOL, STR_CHEAT_NO_JETCRASH, &_cheats.no_jetcrash.value, &_cheats.no_jetcrash.been_used, nullptr },
208 {SLE_BOOL, STR_CHEAT_SETUP_PROD, &_cheats.setup_prod.value, &_cheats.setup_prod.been_used, &ClickSetProdCheat },
209 {SLE_BOOL, STR_CHEAT_STATION_RATING, &_cheats.station_rating.value, &_cheats.station_rating.been_used, nullptr },
211 {SLE_INT32, STR_CHEAT_CHANGE_DATE, &TimerGameCalendar::year, &_cheats.change_date.been_used, &ClickChangeDateCheat },
212};
213
214static_assert(CHT_NUM_CHEATS == lengthof(_cheats_ui));
215
217static constexpr NWidgetPart _nested_cheat_widgets[] = {
219 NWidget(WWT_CLOSEBOX, COLOUR_GREY),
220 NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CHEATS, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
221 NWidget(WWT_SHADEBOX, COLOUR_GREY),
222 NWidget(WWT_STICKYBOX, COLOUR_GREY),
223 EndContainer(),
224 NWidget(WWT_PANEL, COLOUR_GREY, WID_C_PANEL), EndContainer(),
225};
226
229 int clicked;
230 int clicked_widget;
231 uint line_height;
233
234 CheatWindow(WindowDesc &desc) : Window(desc)
235 {
236 this->InitNested();
237 }
238
239 void OnInit() override
240 {
241 this->icon = GetSpriteSize(SPR_COMPANY_ICON);
242 }
243
244 void DrawWidget(const Rect &r, WidgetID widget) const override
245 {
246 if (widget != WID_C_PANEL) return;
247
248 const Rect ir = r.Shrink(WidgetDimensions::scaled.framerect);
249 int y = ir.top;
250
251 bool rtl = _current_text_dir == TD_RTL;
252 uint button_left = rtl ? ir.right - SETTING_BUTTON_WIDTH : ir.left;
255
256 int text_y_offset = (this->line_height - GetCharacterHeight(FS_NORMAL)) / 2;
257 int button_y_offset = (this->line_height - SETTING_BUTTON_HEIGHT) / 2;
258 int icon_y_offset = (this->line_height - this->icon.height) / 2;
259
260 for (int i = 0; i != lengthof(_cheats_ui); i++) {
261 const CheatEntry *ce = &_cheats_ui[i];
262
263 switch (ce->type) {
264 case SLE_BOOL: {
265 bool on = (*(bool*)ce->variable);
266
269 break;
270 }
271
272 default: {
273 int32_t val = (int32_t)ReadValue(ce->variable, ce->type);
274
275 /* Draw [<][>] boxes for settings of an integer-type */
276 DrawArrowButtons(button_left, y + button_y_offset, COLOUR_YELLOW, clicked - (i * 2), true, true);
277
278 switch (ce->str) {
279 /* Display date for change date cheat */
281
282 /* Draw coloured flag for change company cheat */
284 SetDParam(0, val + 1);
287 break;
288 }
289
290 default: SetDParam(0, val);
291 }
292 break;
293 }
294 }
295
297
298 y += this->line_height;
299 }
300 }
301
303 {
304 if (widget != WID_C_PANEL) return;
305
306 uint width = 0;
307 for (const auto &ce : _cheats_ui) {
308 switch (ce.type) {
309 case SLE_BOOL:
311 width = std::max(width, GetStringBoundingBox(ce.str).width);
313 width = std::max(width, GetStringBoundingBox(ce.str).width);
314 break;
315
316 default:
317 switch (ce.str) {
318 /* Display date for change date cheat */
321 width = std::max(width, GetStringBoundingBox(ce.str).width);
322 break;
323
324 /* Draw coloured flag for change company cheat */
328 break;
329
330 default:
332 width = std::max(width, GetStringBoundingBox(ce.str).width);
333 break;
334 }
335 break;
336 }
337 }
338
339 this->line_height = std::max<uint>(this->icon.height, SETTING_BUTTON_HEIGHT);
340 this->line_height = std::max<uint>(this->line_height, GetCharacterHeight(FS_NORMAL)) + WidgetDimensions::scaled.framerect.Vertical();
341
343 size.height = WidgetDimensions::scaled.framerect.Vertical() + this->line_height * lengthof(_cheats_ui);
344 }
345
346 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
347 {
348 if (widget != WID_C_PANEL) return;
349
350 Rect r = this->GetWidget<NWidgetBase>(WID_C_PANEL)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect);
351 uint btn = (pt.y - r.top) / this->line_height;
352 int x = pt.x - r.left;
353 bool rtl = _current_text_dir == TD_RTL;
354 if (rtl) x = r.Width() - 1 - x;
355
356 if (btn >= lengthof(_cheats_ui)) return;
357
358 const CheatEntry *ce = &_cheats_ui[btn];
359 int value = (int32_t)ReadValue(ce->variable, ce->type);
360 int oldvalue = value;
361
363 /* Click at the date text directly. */
364 clicked_widget = CHT_CHANGE_DATE;
365 SetDParam(0, value);
367 return;
368 } else if (btn == CHT_EDIT_MAX_HL && x >= SETTING_BUTTON_WIDTH) {
369 clicked_widget = CHT_EDIT_MAX_HL;
370 SetDParam(0, value);
372 return;
373 }
374
375 /* Not clicking a button? */
376 if (!IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) return;
377
378 *ce->been_used = true;
379
380 switch (ce->type) {
381 case SLE_BOOL:
382 value ^= 1;
383 if (ce->proc != nullptr) ce->proc(value, 0);
384 break;
385
386 default:
387 /* Take whatever the function returns */
388 value = ce->proc(value + ((x >= SETTING_BUTTON_WIDTH / 2) ? 1 : -1), (x >= SETTING_BUTTON_WIDTH / 2) ? 1 : -1);
389
390 /* The first cheat (money), doesn't return a different value. */
391 if (value != oldvalue || btn == CHT_MONEY) this->clicked = btn * 2 + 1 + ((x >= SETTING_BUTTON_WIDTH / 2) != rtl ? 1 : 0);
392 break;
393 }
394
395 if (value != oldvalue) WriteValue(ce->variable, ce->type, (int64_t)value);
396
397 this->SetTimeout();
398
399 this->SetDirty();
400 }
401
402 void OnTimeout() override
403 {
404 this->clicked = 0;
405 this->SetDirty();
406 }
407
408 void OnQueryTextFinished(std::optional<std::string> str) override
409 {
410 /* Was 'cancel' pressed or nothing entered? */
411 if (!str.has_value() || str->empty()) return;
412
413 const CheatEntry *ce = &_cheats_ui[clicked_widget];
414 int oldvalue = (int32_t)ReadValue(ce->variable, ce->type);
415 int value = atoi(str->c_str());
416 *ce->been_used = true;
417 value = ce->proc(value, value - oldvalue);
418
419 if (value != oldvalue) WriteValue(ce->variable, ce->type, (int64_t)value);
420 this->SetDirty();
421 }
422
423 IntervalTimer<TimerGameCalendar> daily_interval = {{TimerGameCalendar::MONTH, TimerGameCalendar::Priority::NONE}, [this](auto) {
424 this->SetDirty();
425 }};
426};
427
430 WDP_AUTO, "cheats", 0, 0,
432 0,
434);
435
Cheats _cheats
All the cheats.
Definition cheat.cpp:16
static int32_t _money_cheat_amount
The 'amount' to cheat with.
Definition cheat_gui.cpp:48
static int32_t ClickChangeMaxHlCheat(int32_t new_value, int32_t)
Allow (or disallow) a change of the maximum allowed heightlevel.
CheatNumbers
Available cheats.
@ CHT_NO_JETCRASH
Disable jet-airplane crashes.
@ CHT_CHANGE_DATE
Do time traveling.
@ CHT_CROSSINGTUNNELS
Allow tunnels to cross each other.
@ CHT_SETUP_PROD
Allow manually editing of industry production.
@ CHT_CHANGE_COMPANY
Switch company.
@ CHT_NUM_CHEATS
Number of cheats.
@ CHT_EXTRA_DYNAMITE
Dynamite anything.
@ CHT_MONEY
Change amount of money.
@ CHT_STATION_RATING
Fix station ratings at 100%.
@ CHT_EDIT_MAX_HL
Edit maximum allowed heightlevel.
void CalendarEnginesMonthlyLoop()
Monthly update of the availability, reliability, and preview offers of the engines.
Definition engine.cpp:1147
static int32_t ClickMoneyCheat(int32_t, int32_t change_direction)
Handle cheating of money.
Definition cheat_gui.cpp:58
static int32_t ClickSetProdCheat(int32_t new_value, int32_t)
Allow (or disallow) changing production of all industries.
Definition cheat_gui.cpp:88
static int32_t ClickChangeDateCheat(int32_t new_value, int32_t)
Handle changing of the current year.
static constexpr NWidgetPart _nested_cheat_widgets[]
Widget definitions of the cheat GUI.
static int32_t ClickChangeCompanyCheat(int32_t new_value, int32_t change_direction)
Handle changing of company.
Definition cheat_gui.cpp:70
int32_t CheckButtonClick(int32_t new_value, int32_t change_direction)
Signature of handler function when user clicks at a cheat.
static WindowDesc _cheats_desc(WDP_AUTO, "cheats", 0, 0, WC_CHEATS, WC_NONE, 0, _nested_cheat_widgets)
Window description of the cheats GUI.
void ShowCheatWindow()
Open cheat window.
static const CheatEntry _cheats_ui[]
The available cheats.
Types related to cheating.
Types related to the cheat widgets.
@ WID_C_PANEL
Panel where all cheats are shown in.
An interval timer will fire every interval, and will continue to fire until it is deleted.
Definition timer.h:76
static LinkGraphSchedule instance
Static instance of LinkGraphSchedule.
void ShiftDates(TimerGameEconomy::Date interval)
Shift all dates (join dates and edge annotations) of link graphs and link graph jobs by the number of...
static Date ConvertYMDToDate(Year year, Month month, Day day)
Converts a tuple of Year, Month and Day to a Date.
static YearMonthDay ConvertDateToYMD(Date date)
Converts a Date to a Year, Month & Day.
static void SetDate(Date date, DateFract fract)
Set the date.
static Date date
Current date in days (day counter).
static Year year
Current year, starting at 0.
static DateFract date_fract
Fractional part of the day.
static constexpr TimerGame< struct Calendar >::Year MIN_YEAR
The absolute minimum year in OTTD.
static constexpr TimerGame< struct Calendar >::Year MAX_YEAR
MAX_YEAR, nicely rounded value of the number of years that can be encoded in a single 32 bits date,...
static Date date
Current date in days (day counter).
static bool UsingWallclockUnits(bool newgame=false)
Check if we are using wallclock units.
static DateFract date_fract
Fractional part of the day.
static void SetDate(Date date, DateFract fract)
Set the date.
RectPadding framerect
Standard padding inside many panels.
Definition window_gui.h:42
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition window_gui.h:28
int hsep_wide
Wide horizontal spacing.
Definition window_gui.h:64
int hsep_indent
Width of identation for tree layouts.
Definition window_gui.h:65
Functions related to commands.
Definition of stuff that is very close to a company, like the company struct itself.
void DrawCompanyIcon(CompanyID c, int x, int y)
Draw the icon of a company.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
void SetLocalCompany(CompanyID new_company)
Sets the local company and updates the settings that are set on a per-company basis to reflect the co...
Functions related to companies.
GUI Functions related to companies.
Owner
Enum for all companies/owners.
@ MAX_COMPANIES
Maximum number of companies.
Functions related to errors.
void ShowErrorMessage(StringID summary_msg, int x, int y, CommandCost cc)
Display an error message in a window.
@ WL_ERROR
Errors (eg. saving/loading failed)
Definition error.h:26
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Definition fontcache.cpp:77
Geometry functions.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Definition gfx.cpp:922
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition gfx.cpp:851
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.
Definition gfx.cpp:657
@ FS_NORMAL
Index of the normal font in the font tables.
Definition gfx_type.h:209
constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip)
Widget part function for setting the data and tooltip.
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition window.cpp:940
Declaration of link graph schedule used for cargo distribution.
Functions related to maps.
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
Definition math_func.hpp:79
constexpr bool IsInsideMM(const T x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
Miscellaneous command definitions.
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
Base for the NewGRF implementation.
void ReloadNewGRFData()
Reload all NewGRF files during a running game.
void ResetSignalVariant(int32_t)
Updates the current signal variant used in the signal GUI to the one adequate to current year.
Functions/types etc.
A number of safeguards to prevent using unsafe methods.
void WriteValue(void *ptr, VarType conv, int64_t val)
Write the value of a setting.
Definition saveload.cpp:818
int64_t ReadValue(const void *ptr, VarType conv)
Return a signed-long version of the value of a setting.
Definition saveload.cpp:794
Functions/types related to saving and loading games.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition settings.cpp:57
void DrawArrowButtons(int x, int y, Colours button_colour, uint8_t state, bool clickable_left, bool clickable_right)
Draw [<][>] boxes.
void DrawBoolButton(int x, int y, bool state, bool clickable)
Draw a toggle button.
Functions for setting GUIs.
#define SETTING_BUTTON_WIDTH
Width of setting buttons.
#define SETTING_BUTTON_HEIGHT
Height of setting buttons.
This file contains all sprite-related enums and defines.
Definition of base types and functions in a cross-platform compatible way.
#define lengthof(array)
Return the length of an fixed size array.
Definition stdafx.h:280
Functions related to low-level strings.
@ CS_NUMERAL
Only numeric ones.
Definition string_type.h:26
void SetDParamMaxValue(size_t n, uint64_t max_value, uint min_count, FontSize size)
Set DParam n to some number that is suitable for string size computations.
Definition strings.cpp:127
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
Definition strings.cpp:104
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition strings.cpp:56
Functions related to OTTD's strings.
@ TD_RTL
Text is written right-to-left by default.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
Information of a cheat.
VarType type
type of selector
void * variable
pointer to the variable
StringID str
string with descriptive text
CheckButtonClick * proc
procedure
bool * been_used
has this cheat been used before?
GUI for the cheats.
void OnTimeout() override
Called when this window's timeout has been reached.
Dimension icon
Dimension of company icon sprite.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
void OnInit() override
Notification that the nested widget tree gets initialized.
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.
void OnQueryTextFinished(std::optional< std::string > str) override
The query window opened from this window has closed.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
bool value
tells if the bool cheat is active or not
Definition cheat_type.h:18
bool been_used
has this cheat been used before?
Definition cheat_type.h:17
Cheat crossing_tunnels
allow tunnels that cross each other
Definition cheat_type.h:30
Cheat no_jetcrash
no jet will crash on small airports anymore
Definition cheat_type.h:31
Cheat change_date
changes date ingame
Definition cheat_type.h:32
Cheat station_rating
Fix station ratings at 100%.
Definition cheat_type.h:35
Cheat money
get rich or poor
Definition cheat_type.h:29
Cheat setup_prod
setup raw-material production in game
Definition cheat_type.h:33
Cheat switch_company
change to another company
Definition cheat_type.h:28
Cheat magic_bulldozer
dynamite industries, objects
Definition cheat_type.h:27
Cheat edit_max_hl
edit the maximum heightlevel; this is a cheat because of the fact that it needs to reset NewGRF game ...
Definition cheat_type.h:34
uint8_t map_height_limit
the maximum allowed heightlevel
Dimensions (a width and height) of a rectangle in 2D.
ConstructionSettings construction
construction of things in-game
static IterateWrapper Iterate()
Returns an iterable ensemble of all Tiles.
Definition map_func.h:363
Partial widget specification to allow NWidgets to be written nested.
Coordinates of a point in 2D.
static size_t GetPoolSize()
Returns first unused index.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
constexpr uint Vertical() const
Get total vertical padding of RectPadding.
Specification of a rectangle with absolute coordinates of all edges.
int Width() const
Get width of Rect.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Templated helper to make a type-safe 'typedef' representing a single POD value.
High level window description.
Definition window_gui.h:159
Data structure for an opened window.
Definition window_gui.h:273
ResizeInfo resize
Resize information.
Definition window_gui.h:314
void SetTimeout()
Set the timeout flag of the window and initiate the timer.
Definition window_gui.h:361
const NWID * GetWidget(WidgetID widnum) const
Get the nested widget with number widnum from the nested widget tree.
Definition window_gui.h:977
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition window.cpp:1746
int width
width of the window (number of pixels to the right in x direction)
Definition window_gui.h:311
Stuff related to the text buffer GUI.
@ QSF_ACCEPT_UNCHANGED
return success even when the text didn't change
Definition textbuf_gui.h:20
Map writing/reading functions for tiles.
static debug_inline uint TileHeight(Tile tile)
Returns the height of a tile.
Definition tile_map.h:29
static const uint MIN_MAP_HEIGHT_LIMIT
Lower bound of maximum allowed heightlevel (in the construction settings)
Definition tile_type.h:29
static const uint MAX_MAP_HEIGHT_LIMIT
Upper bound of maximum allowed heightlevel (in the construction settings)
Definition tile_type.h:30
Definition of Interval and OneShot timers.
Definition of the game-calendar-timer.
Definition of the game-economy-timer.
Base class for all vehicles.
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:75
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:50
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition widget_type.h:66
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition widget_type.h:64
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:61
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:69
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
Definition window.cpp:1140
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
Definition window.cpp:3101
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
Definition window.cpp:3236
Window functions not directly related to making/drawing windows.
Functions, definitions and such used only by the GUI.
@ WDP_AUTO
Find a place automatically.
Definition window_gui.h:147
int WidgetID
Widget ID.
Definition window_type.h:18
@ WC_BUILD_STATION
Build station; Window numbers:
@ WC_BUILD_OBJECT
Build object; Window numbers:
@ WC_STATUS_BAR
Statusbar (at the bottom of your screen); Window numbers:
Definition window_type.h:64
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition window_type.h:45
@ WC_CHEATS
Cheat window; Window numbers:
@ WC_TRUCK_STATION
Build truck station; Window numbers:
@ WC_INDUSTRY_VIEW
Industry view; Window numbers:
@ WC_FINANCES
Finances of a company; Window numbers:
@ WC_BUS_STATION
Build bus station; Window numbers:
@ WC_SMALLMAP
Small map; Window numbers: