OpenTTD Source  20240917-master-g9ab0a47812
airport_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 "economy_func.h"
12 #include "window_gui.h"
13 #include "station_gui.h"
14 #include "terraform_gui.h"
15 #include "sound_func.h"
16 #include "window_func.h"
17 #include "strings_func.h"
18 #include "viewport_func.h"
19 #include "company_func.h"
20 #include "tilehighlight_func.h"
21 #include "company_base.h"
22 #include "station_type.h"
23 #include "newgrf_airport.h"
24 #include "newgrf_callbacks.h"
25 #include "dropdown_type.h"
26 #include "dropdown_func.h"
27 #include "core/geometry_func.hpp"
28 #include "hotkeys.h"
29 #include "vehicle_func.h"
30 #include "gui.h"
31 #include "command_func.h"
32 #include "airport_cmd.h"
33 #include "station_cmd.h"
34 #include "zoom_func.h"
35 #include "timer/timer.h"
37 
38 #include "widgets/airport_widget.h"
39 
40 #include "safeguards.h"
41 
42 
45 static uint8_t _selected_airport_layout;
46 
47 static void ShowBuildAirportPicker(Window *parent);
48 
49 SpriteID GetCustomAirportSprite(const AirportSpec *as, uint8_t layout);
50 
51 void CcBuildAirport(Commands, const CommandCost &result, TileIndex tile)
52 {
53  if (result.Failed()) return;
54 
55  if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile);
57 }
58 
63 static void PlaceAirport(TileIndex tile)
64 {
65  if (_selected_airport_index == -1) return;
66 
67  uint8_t airport_type = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index)->GetIndex();
68  uint8_t layout = _selected_airport_layout;
69  bool adjacent = _ctrl_pressed;
70 
71  auto proc = [=](bool test, StationID to_join) -> bool {
72  if (test) {
73  return Command<CMD_BUILD_AIRPORT>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_AIRPORT>()), tile, airport_type, layout, INVALID_STATION, adjacent).Succeeded();
74  } else {
75  return Command<CMD_BUILD_AIRPORT>::Post(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE, CcBuildAirport, tile, airport_type, layout, to_join, adjacent);
76  }
77  };
78 
79  ShowSelectStationIfNeeded(TileArea(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE), proc);
80 }
81 
84  int last_user_action; // Last started user action.
85 
87  {
88  this->InitNested(window_number);
89  this->OnInvalidateData();
91  this->last_user_action = INVALID_WID_AT;
92  }
93 
94  void Close([[maybe_unused]] int data = 0) override
95  {
98  this->Window::Close();
99  }
100 
106  void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override
107  {
108  if (!gui_scope) return;
109 
111  this->SetWidgetDisabledState(WID_AT_AIRPORT, !can_build);
112  if (!can_build) {
114 
115  /* Show in the tooltip why this button is disabled. */
116  this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
117  } else {
118  this->GetWidget<NWidgetCore>(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP);
119  }
120  }
121 
122  void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
123  {
124  switch (widget) {
125  case WID_AT_AIRPORT:
126  if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
127  ShowBuildAirportPicker(this);
128  this->last_user_action = widget;
129  }
130  break;
131 
132  case WID_AT_DEMOLISH:
134  this->last_user_action = widget;
135  break;
136 
137  default: break;
138  }
139  }
140 
141 
142  void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override
143  {
144  switch (this->last_user_action) {
145  case WID_AT_AIRPORT:
146  PlaceAirport(tile);
147  break;
148 
149  case WID_AT_DEMOLISH:
151  break;
152 
153  default: NOT_REACHED();
154  }
155  }
156 
157  void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override
158  {
159  VpSelectTilesWithMethod(pt.x, pt.y, select_method);
160  }
161 
162  void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override
163  {
164  if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) {
165  GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
166  }
167  }
168 
169  void OnPlaceObjectAbort() override
170  {
172 
173  this->RaiseButtons();
174 
177  }
178 
185  {
186  if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
188  if (w == nullptr) return ES_NOT_HANDLED;
189  return w->OnHotkey(hotkey);
190  }
191 
192  static inline HotkeyList hotkeys{"airtoolbar", {
193  Hotkey('1', "airport", WID_AT_AIRPORT),
194  Hotkey('2', "demolish", WID_AT_DEMOLISH),
196 };
197 
198 static constexpr NWidgetPart _nested_air_toolbar_widgets[] = {
200  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
201  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
202  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
203  EndContainer(),
205  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_AIRPORT), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP),
206  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
207  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
208  EndContainer(),
209 };
210 
211 static WindowDesc _air_toolbar_desc(
212  WDP_ALIGN_TOOLBAR, "toolbar_air", 0, 0,
215  _nested_air_toolbar_widgets,
216  &BuildAirToolbarWindow::hotkeys
217 );
218 
227 {
228  if (!Company::IsValidID(_local_company)) return nullptr;
229 
231  return AllocateWindowDescFront<BuildAirToolbarWindow>(_air_toolbar_desc, TRANSPORT_AIR);
232 }
233 
236  int line_height;
237  Scrollbar *vscroll;
238 
241  {
242  DropDownList list;
243 
244  for (const auto &cls : AirportClass::Classes()) {
245  list.push_back(MakeDropDownListStringItem(cls.name, cls.Index()));
246  }
247 
248  return list;
249  }
250 
251 public:
253  {
254  this->CreateNestedTree();
255 
256  this->vscroll = this->GetScrollbar(WID_AP_SCROLLBAR);
257  this->vscroll->SetCapacity(5);
258  this->vscroll->SetPosition(0);
259 
261 
264  this->OnInvalidateData();
265 
266  /* Ensure airport class is valid (changing NewGRFs). */
269  this->vscroll->SetCount(ac->GetSpecCount());
270 
271  /* Ensure the airport index is valid for this class (changing NewGRFs). */
273 
274  /* Only when no valid airport was selected, we want to select the first airport. */
275  bool selectFirstAirport = true;
276  if (_selected_airport_index != -1) {
278  if (as->IsAvailable()) {
279  /* Ensure the airport layout is valid. */
280  _selected_airport_layout = Clamp(_selected_airport_layout, 0, static_cast<uint8_t>(as->layouts.size() - 1));
281  selectFirstAirport = false;
282  this->UpdateSelectSize();
283  }
284  }
285 
286  if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
287  }
288 
289  void Close([[maybe_unused]] int data = 0) override
290  {
292  this->PickerWindowBase::Close();
293  }
294 
295  void SetStringParameters(WidgetID widget) const override
296  {
297  switch (widget) {
300  break;
301 
302  case WID_AP_LAYOUT_NUM:
303  SetDParam(0, STR_EMPTY);
304  if (_selected_airport_index != -1) {
307  if (string != STR_UNDEFINED) {
308  SetDParam(0, string);
309  } else if (as->layouts.size() > 1) {
310  SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME);
312  }
313  }
314  break;
315 
316  default: break;
317  }
318  }
319 
320  void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
321  {
322  switch (widget) {
323  case WID_AP_CLASS_DROPDOWN: {
324  Dimension d = {0, 0};
325  for (const auto &cls : AirportClass::Classes()) {
326  d = maxdim(d, GetStringBoundingBox(cls.name));
327  }
328  d.width += padding.width;
329  d.height += padding.height;
330  size = maxdim(size, d);
331  break;
332  }
333 
334  case WID_AP_AIRPORT_LIST: {
335  for (int i = 0; i < NUM_AIRPORTS; i++) {
336  const AirportSpec *as = AirportSpec::Get(i);
337  if (!as->enabled) continue;
338 
339  size.width = std::max(size.width, GetStringBoundingBox(as->name).width + padding.width);
340  }
341 
342  this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height;
343  size.height = 5 * this->line_height;
344  break;
345  }
346 
348  for (int i = 0; i < NUM_AIRPORTS; i++) {
349  const AirportSpec *as = AirportSpec::Get(i);
350  if (!as->enabled) continue;
351  for (uint8_t layout = 0; layout < static_cast<uint8_t>(as->layouts.size()); layout++) {
352  SpriteID sprite = GetCustomAirportSprite(as, layout);
353  if (sprite != 0) {
354  Dimension d = GetSpriteSize(sprite);
357  size = maxdim(d, size);
358  }
359  }
360  }
361  break;
362 
363  case WID_AP_EXTRA_TEXT:
364  for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) {
365  const AirportSpec *as = AirportSpec::Get(i);
366  if (!as->enabled) continue;
367  for (uint8_t layout = 0; layout < static_cast<uint8_t>(as->layouts.size()); layout++) {
369  if (string == STR_UNDEFINED) continue;
370 
371  Dimension d = GetStringMultiLineBoundingBox(string, size);
372  size = maxdim(d, size);
373  }
374  }
375  break;
376 
377  default: break;
378  }
379  }
380 
381  void DrawWidget(const Rect &r, WidgetID widget) const override
382  {
383  switch (widget) {
384  case WID_AP_AIRPORT_LIST: {
385  Rect row = r.WithHeight(this->line_height).Shrink(WidgetDimensions::scaled.bevel);
386  Rect text = r.WithHeight(this->line_height).Shrink(WidgetDimensions::scaled.matrix);
387  const auto specs = AirportClass::Get(_selected_airport_class)->Specs();
388  auto [first, last] = this->vscroll->GetVisibleRangeIterators(specs);
389  for (auto it = first; it != last; ++it) {
390  const AirportSpec *as = *it;
391  if (!as->IsAvailable()) {
393  }
394  DrawString(text, as->name, (static_cast<int>(as->index) == _selected_airport_index) ? TC_WHITE : TC_BLACK);
395  row = row.Translate(0, this->line_height);
396  text = text.Translate(0, this->line_height);
397  }
398  break;
399  }
400 
402  if (this->preview_sprite != 0) {
403  Dimension d = GetSpriteSize(this->preview_sprite);
404  DrawSprite(this->preview_sprite, COMPANY_SPRITE_COLOUR(_local_company), CenterBounds(r.left, r.right, d.width), CenterBounds(r.top, r.bottom, d.height));
405  }
406  break;
407 
408  case WID_AP_EXTRA_TEXT:
409  if (_selected_airport_index != -1) {
412  if (string != STR_UNDEFINED) {
413  DrawStringMultiLine(r.left, r.right, r.top, r.bottom, string, TC_BLACK);
414  }
415  }
416  break;
417  }
418  }
419 
420  void OnPaint() override
421  {
422  this->DrawWidgets();
423 
424  Rect r = this->GetWidget<NWidgetBase>(WID_AP_ACCEPTANCE)->GetCurrentRect();
425  int top = r.top;
426 
427  if (_selected_airport_index != -1) {
430 
431  /* only show the station (airport) noise, if the noise option is activated */
433  /* show the noise of the selected airport */
434  SetDParam(0, as->noise_level);
435  DrawString(r.left, r.right, top, STR_STATION_BUILD_NOISE);
437  }
438 
440  Money monthly = _price[PR_INFRASTRUCTURE_AIRPORT] * as->maintenance_cost >> 3;
441  SetDParam(0, monthly * 12);
442  DrawString(r.left, r.right, top, TimerGameEconomy::UsingWallclockUnits() ? STR_STATION_BUILD_INFRASTRUCTURE_COST_PERIOD : STR_STATION_BUILD_INFRASTRUCTURE_COST_YEAR);
444  }
445 
446  /* strings such as 'Size' and 'Coverage Area' */
448  top = DrawStationCoverageAreaText(r.left, r.right, top, SCT_ALL, rad, true);
449  }
450 
451  /* Resize background if the window is too small.
452  * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
453  * (This is the case, if making the window bigger moves the mouse into the window.) */
454  if (top > r.bottom) {
455  ResizeWindow(this, 0, top - r.bottom, false);
456  }
457  }
458 
459  void SelectOtherAirport(int airport_index)
460  {
461  _selected_airport_index = airport_index;
463 
464  this->UpdateSelectSize();
465  this->SetDirty();
466  }
467 
468  void UpdateSelectSize()
469  {
470  if (_selected_airport_index == -1) {
471  SetTileSelectSize(1, 1);
474  } else {
476  int w = as->size_x;
477  int h = as->size_y;
478  Direction rotation = as->layouts[_selected_airport_layout].rotation;
479  if (rotation == DIR_E || rotation == DIR_W) Swap(w, h);
480  SetTileSelectSize(w, h);
481 
482  this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout);
483 
486 
488  if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
489  }
490  }
491 
492  void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
493  {
494  switch (widget) {
497  break;
498 
499  case WID_AP_AIRPORT_LIST: {
500  int32_t num_clicked = this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget, 0, this->line_height);
501  if (num_clicked == INT32_MAX) break;
503  if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
504  break;
505  }
506 
511  this->SetDirty();
513  this->UpdateSelectSize();
514  SetViewportCatchmentStation(nullptr, true);
515  break;
516 
519  this->UpdateSelectSize();
520  this->SetDirty();
521  break;
522 
525  this->UpdateSelectSize();
526  this->SetDirty();
527  break;
528  }
529  }
530 
536  void SelectFirstAvailableAirport(bool change_class)
537  {
538  /* First try to select an airport in the selected class. */
540  for (const AirportSpec *as : sel_apclass->Specs()) {
541  if (as->IsAvailable()) {
542  this->SelectOtherAirport(as->index);
543  return;
544  }
545  }
546  if (change_class) {
547  /* If that fails, select the first available airport
548  * from the first class where airports are available. */
549  for (const auto &cls : AirportClass::Classes()) {
550  for (const auto &as : cls.Specs()) {
551  if (as->IsAvailable()) {
552  _selected_airport_class = cls.Index();
553  this->vscroll->SetCount(cls.GetSpecCount());
554  this->SelectOtherAirport(as->index);
555  return;
556  }
557  }
558  }
559  }
560  /* If all airports are unavailable, select nothing. */
561  this->SelectOtherAirport(-1);
562  }
563 
564  void OnDropdownSelect(WidgetID widget, int index) override
565  {
566  if (widget == WID_AP_CLASS_DROPDOWN) {
569  this->SelectFirstAvailableAirport(false);
570  }
571  }
572 
573  void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
574  {
576  }
577 
578  IntervalTimer<TimerGameCalendar> yearly_interval = {{TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [this](auto) {
579  this->InvalidateData();
580  }};
581 };
582 
583 static constexpr NWidgetPart _nested_build_airport_widgets[] = {
585  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
586  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
587  EndContainer(),
588  NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
591  NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0),
592  NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP),
593  NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0),
595  NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetMatrixDataTip(1, 5, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR),
597  EndContainer(),
598  NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_ORIENTATION, STR_NULL), SetFill(1, 0),
601  NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING1, STR_NULL),
603  EndContainer(),
604  NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
605  NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
606  NWidget(NWID_HORIZONTAL), SetPIP(14, 0, 14), SetPIPRatio(1, 0, 1),
608  NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
609  SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
610  NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
611  SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
612  EndContainer(),
613  EndContainer(),
614  EndContainer(),
615  NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_ACCEPTANCE), SetResize(0, 1), SetFill(1, 0), SetMinimalTextLines(2, WidgetDimensions::unscaled.vsep_normal),
616  EndContainer(),
617  EndContainer(),
618 };
619 
620 static WindowDesc _build_airport_desc(
621  WDP_AUTO, nullptr, 0, 0,
624  _nested_build_airport_widgets
625 );
626 
627 static void ShowBuildAirportPicker(Window *parent)
628 {
629  new BuildAirportWindow(_build_airport_desc, parent);
630 }
631 
632 void InitializeAirportGui()
633 {
636 }
SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1183
SetTileSelectSize
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
Definition: viewport.cpp:2539
DDSP_DEMOLISH_AREA
@ DDSP_DEMOLISH_AREA
Clear area.
Definition: viewport_type.h:112
CA_UNMODIFIED
@ CA_UNMODIFIED
Catchment for all stations with "modified catchment" disabled.
Definition: station_type.h:84
CloseWindowByClass
void CloseWindowByClass(WindowClass cls, int data)
Close all windows of a given class.
Definition: window.cpp:1152
sound_func.h
TileHighlightData::size
Point size
Size, in tile "units", of the white/red selection area.
Definition: tilehighlight_type.h:48
GUISettings::station_show_coverage
bool station_show_coverage
whether to highlight coverage area
Definition: settings_type.h:197
WC_BUILD_TOOLBAR
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
Definition: window_type.h:73
WID_AP_LAYOUT_NUM
@ WID_AP_LAYOUT_NUM
Current number of the layout.
Definition: airport_widget.h:26
GameSettings::station
StationSettings station
settings related to station management
Definition: settings_type.h:605
DIR_E
@ DIR_E
East.
Definition: direction_type.h:28
HotkeyList
List of hotkeys for a window.
Definition: hotkeys.h:37
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:30
command_func.h
WidgetDimensions::scaled
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition: window_gui.h:68
airport_cmd.h
Swap
constexpr void Swap(T &a, T &b)
Type safe swap operation.
Definition: math_func.hpp:283
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:68
WDF_CONSTRUCTION
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:206
dropdown_func.h
ShowBuildAirToolbar
Window * ShowBuildAirToolbar()
Open the build airport toolbar window.
Definition: airport_gui.cpp:226
Rect::Shrink
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Definition: geometry_type.hpp:98
_selected_airport_class
static AirportClassID _selected_airport_class
the currently visible airport class
Definition: airport_gui.cpp:43
company_base.h
WID_AP_LAYOUT_DECREASE
@ WID_AP_LAYOUT_DECREASE
Decrease the layout number.
Definition: airport_widget.h:27
ViewportDragDropSelectionProcess
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you've selected it.
Definition: viewport_type.h:111
CommandFlagsToDCFlags
static constexpr DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
Extracts the DC flags needed for DoCommand from the flags returned by GetCommandFlags.
Definition: command_func.h:58
timer_game_calendar.h
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:63
CheckRedrawStationCoverage
void CheckRedrawStationCoverage(const Window *w)
Check whether we need to redraw the station coverage text.
Definition: station_gui.cpp:160
Scrollbar::SetPosition
bool SetPosition(size_type position)
Sets the position of the first visible element.
Definition: widget_type.h:812
AirportSpec::layouts
std::vector< AirportTileLayout > layouts
List of layouts composing the airport.
Definition: newgrf_airport.h:107
StringID
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
WWT_IMGBTN
@ WWT_IMGBTN
(Toggle) Button with image
Definition: widget_type.h:54
AirportSpec::name
StringID name
name of this airport
Definition: newgrf_airport.h:115
WWT_LABEL
@ WWT_LABEL
Centered label.
Definition: widget_type.h:59
CloseWindowById
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
DropDownList
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
Definition: dropdown_type.h:50
AirportSpec::catchment
uint8_t catchment
catchment area of this airport
Definition: newgrf_airport.h:112
IntervalTimer< TimerGameCalendar >
WDP_ALIGN_TOOLBAR
@ WDP_ALIGN_TOOLBAR
Align toward the toolbar.
Definition: window_gui.h:152
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:77
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition: geometry_func.cpp:22
Window::Close
virtual void Close(int data=0)
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:1047
WWT_MATRIX
@ WWT_MATRIX
Grid of rows and columns.
Definition: widget_type.h:61
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1193
PlaceProc_DemolishArea
void PlaceProc_DemolishArea(TileIndex tile)
Start a drag for demolishing an area.
Definition: terraform_gui.cpp:151
SetMatrixDataTip
constexpr NWidgetPart SetMatrixDataTip(uint8_t cols, uint8_t rows, StringID tip)
Widget part function for setting the data and tooltip of WWT_MATRIX widgets.
Definition: widget_type.h:1216
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:38
SND_15_BEEP
@ SND_15_BEEP
19 == 0x13 GUI button click
Definition: sound_type.h:58
FILLRECT_CHECKER
@ FILLRECT_CHECKER
Draw only every second pixel, used for greying-out.
Definition: gfx_type.h:301
HandlePlacePushButton
bool HandlePlacePushButton(Window *w, WidgetID widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
Definition: main_gui.cpp:63
zoom_func.h
TILE_SIZE
static const uint TILE_SIZE
Tile size in world coordinates.
Definition: tile_type.h:15
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:525
newgrf_airport.h
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:56
newgrf_callbacks.h
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget tree.
Definition: widget_type.h:50
ANIMCURSOR_DEMOLISH
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
Definition: sprites.h:1508
TimerGameEconomy::UsingWallclockUnits
static bool UsingWallclockUnits(bool newgame=false)
Check if we are using wallclock units.
Definition: timer_game_economy.cpp:97
RectPadding::Vertical
constexpr uint Vertical() const
Get total vertical padding of RectPadding.
Definition: geometry_type.hpp:69
WWT_PUSHARROWBTN
@ WWT_PUSHARROWBTN
Normal push-button (no toggle button) with arrow caption.
Definition: widget_type.h:116
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
_selected_airport_index
static int _selected_airport_index
the index of the selected airport in the current class or -1
Definition: airport_gui.cpp:44
WC_BUILD_STATION
@ WC_BUILD_STATION
Build station; Window numbers:
Definition: window_type.h:403
economy_func.h
ViewportPlaceMethod
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:92
Scrollbar
Scrollbar data structure.
Definition: widget_type.h:696
Window::GetScrollbar
const Scrollbar * GetScrollbar(WidgetID widnum) const
Return the Scrollbar to a widget index.
Definition: window.cpp:314
Window::OnHotkey
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:565
AirportSpec
Defines the data structure for an airport.
Definition: newgrf_airport.h:105
Rect::WithHeight
Rect WithHeight(int height, bool end=false) const
Copy Rect and set its height.
Definition: geometry_type.hpp:211
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:1077
ResizeWindow
void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen, bool schedule_resize)
Resize the window.
Definition: window.cpp:2022
WID_AP_AIRPORT_SPRITE
@ WID_AP_AIRPORT_SPRITE
A visual display of the airport currently selected.
Definition: airport_widget.h:29
WID_AT_DEMOLISH
@ WID_AT_DEMOLISH
Demolish button.
Definition: airport_widget.h:16
CBID_AIRPORT_ADDITIONAL_TEXT
@ CBID_AIRPORT_ADDITIONAL_TEXT
This callback is called from airport list.
Definition: newgrf_callbacks.h:248
WindowDesc
High level window description.
Definition: window_gui.h:162
WidgetID
int WidgetID
Widget ID.
Definition: window_type.h:18
RectPadding::Horizontal
constexpr uint Horizontal() const
Get total horizontal padding of RectPadding.
Definition: geometry_type.hpp:63
WID_AP_BTN_DOHILIGHT
@ WID_AP_BTN_DOHILIGHT
Show the coverage button.
Definition: airport_widget.h:33
_selected_airport_layout
static uint8_t _selected_airport_layout
selected airport layout number.
Definition: airport_gui.cpp:45
window_gui.h
NC_EQUALSIZE
@ NC_EQUALSIZE
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:526
SetPadding
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1230
DIR_W
@ DIR_W
West.
Definition: direction_type.h:32
NewGRFSpecBase::index
uint16_t index
Index within class of this spec, invalid until inserted into class.
Definition: newgrf_class.h:19
EconomySettings::station_noise_level
bool station_noise_level
build new airports when the town noise level is still within accepted limits
Definition: settings_type.h:532
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition: widget_type.h:1128
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:150
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:317
CommandCost
Common return value for all commands.
Definition: command_type.h:23
WID_AP_SCROLLBAR
@ WID_AP_SCROLLBAR
Scrollbar of the list.
Definition: airport_widget.h:25
WID_AP_LAYOUT_INCREASE
@ WID_AP_LAYOUT_INCREASE
Increase the layout number.
Definition: airport_widget.h:28
tilehighlight_func.h
ClientSettings::sound
SoundSettings sound
sound effect settings
Definition: settings_type.h:614
WindowNumber
int32_t WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:731
NewGRFClass::Specs
std::span< Tspec *const > Specs() const
Get read-only span of specs of this class.
Definition: newgrf_class.h:58
FS_NORMAL
@ FS_NORMAL
Index of the normal font in the font tables.
Definition: gfx_type.h:209
Rect::Translate
Rect Translate(int x, int y) const
Copy and translate Rect by x,y pixels.
Definition: geometry_type.hpp:174
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1746
SetScrollbar
constexpr NWidgetPart SetScrollbar(WidgetID index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1286
NewGRFClass::Classes
static std::span< NewGRFClass< Tspec, Tindex, Tmax > const > Classes()
Get read-only span of all classes of this type.
Definition: newgrf_class.h:64
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:940
HT_DIAGONAL
@ HT_DIAGONAL
Also allow 'diagonal rectangles'. Only usable in combination with HT_RECT or HT_POINT.
Definition: tilehighlight_type.h:28
station_cmd.h
ES_NOT_HANDLED
@ ES_NOT_HANDLED
The passed event is not handled.
Definition: window_type.h:739
CommandCost::Failed
bool Failed() const
Did this command fail?
Definition: command_type.h:171
PickerWindowBase::Close
void Close([[maybe_unused]] int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:3511
VpSelectTilesWithMethod
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
Definition: viewport.cpp:3213
dropdown_type.h
ShowSelectStationIfNeeded
void ShowSelectStationIfNeeded(TileArea ta, StationPickerCmdProc proc)
Show the station selection window when needed.
Definition: station_gui.cpp:2489
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:57
BuildAirportWindow::preview_sprite
SpriteID preview_sprite
Cached airport preview sprite.
Definition: airport_gui.cpp:235
GameSettings::economy
EconomySettings economy
settings to change the economy
Definition: settings_type.h:603
Window::parent
Window * parent
Parent window.
Definition: window_gui.h:331
Scrollbar::GetScrolledRowFromWidget
size_type GetScrolledRowFromWidget(int clickpos, const Window *const w, WidgetID widget, int padding=0, int line_height=-1) const
Compute the row of a scrolled widget that a user clicked in.
Definition: widget.cpp:2320
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1311
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:52
safeguards.h
timer.h
CBID_AIRPORT_LAYOUT_NAME
@ CBID_AIRPORT_LAYOUT_NAME
Called to determine text to show as airport layout name.
Definition: newgrf_callbacks.h:251
Window::Window
Window(WindowDesc &desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition: window.cpp:1756
NUM_AIRPORTS
@ NUM_AIRPORTS
Maximal number of airports in total.
Definition: airport.h:41
AirportSpec::maintenance_cost
uint16_t maintenance_cost
maintenance cost multiplier
Definition: newgrf_airport.h:118
DrawSprite
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Definition: gfx.cpp:988
GetStringMultiLineBoundingBox
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
Definition: gfx.cpp:740
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
Scrollbar::SetCapacity
void SetCapacity(size_t capacity)
Set the capacity of visible elements.
Definition: widget_type.h:796
CenterBounds
int CenterBounds(int min, int max, int size)
Determine where to draw a centred object inside a widget.
Definition: gfx_func.h:166
PlaceAirport
static void PlaceAirport(TileIndex tile)
Place an airport.
Definition: airport_gui.cpp:63
NewGRFClass::GetSpec
const Tspec * GetSpec(uint index) const
Get a spec from the class at a given index.
Definition: newgrf_class_func.h:114
stdafx.h
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:305
GUISettings::link_terraform_toolbar
bool link_terraform_toolbar
display terraform toolbar when displaying rail, road, water and airport toolbars
Definition: settings_type.h:150
GfxFillRect
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.
Definition: gfx.cpp:114
GetAirportTextCallback
StringID GetAirportTextCallback(const AirportSpec *as, uint8_t layout, uint16_t callback)
Get a custom text for the airport.
Definition: newgrf_airport.cpp:274
SpriteID
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:18
CanBuildVehicleInfrastructure
bool CanBuildVehicleInfrastructure(VehicleType type, uint8_t subtype)
Check whether we can build infrastructure for the given vehicle type.
Definition: vehicle.cpp:1922
Window::InvalidateData
void InvalidateData(int data=0, bool gui_scope=true)
Mark this window's data as invalid (in need of re-computing)
Definition: window.cpp:3148
AirportSpec::IsAvailable
bool IsAvailable() const
Check whether this airport is available to build.
Definition: newgrf_airport.cpp:82
viewport_func.h
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:45
Window::SetWidgetLoweredState
void SetWidgetLoweredState(WidgetID widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Definition: window_gui.h:450
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition: widget_type.h:79
WID_AP_CLASS_DROPDOWN
@ WID_AP_CLASS_DROPDOWN
Dropdown of airport classes.
Definition: airport_widget.h:23
WID_AP_EXTRA_TEXT
@ WID_AP_EXTRA_TEXT
Additional text about the airport.
Definition: airport_widget.h:30
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition: window_gui.h:67
AirportSpec::size_x
uint8_t size_x
size of airport in x direction
Definition: newgrf_airport.h:109
Window::SetWidgetDisabledState
void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
Definition: window_gui.h:390
GetSpriteSize
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Definition: gfx.cpp:922
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:71
DrawStationCoverageAreaText
int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageType sct, int rad, bool supplies)
Calculates and draws the accepted or supplied cargo around the selected tile(s)
Definition: station_gui.cpp:77
EconomySettings::infrastructure_maintenance
bool infrastructure_maintenance
enable monthly maintenance fee for owner infrastructure
Definition: settings_type.h:535
SCT_ALL
@ SCT_ALL
Draw all cargoes.
Definition: station_gui.h:23
Window::IsWidgetLowered
bool IsWidgetLowered(WidgetID widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:500
SoundSettings::confirm
bool confirm
Play sound effect on successful constructions or other actions.
Definition: settings_type.h:248
DrawStringMultiLine
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.
Definition: gfx.cpp:774
WID_AP_ACCEPTANCE
@ WID_AP_ACCEPTANCE
Acceptance info.
Definition: airport_widget.h:34
vehicle_func.h
WC_SELECT_STATION
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
Definition: window_type.h:242
Window::CreateNestedTree
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
Definition: window.cpp:1723
strings_func.h
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition: widget_type.h:86
AirportSpec::enabled
bool enabled
Entity still available (by default true). Newgrf can disable it, though.
Definition: newgrf_airport.h:120
terraform_gui.h
WID_AT_AIRPORT
@ WID_AT_AIRPORT
Build airport button.
Definition: airport_widget.h:15
BuildAirportWindow::OnPaint
void OnPaint() override
The window must be repainted.
Definition: airport_gui.cpp:420
NEW_AIRPORT_OFFSET
@ NEW_AIRPORT_OFFSET
Number of the first newgrf airport.
Definition: airport.h:39
AirportSpec::size_y
uint8_t size_y
size of airport in y direction
Definition: newgrf_airport.h:110
AirportClassID
AirportClassID
List of default airport classes.
Definition: newgrf_airport.h:70
BuildAirportWindow::OnRealtimeTick
void OnRealtimeTick([[maybe_unused]] uint delta_ms) override
Called periodically.
Definition: airport_gui.cpp:573
BuildAirToolbarWindow::OnPlaceObjectAbort
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
Definition: airport_gui.cpp:169
Window::DisableWidget
void DisableWidget(WidgetID widget_index)
Sets a widget to disabled.
Definition: window_gui.h:400
SetPIP
constexpr NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1262
AirportSpec::noise_level
uint8_t noise_level
noise that this airport generates
Definition: newgrf_airport.h:111
WC_SCEN_LAND_GEN
@ WC_SCEN_LAND_GEN
Landscape generation (in Scenario Editor); Window numbers:
Definition: window_type.h:455
SetDParam
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
geometry_func.hpp
Window::OnInvalidateData
virtual void OnInvalidateData([[maybe_unused]] int data=0, [[maybe_unused]] bool gui_scope=true)
Some data on this window has become invalid.
Definition: window_gui.h:789
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:52
airport_widget.h
WidgetDimensions::vsep_normal
int vsep_normal
Normal vertical spacing.
Definition: window_gui.h:60
Scrollbar::SetCount
void SetCount(size_t num)
Sets the number of elements in the list.
Definition: widget_type.h:782
EventState
EventState
State of handling an event.
Definition: window_type.h:737
HT_RECT
@ HT_RECT
rectangle (stations, depots, ...)
Definition: tilehighlight_type.h:21
BuildAirportWindow::SelectFirstAvailableAirport
void SelectFirstAvailableAirport(bool change_class)
Select the first available airport.
Definition: airport_gui.cpp:536
Direction
Direction
Defines the 8 directions on the map.
Definition: direction_type.h:24
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition: window.cpp:1733
PC_BLACK
static const uint8_t PC_BLACK
Black palette colour.
Definition: palette_func.h:67
ShowDropDownList
void ShowDropDownList(Window *w, DropDownList &&list, int selected, WidgetID button, uint width, bool instant_close, bool persist)
Show a drop down list.
Definition: dropdown.cpp:404
NewGRFClass
Struct containing information relating to NewGRF classes for stations and airports.
Definition: newgrf_class.h:26
company_func.h
PickerWindowBase
Base class for windows opened from a toolbar.
Definition: window_gui.h:989
SetViewportCatchmentStation
void SetViewportCatchmentStation(const Station *st, bool sel)
Select or deselect station for coverage area highlight.
Definition: viewport.cpp:3615
Window::top
int top
y position of top edge of the window
Definition: window_gui.h:313
TileArea
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
Definition: tilearea_type.h:102
CommandHelper
Definition: command_func.h:93
WID_AP_AIRPORT_LIST
@ WID_AP_AIRPORT_LIST
List of airports.
Definition: airport_widget.h:24
window_func.h
SoundSettings::click_beep
bool click_beep
Beep on a random selection of buttons.
Definition: settings_type.h:249
GetCharacterHeight
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Definition: fontcache.cpp:77
ShowTerraformToolbar
Window * ShowTerraformToolbar(Window *link)
Show the toolbar for terraforming in the game.
Definition: terraform_gui.cpp:368
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1139
SetPIPRatio
constexpr NWidgetPart SetPIPRatio(uint8_t ratio_pre, uint8_t ratio_inter, uint8_t ratio_post)
Widget part function for setting a pre/inter/post ratio.
Definition: widget_type.h:1274
SND_1F_CONSTRUCTION_OTHER
@ SND_1F_CONSTRUCTION_OTHER
29 == 0x1D Construction: other (non-water, non-rail, non-bridge)
Definition: sound_type.h:68
OverflowSafeInt< int64_t >
DrawString
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
VEH_AIRCRAFT
@ VEH_AIRCRAFT
Aircraft vehicle type.
Definition: vehicle_type.h:27
BuildAirToolbarWindow::OnInvalidateData
void OnInvalidateData([[maybe_unused]] int data=0, [[maybe_unused]] bool gui_scope=true) override
Some data on this window has become invalid.
Definition: airport_gui.cpp:106
gui.h
BuildAirportWindow
Definition: airport_gui.cpp:234
BuildAirToolbarWindow::AirportToolbarGlobalHotkeys
static EventState AirportToolbarGlobalHotkeys(int hotkey)
Handler for global hotkeys of the BuildAirToolbarWindow.
Definition: airport_gui.cpp:184
Window
Data structure for an opened window.
Definition: window_gui.h:276
Commands
Commands
List of commands.
Definition: command_type.h:187
Pool::PoolItem<&_company_pool >::IsValidID
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition: pool_type.hpp:328
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:731
Clamp
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
Definition: math_func.hpp:79
SetDataTip
constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1204
SetMinimalTextLines
constexpr NWidgetPart SetMinimalTextLines(uint8_t lines, uint8_t spacing, FontSize size=FS_NORMAL)
Widget part function for setting the minimal text lines.
Definition: widget_type.h:1151
NewGRFClass::GetClassCount
static uint GetClassCount()
Get the number of allocated classes.
Definition: newgrf_class_func.h:93
TRANSPORT_AIR
@ TRANSPORT_AIR
Transport through air.
Definition: transport_type.h:30
APC_BEGIN
@ APC_BEGIN
Lowest valid airport class id.
Definition: newgrf_airport.h:71
NewGRFClass::Get
static NewGRFClass * Get(Tindex class_index)
Get a particular class.
Definition: newgrf_class_func.h:82
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:75
BuildAirportWindow::BuildAirportClassDropDown
static DropDownList BuildAirportClassDropDown()
Build a dropdown list of available airport classes.
Definition: airport_gui.cpp:240
AWV_INCREASE
@ AWV_INCREASE
Arrow to the right or in case of RTL to the left.
Definition: widget_type.h:34
NewGRFClass::GetSpecCount
uint GetSpecCount() const
Get the number of allocated specs within the class.
Definition: newgrf_class.h:70
BuildAirToolbarWindow
Airport build toolbar window handler.
Definition: airport_gui.cpp:83
WidgetDimensions::framerect
RectPadding framerect
Standard padding inside many panels.
Definition: window_gui.h:42
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
Definition: viewport.cpp:3495
Scrollbar::GetVisibleRangeIterators
auto GetVisibleRangeIterators(Tcontainer &container) const
Get a pair of iterators for the range of visible elements in a container.
Definition: widget_type.h:862
station_gui.h
AirportSpec::Get
static const AirportSpec * Get(uint8_t type)
Retrieve airport spec for the given airport.
Definition: newgrf_airport.cpp:55
GetStringBoundingBox
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition: gfx.cpp:851
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:57
ClientSettings::gui
GUISettings gui
settings related to the GUI
Definition: settings_type.h:611
WID_AP_BTN_DONTHILIGHT
@ WID_AP_BTN_DONTHILIGHT
Don't show the coverage button.
Definition: airport_widget.h:32
AWV_DECREASE
@ AWV_DECREASE
Arrow to the left or in case of RTL to the right.
Definition: widget_type.h:33
WWT_DROPDOWN
@ WWT_DROPDOWN
Drop down list.
Definition: widget_type.h:72
GUISettings::persistent_buildingtools
bool persistent_buildingtools
keep the building tools active after usage
Definition: settings_type.h:198
station_type.h
StationSettings::modified_catchment
bool modified_catchment
different-size catchment areas
Definition: settings_type.h:565
Hotkey
All data for a single hotkey.
Definition: hotkeys.h:21
hotkeys.h
GUIPlaceProcDragXY
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile)
A central place to handle all X_AND_Y dragged GUI functions.
Definition: terraform_gui.cpp:112