32 #include "table/strings.h" 45 static const NWidgetPart _nested_land_info_widgets[] = {
58 _nested_land_info_widgets,
lengthof(_nested_land_info_widgets)
68 static const uint LAND_INFO_LINE_BUFF_SIZE = 512;
71 char landinfo_data[LAND_INFO_LINE_END][LAND_INFO_LINE_BUFF_SIZE];
80 if (
StrEmpty(this->landinfo_data[i]))
break;
88 SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
99 if (
StrEmpty(this->landinfo_data[i]))
break;
102 size->width =
max(size->width, width);
105 if (i == 0) size->height += 4;
110 size->width =
max(size->width,
min(300u, width));
111 SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]);
121 # define LANDINFOD_LEVEL 0 123 # define LANDINFOD_LEVEL 1 125 DEBUG(misc, LANDINFOD_LEVEL,
"TILE: %#x (%i,%i)", tile,
TileX(tile),
TileY(tile));
126 DEBUG(misc, LANDINFOD_LEVEL,
"type = %#x",
_m[tile].type);
127 DEBUG(misc, LANDINFOD_LEVEL,
"height = %#x",
_m[tile].
height);
128 DEBUG(misc, LANDINFOD_LEVEL,
"m1 = %#x",
_m[tile].m1);
129 DEBUG(misc, LANDINFOD_LEVEL,
"m2 = %#x",
_m[tile].m2);
130 DEBUG(misc, LANDINFOD_LEVEL,
"m3 = %#x",
_m[tile].m3);
131 DEBUG(misc, LANDINFOD_LEVEL,
"m4 = %#x",
_m[tile].m4);
132 DEBUG(misc, LANDINFOD_LEVEL,
"m5 = %#x",
_m[tile].m5);
133 DEBUG(misc, LANDINFOD_LEVEL,
"m6 = %#x",
_me[tile].m6);
134 DEBUG(misc, LANDINFOD_LEVEL,
"m7 = %#x",
_me[tile].m7);
135 #undef LANDINFOD_LEVEL 151 td.
owner_type[0] = STR_LAND_AREA_INFORMATION_OWNER;
172 AddAcceptedCargo(tile, acceptance, NULL);
173 GetTileDesc(tile, &td);
179 GetString(this->landinfo_data[line_nr], td.
str,
lastof(this->landinfo_data[line_nr]));
183 for (uint i = 0; i < 4; i++) {
186 SetDParam(0, STR_LAND_AREA_INFORMATION_OWNER_N_A);
188 GetString(this->landinfo_data[line_nr], td.
owner_type[i],
lastof(this->landinfo_data[line_nr]));
193 StringID str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A;
197 c->
money = INT64_MAX;
200 c->
money = old_money;
205 str = STR_LAND_AREA_INFORMATION_REVENUE_WHEN_CLEARED;
207 str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR;
212 GetString(this->landinfo_data[line_nr], str,
lastof(this->landinfo_data[line_nr]));
222 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LANDINFO_COORDS,
lastof(this->landinfo_data[line_nr]));
226 SetDParam(0, STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE);
231 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY,
lastof(this->landinfo_data[line_nr]));
237 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_BUILD_DATE,
lastof(this->landinfo_data[line_nr]));
244 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_STATION_CLASS,
lastof(this->landinfo_data[line_nr]));
251 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_STATION_TYPE,
lastof(this->landinfo_data[line_nr]));
258 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_CLASS,
lastof(this->landinfo_data[line_nr]));
265 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_NAME,
lastof(this->landinfo_data[line_nr]));
272 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORTTILE_NAME,
lastof(this->landinfo_data[line_nr]));
279 GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_RAIL_TYPE,
lastof(this->landinfo_data[line_nr]));
286 GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT,
lastof(this->landinfo_data[line_nr]));
293 GetString(this->landinfo_data[line_nr], STR_LANG_AREA_INFORMATION_ROAD_SPEED_LIMIT,
lastof(this->landinfo_data[line_nr]));
298 if (td.
grf != NULL) {
300 GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_NEWGRF_NAME,
lastof(this->landinfo_data[line_nr]));
307 this->landinfo_data[line_nr][0] =
'\0';
310 char *strp = GetString(this->landinfo_data[
LAND_INFO_MULTICENTER_LINE], STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED,
lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
314 if (acceptance[i] > 0) {
323 if (acceptance[i] < 8) {
326 strp = GetString(strp, STR_LAND_AREA_INFORMATION_CARGO_EIGHTS,
lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
328 strp = GetString(strp,
CargoSpec::Get(i)->name,
lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]));
352 if (!gui_scope)
return;
372 static const NWidgetPart _nested_about_widgets[] = {
392 _nested_about_widgets,
lengthof(_nested_about_widgets)
395 static const char *
const _credits[] = {
396 "Original design by Chris Sawyer",
397 "Original graphics by Simon Foster",
399 "The OpenTTD team (in alphabetical order):",
400 " Grzegorz Duczy\xC5\x84ski (adf88) - General coding (since 1.7.2)",
401 " Albert Hofkamp (Alberth) - GUI expert (since 0.7)",
402 " Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)",
403 " Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)",
404 " Christoph Elsenhans (frosch) - General coding (since 0.6)",
405 " Lo\xC3\xAF""c Guilloux (glx) - General / Windows Expert (since 0.4.5)",
406 " Michael Lutz (michi_cc) - Path based signals (since 0.7)",
407 " Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)",
408 " Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)",
409 " Ingo von Borstel (planetmaker) - General, Support (since 1.1)",
410 " Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)",
411 " Jos\xC3\xA9 Soler (Terkhen) - General coding (since 1.0)",
412 " Leif Linse (Zuu) - AI/Game Script (since 1.2)",
414 "Inactive Developers:",
415 " Jean-Fran\xC3\xA7ois Claeys (Belugas) - GUI, NewGRF and more (0.4.5 - 1.0)",
416 " Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)",
417 " Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)",
418 " Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)",
419 " Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)",
420 " Attila B\xC3\xA1n (MiHaMiX) - Developer WebTranslator 1 and 2 (0.3 - 0.5)",
421 " Zden\xC4\x9Bk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)",
422 " Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)",
423 " Patric Stout (TrueBrain) - NoAI, NoGo, Network (0.3 - 1.2), sys op (active)",
424 " Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)",
426 "Retired Developers:",
427 " Tam\xC3\xA1s Farag\xC3\xB3 (Darkvater) - Ex-Lead coder (0.3 - 0.5)",
428 " Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)",
429 " Emil Djupfeld (egladil) - MacOSX (0.4.5 - 0.6)",
430 " Simon Sasburg (HackyKid) - Many bugfixes (0.4 - 0.4.5)",
431 " Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)",
432 " Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)",
433 " Petr Baudi\xC5\xA1 (pasky) - Many patches, NewGRF support (0.3 - 0.3)",
434 " Benedikt Br\xC3\xBCggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)",
435 " Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)",
437 "Special thanks go out to:",
438 " Josef Drexler - For his great work on TTDPatch",
439 " Marcin Grzegorczyk - Track foundations and for describing TTD internals",
440 " Stefan Mei\xC3\x9Fner (sign_de) - For his work on the console",
441 " Mike Ragsdale - OpenTTD installer",
442 " Christian Rosentreter (tokai) - MorphOS / AmigaOS port",
443 " Richard Kempton (richK) - additional airports, initial TGP implementation",
445 " Alberto Demichelis - Squirrel scripting language \xC2\xA9 2003-2008",
446 " L. Peter Deutsch - MD5 implementation \xC2\xA9 1999, 2000, 2002",
447 " Michael Blunck - Pre-signals and semaphores \xC2\xA9 2003",
448 " George - Canal/Lock graphics \xC2\xA9 2003-2004",
449 " Andrew Parkhouse (andythenorth) - River graphics",
450 " David Dallaston (Pikka) - Tram tracks",
451 " All Translators - Who made OpenTTD a truly international game",
452 " Bug Reporters - Without whom OpenTTD would still be full of bugs!",
455 "And last but not least:",
456 " Chris Sawyer - For an amazing game!" 463 static const int num_visible_lines = 19;
485 d.height = this->line_height * num_visible_lines;
488 for (uint i = 0; i <
lengthof(_credits); i++) {
498 int y = this->text_position;
501 for (uint i = 0; i <
lengthof(_credits); i++) {
502 if (y >= r.top + 7 && y < r.bottom - this->line_height) {
505 y += this->line_height;
511 if (--this->counter == 0) {
513 this->text_position--;
523 void ShowAboutWindow()
537 StringID msg = STR_MESSAGE_ESTIMATED_COST;
541 msg = STR_MESSAGE_ESTIMATED_INCOME;
557 StringID msg = STR_INCOME_FLOAT_COST;
561 msg = STR_INCOME_FLOAT_INCOME;
586 msg = STR_FEEDER_INCOME;
606 assert(
string != STR_NULL);
609 return AddTextEffect(
string, pt.x, pt.y, 0,
TE_STATIC);
619 assert(
string != STR_NULL);
622 UpdateTextEffect(te_id,
string);
631 if (*te_id == INVALID_TE_ID)
return;
633 RemoveTextEffect(*te_id);
634 *te_id = INVALID_TE_ID;
637 static const NWidgetPart _nested_tooltips_widgets[] = {
645 _nested_tooltips_widgets,
lengthof(_nested_tooltips_widgets)
659 this->string_id = str;
660 assert_compile(
sizeof(this->params[0]) ==
sizeof(params[0]));
661 assert(paramcount <=
lengthof(this->params));
662 memcpy(this->params, params,
sizeof(this->params[0]) * paramcount);
663 this->paramcount = paramcount;
664 this->close_cond = close_tooltip;
684 pt.y =
Clamp(_cursor.
pos.y + _cursor.
total_size.y + _cursor.total_offs.y + 5, scr_top, scr_bot);
685 if (pt.y + sm_height > scr_bot) pt.y =
min(_cursor.
pos.y + _cursor.total_offs.y - 5, scr_bot) - sm_height;
686 pt.x = sm_width >= _screen.width ? 0 :
Clamp(_cursor.
pos.x - (sm_width >> 1), 0, _screen.width - sm_width);
694 for (uint i = 0; i != this->paramcount; i++)
SetDParam(i, this->params[i]);
710 for (uint arg = 0; arg < this->paramcount; arg++) {
726 switch (this->close_cond) {
746 if (str == STR_NULL)
return;
748 new TooltipsWindow(parent, str, paramcount, params, close_tooltip);
751 void QueryString::HandleEditBox(
Window *w,
int wid)
761 void QueryString::DrawEditBox(
const Window *w,
int wid)
const 771 int clearbtn_left = wi->
pos_x + (rtl ? 0 : wi->
current_x - clearbtn_width);
772 int clearbtn_right = wi->
pos_x + (rtl ? clearbtn_width : wi->
current_x) - 1;
773 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
795 const Textbuf *tb = &this->text;
796 int delta =
min(0, (right - left) - tb->
pixels - 10);
805 if (focussed && tb->
caret) {
829 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
833 const Textbuf *tb = &this->text;
834 int delta =
min(0, (right - left) - tb->
pixels - 10);
859 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
866 const Textbuf *tb = &this->text;
867 int delta =
min(0, (right - left) - tb->
pixels - 10);
896 int left = wi->
pos_x + (rtl ? clearbtn_width : 0);
902 if (!
IsInsideMM(pt.y, top, bottom))
return NULL;
905 const Textbuf *tb = &this->text;
906 int delta =
min(0, (right - left) - tb->
pixels - 10);
912 void QueryString::ClickEditBox(
Window *w,
Point pt,
int wid,
int click_count,
bool focus_changed)
919 int clearbtn_width =
GetSpriteSize(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT).width;
921 int clearbtn_left = wi->
pos_x + (rtl ? 0 : wi->
current_x - clearbtn_width);
923 if (
IsInsideBS(pt.x, clearbtn_left, clearbtn_width)) {
924 if (this->text.bytes > 1) {
925 this->text.DeleteAll();
947 Window(desc), editbox(max_bytes, max_chars)
949 char *last_of = &this->editbox.text.
buf[this->editbox.text.
max_bytes - 1];
950 GetString(this->editbox.text.
buf, str, last_of);
964 this->editbox.caption = caption;
967 this->editbox.text.
afilter = afilter;
994 if (this->editbox.orig == NULL || strcmp(this->editbox.text.
buf, this->editbox.orig) != 0) {
997 if (this->
parent != NULL) {
1000 HandleOnEditText(this->editbox.text.
buf);
1002 this->editbox.handled =
true;
1025 if (!this->editbox.handled && this->parent != NULL) {
1027 this->parent = NULL;
1033 static const NWidgetPart _nested_query_string_widgets[] = {
1039 NWidget(
WWT_EDITBOX, COLOUR_GREY,
WID_QS_TEXT),
SetMinimalSize(256, 12),
SetFill(1, 1),
SetPadding(2, 2, 2, 2),
1052 _nested_query_string_widgets,
lengthof(_nested_query_string_widgets)
1085 this->caption = caption;
1086 this->message = message;
1087 this->proc = callback;
1098 if (this->proc != NULL) this->proc(this->
parent,
false);
1130 this->message, TC_FROMSTRING,
SA_CENTER);
1162 if (this->proc != NULL) {
1163 this->proc(this->
parent,
true);
1176 static const NWidgetPart _nested_query_widgets[] = {
1194 _nested_query_widgets,
lengthof(_nested_query_widgets)
1211 FOR_ALL_WINDOWS_FROM_BACK(w) {
1215 if (qw->
parent != parent || qw->
proc != callback)
continue;
1221 new QueryWindow(&_query_desc, caption, message, parent, callback);
EventState
State of handling an event.
Functions related to OTTD's strings.
virtual void OnQueryTextFinished(char *str)
The query window opened from this window has closed.
Functions/types related to NewGRF debugging.
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition of stuff that is very close to a company, like the company struct itself.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
Data about how and where to blit pixels.
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Single click after focus click opens OSK.
Horizontally center the text.
ResizeInfo resize
Resize information.
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
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...
Point pos
logical mouse position
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
virtual void OnInit()
Notification that the nested widget tree gets initialized.
Window * parent
Parent window.
Focusing click already opens OSK.
High level window description.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
EconomySettings economy
settings to change the economy
WindowFlags flags
Window flags.
int left
x position of left edge of the window
static Point RemapCoords(int x, int y, int z)
Map 3D world or tile coordinate to equivalent 2D coordinate as used in the viewports and smallmap...
static bool IsInsideMM(const T x, const uint min, const uint max)
Checks if a value is in an interval.
const char * grf
newGRF used for the tile contents
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
bool _right_button_down
Is right mouse button pressed?
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
Offset at top to draw the frame rectangular area.
Normal amount of vertical space between two paragraphs of text.
Functions related to debugging.
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
The passed event is not handled.
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
int line_height
The height of a single line.
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Tile * _m
Tiles of the map.
void GuiShowTooltips(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip)
Shows a tooltip.
int text_position
The top of the scrolling text.
virtual void OnInvalidateData(int data=0, bool gui_scope=true)
Some data on this window has become invalid.
void CDECL void DeleteAll()
Delete every character in the textbuffer.
If set the background is darker, allows for lowered frames with normal background colour when used wi...
static uint TileX(TileIndex tile)
Get the X component of a tile.
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
Point GetCaretPosition(const Window *w, int wid) const
Get the current caret position.
void CopyInDParam(int offs, const uint64 *src, int num)
Copy num string parameters from array src into the global string parameter array. ...
int top
y position of top edge of the window
static bool IsInsideBS(const T x, const uint base, const uint size)
Checks if a value is between a window started at some base point.
Tile description for the 'land area information' tool.
virtual void OnEditboxChanged(int widget)
The text in an editbox has been edited.
Tindex index
Index of this pool item.
int GetStringHeight(const char *str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
static const int DAY_TICKS
1 day is 74 ticks; _date_fract used to be uint16 and incremented by 885.
virtual bool IsNewGRFInspectable() const
Is the data related to this window NewGRF inspectable?
uint8 osk_activation
Mouse gesture to trigger the OSK.
#define lastof(x)
Get the last element of an fixed size array.
void ReInit(int rx=0, int ry=0)
Re-initialize a window, and optionally change its size.
return success even when the text didn't change
byte dist_local_authority
distance for town local authority, default 20
Helper/buffer for input fields.
Money GetCost() const
The costs as made up to this moment.
static const uint8 PC_LIGHT_YELLOW
Light yellow palette colour.
#define CLRBITS(x, y)
Clears several bits in a variable.
virtual EventState OnKeyPress(WChar key, uint16 keycode)
A key has been pressed.
Common return value for all commands.
GrfSpecFeature GetGrfSpecFeature(TileIndex tile)
Get the GrfSpecFeature associated with the tile.
static T max(const T a, const T b)
Returns the maximum of two values.
Allow nothing and replace nothing.
OskActivation
Method to open the OSK.
uint16 rail_speed
Speed limit of rail (bridges and track)
Owner owner[4]
Name of the owner(s)
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
Point total_size
union of sprite properties
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
Force the alignment, i.e. don't swap for RTL languages.
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
int GetMainViewBottom()
Return the bottom of the main view available for general use.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Base for the GUIs that have an edit box in them.
Data structure for an opened window.
QueryStringFlags flags
Flags controlling behaviour of the window.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
TextEffectID ShowFillingPercent(int x, int y, int z, uint8 percent, StringID string)
Display vehicle loading indicators.
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x=0, int y=0, const GRFFile *textref_stack_grffile=NULL, uint textref_stack_size=0, const uint32 *textref_stack=NULL)
Display an error message in a window.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold...
Main window; Window numbers:
void SetDParamStr(uint n, const char *str)
This function is used to "bind" a C string to a OpenTTD dparam slot.
enable the 'Default' button ("\0" is returned)
Rect GetBoundingRect(const Window *w, int wid, const char *from, const char *to) const
Get the bounding rectangle for a range of the query string.
Functions related to low-level strings.
static const int MAX_CHAR_LENGTH
Max. length of UTF-8 encoded unicode character.
bool caret
is the caret ("_") visible or not
Window used for asking the user a YES/NO question.
void ShowOnScreenKeyboard(Window *parent, int button)
Show the on-screen keyboard (osk) associated with a given textbox.
Functions related to errors.
void GetNameOfOwner(Owner owner, TileIndex tile)
Set the right DParams to get the name of an owner.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
StringID owner_type[4]
Type of each owner.
void str_validate(char *str, const char *last, StringValidationSettings settings)
Scans the string for valid characters and if it finds invalid ones, replaces them with a question mar...
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback)
Show a modal confirmation window with standard 'yes' and 'no' buttons The window is aligned to the ce...
Tooltip window; Window numbers:
uint16 markxoffs
the start position of the marked area in pixels
int ok_button
Widget button of parent window to simulate when pressing OK in OSK.
void HideFillingPercent(TextEffectID *te_id)
Hide vehicle loading indicators.
uint16 pixels
the current size of the string in pixels
SmallMap< int, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
On Screen Keyboard; Window numbers:
bool IsOSKOpenedFor(const Window *w, int button)
Check whether the OSK is opened for a specific editbox.
bool _left_button_down
Is left mouse button pressed?
void ShowEstimatedCostOrIncome(Money cost, int x, int y)
Display estimated costs.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
Double click on the edit box opens OSK.
Data stored about a string that can be modified in the GUI.
ClientSettings _settings_client
The current settings for this game.
StringID message
message shown for query window
bool Succeeded() const
Did this command succeed?
Definition of base types and functions in a cross-platform compatible way.
static const Date INVALID_DATE
Representation of an invalid date.
Center both horizontally and vertically.
the length of the string is counted in characters
int GetMainViewTop()
Return the top of the main view available for general use.
QueryStringFlags
Flags used in ShowQueryString() call.
A number of safeguards to prevent using unsafe methods.
void CopyOutDParam(uint64 *dst, int offs, int num)
Copy num string parameters from the global string parameter array to the dst array.
TileExtended * _me
Extended Tiles of the map.
Offset at bottom to draw below the text.
char * stredup(const char *s, const char *last)
Create a duplicate of the given string.
bool _mouse_hovering
The mouse is hovering over the same point.
StringID caption
title of window
virtual void OnTick()
Called once per (game) tick.
Point GetCharPosInString(const char *str, const char *ch, FontSize start_fontsize)
Get the leading corner of a character in a single-line string relative to the start of the string...
The tile has no ownership.
Money money
Money owned by the company.
Offset at bottom to draw the frame rectangular area.
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
virtual void SetStringParameters(int widget) const
Initialize string parameters for a widget.
Right offset of the text of the frame.
#define lengthof(x)
Return the length of an fixed size array.
static T min(const T a, const T b)
Returns the minimum of two values.
StringID railtype
Type of rail on the tile.
StringID airport_tile_name
Name of the airport tile.
Land info window; Window numbers:
Right offset of the image in the button.
QueryString editbox
Editbox.
Left offset of the text of the frame.
int cancel_button
Widget button of parent window to simulate when pressing CANCEL in OSK.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
void DeleteWindowByClass(WindowClass cls)
Delete all windows of a given class.
static const uint8 PC_BLACK
Black palette colour.
StringID station_name
Type of station within the class.
CharSetFilter
Valid filter types for IsValidChar.
QueryCallbackProc * proc
callback function executed on closing of popup. Window* points to parent, bool is true if 'yes' click...
Offset at top to draw above the text.
The window is a modal child of some other window, meaning the parent is 'inactive'.
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
bool IsWidgetGloballyFocused(byte widget_index) const
Check if given widget has user input focus.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
#define DEBUG(name, level,...)
Output a line of debugging information.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Maximal number of cargo types in a game.
void UpdateFillingPercent(TextEffectID te_id, uint8 percent, StringID string)
Update vehicle loading indicators.
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
uint64 dparam[2]
Parameters of the str string.
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Draw only every second pixel, used for greying-out.
No window, redirects to WC_MAIN_WINDOW.
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
static const uint8 PC_GREY
Grey palette colour.
Functions related to companies.
bool IsNewGRFInspectable(GrfSpecFeature feature, uint index)
Can we inspect the data given a certain feature and index.
char *const buf
buffer in which text is saved
Class for storing amounts of cargo.
byte counter
Used to scroll the text every 5 ticks.
GUISettings gui
settings related to the GUI
uint16 max_bytes
the maximum size of the buffer in bytes (including terminating '\0')
virtual void ShowNewGRFInspectWindow() const
Show the NewGRF inspection window.
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
If set the frame is lowered and the background colour brighter (ie. buttons when pressed) ...
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
size_t Utf8StringLength(const char *s)
Get the length of an UTF-8 encoded string in number of characters and thus not the number of bytes th...
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
uint16 road_speed
Speed limit of road (bridges)
CompanyByte _current_company
Company currently doing an action.
uint32 TileIndex
The index/ID of a Tile.
TextDirection _current_text_dir
Text direction of the currently selected language.
This window won't get focus/make any other window lose focus when click.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
uint16 caretxoffs
the current position of the caret in pixels
Functions related to zooming.
StringID airport_name
Name of the airport.
static char * Utf8PrevChar(char *s)
Retrieve the previous UNICODE character in an UTF-8 encoded string.
bool SetFocusedWidget(int widget_index)
Set focus within this window to the given widget.
Index of the normal font in the font tables.
bool in_window
mouse inside this window, determines drawing logic
void QueryCallbackProc(Window *, bool)
Callback procedure for the ShowQuery method.
Functions related to OTTD's landscape.
Functions related to commands.
Coordinates of a point in 2D.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Keep the text effect static.
Date build_date
Date of construction of tile contents.
Make the text effect slowly go upwards.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
void HandleButtonClick(byte widget)
Do all things to make a button look clicked and mark it to be unclicked in a few ticks.
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
void ShowFeederIncomeAnimation(int x, int y, int z, Money transfer, Money income)
Display animated feeder income.
Offset at right to draw the frame rectangular area.
Popup with confirm question; Window numbers:
StringID str
Description of the tile.
Used for DoCommand-like (and some non-fatal AI GUI) errors/information.
int width
width of the window (number of pixels to the right in x direction)
Up to 32 centered lines (arbitrary limit)
StringID station_class
Class of station.
WindowClass window_class
Window class.
Specification of a rectangle with absolute coordinates of all edges.
byte CargoID
Cargo slots to indicate a cargo type within a game.
The passed event is handled.
Text is written right-to-left by default.
WindowNumber window_number
Window number within the window class.
const char * GetCharAtPosition(const char *str, int x, FontSize start_fontsize)
Get the character from a string that is drawn at a specific position.
Window functions not directly related to making/drawing windows.
Find a place automatically.
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
Display animated income or costs on the map.
CharSetFilter afilter
Allowed characters.
Manually align the window (so no automatic location finding)
Functions related to text effects.
GUI functions that shouldn't be here.
uint16 marklength
the length of the marked area in pixels
StringID airport_class
Name of the airport class.
uint32 WChar
Type for wide characters, i.e.
const NWID * GetWidget(uint widnum) const
Get the nested widget with number widnum from the nested widget tree.
Window white border counter bit mask.
Left offset of the image in the button.
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
const char * GetCharAtPosition(const Window *w, int wid, const Point &pt) const
Get the character that is rendered at a position.
The tile/execution is done by "water".
The OSK shall not be activated at all.
Dimensions (a width and height) of a rectangle in 2D.
Query string window; Window numbers:
void ShowLandInfo(TileIndex tile)
Show land information window.
Offset at left to draw the frame rectangular area.
Game options window; Window numbers:
Class for the string query window.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
void InvalidateData(int data=0, bool gui_scope=true)
Mark this window's data as invalid (in need of re-computing)
int height
Height of the window (number of pixels down in y direction)
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
void UpdateSize()
Update Textbuf type with its actual physical character and screenlength Get the count of characters i...
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.