OpenTTD Source  13.2.1
dock_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 "terraform_gui.h"
12 #include "window_gui.h"
13 #include "station_gui.h"
14 #include "command_func.h"
15 #include "water.h"
16 #include "window_func.h"
17 #include "vehicle_func.h"
18 #include "sound_func.h"
19 #include "viewport_func.h"
20 #include "gfx_func.h"
21 #include "company_func.h"
22 #include "slope_func.h"
23 #include "tilehighlight_func.h"
24 #include "company_base.h"
25 #include "hotkeys.h"
26 #include "gui.h"
27 #include "zoom_func.h"
28 #include "tunnelbridge_cmd.h"
29 #include "dock_cmd.h"
30 #include "station_cmd.h"
31 #include "water_cmd.h"
32 #include "waypoint_cmd.h"
33 
34 #include "widgets/dock_widget.h"
35 
36 #include "table/sprites.h"
37 #include "table/strings.h"
38 
39 #include "safeguards.h"
40 
41 static void ShowBuildDockStationPicker(Window *parent);
42 static void ShowBuildDocksDepotPicker(Window *parent);
43 
44 static Axis _ship_depot_direction;
45 
46 void CcBuildDocks(Commands cmd, const CommandCost &result, TileIndex tile)
47 {
48  if (result.Failed()) return;
49 
50  if (_settings_client.sound.confirm) SndPlayTileFx(SND_02_CONSTRUCTION_WATER, tile);
52 }
53 
54 void CcPlaySound_CONSTRUCTION_WATER(Commands cmd, const CommandCost &result, TileIndex tile)
55 {
56  if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_CONSTRUCTION_WATER, tile);
57 }
58 
59 
66 static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = nullptr)
67 {
68  int z;
70 
71  /* If the direction isn't right, just return the next tile so the command
72  * complains about the wrong slope instead of the ends not matching up.
73  * Make sure the coordinate is always a valid tile within the map, so we
74  * don't go "off" the map. That would cause the wrong error message. */
75  if (!IsValidDiagDirection(dir)) return TILE_ADDXY(tile_from, TileX(tile_from) > 2 ? -1 : 1, 0);
76 
77  /* Direction the aqueduct is built to. */
79  /* The maximum length of the aqueduct. */
80  int max_length = std::min<int>(_settings_game.construction.max_bridge_length, DistanceFromEdgeDir(tile_from, ReverseDiagDir(dir)) - 1);
81 
82  TileIndex endtile = tile_from;
83  for (int length = 0; IsValidTile(endtile) && TileX(endtile) != 0 && TileY(endtile) != 0; length++) {
84  endtile = TILE_ADD(endtile, offset);
85 
86  if (length > max_length) break;
87 
88  if (GetTileMaxZ(endtile) > z) {
89  if (tile_to != nullptr) *tile_to = endtile;
90  break;
91  }
92  }
93 
94  return endtile;
95 }
96 
100 
102  {
103  this->last_clicked_widget = WID_DT_INVALID;
104  this->InitNested(window_number);
105  this->OnInvalidateData();
107  }
108 
109  void Close() override
110  {
111  if (_game_mode == GM_NORMAL && this->IsWidgetLowered(WID_DT_STATION)) SetViewportCatchmentStation(nullptr, true);
113  this->Window::Close();
114  }
115 
121  void OnInvalidateData(int data = 0, bool gui_scope = true) override
122  {
123  if (!gui_scope) return;
124 
125  bool can_build = CanBuildVehicleInfrastructure(VEH_SHIP);
126  this->SetWidgetsDisabledState(!can_build,
127  WID_DT_DEPOT,
129  WID_DT_BUOY,
131  if (!can_build) {
134  }
135 
136  if (_game_mode != GM_EDITOR) {
137  if (!can_build) {
138  /* Show in the tooltip why this button is disabled. */
139  this->GetWidget<NWidgetCore>(WID_DT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
140  this->GetWidget<NWidgetCore>(WID_DT_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
141  this->GetWidget<NWidgetCore>(WID_DT_BUOY)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
142  } else {
143  this->GetWidget<NWidgetCore>(WID_DT_DEPOT)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP);
144  this->GetWidget<NWidgetCore>(WID_DT_STATION)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP);
145  this->GetWidget<NWidgetCore>(WID_DT_BUOY)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP);
146  }
147  }
148  }
149 
150  void OnClick(Point pt, int widget, int click_count) override
151  {
152  switch (widget) {
153  case WID_DT_CANAL: // Build canal button
154  HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT);
155  break;
156 
157  case WID_DT_LOCK: // Build lock button
158  HandlePlacePushButton(this, WID_DT_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL);
159  break;
160 
161  case WID_DT_DEMOLISH: // Demolish aka dynamite button
163  break;
164 
165  case WID_DT_DEPOT: // Build depot button
166  if (HandlePlacePushButton(this, WID_DT_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this);
167  break;
168 
169  case WID_DT_STATION: // Build station button
170  if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this);
171  break;
172 
173  case WID_DT_BUOY: // Build buoy button
174  HandlePlacePushButton(this, WID_DT_BUOY, SPR_CURSOR_BUOY, HT_RECT);
175  break;
176 
177  case WID_DT_RIVER: // Build river button (in scenario editor)
178  if (_game_mode != GM_EDITOR) return;
179  HandlePlacePushButton(this, WID_DT_RIVER, SPR_CURSOR_RIVER, HT_RECT | HT_DIAGONAL);
180  break;
181 
182  case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
183  HandlePlacePushButton(this, WID_DT_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL);
184  break;
185 
186  default: return;
187  }
188  this->last_clicked_widget = (DockToolbarWidgets)widget;
189  }
190 
191  void OnPlaceObject(Point pt, TileIndex tile) override
192  {
193  switch (this->last_clicked_widget) {
194  case WID_DT_CANAL: // Build canal button
196  break;
197 
198  case WID_DT_LOCK: // Build lock button
199  Command<CMD_BUILD_LOCK>::Post(STR_ERROR_CAN_T_BUILD_LOCKS, CcBuildDocks, tile);
200  break;
201 
202  case WID_DT_DEMOLISH: // Demolish aka dynamite button
204  break;
205 
206  case WID_DT_DEPOT: // Build depot button
207  Command<CMD_BUILD_SHIP_DEPOT>::Post(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT, CcBuildDocks, tile, _ship_depot_direction);
208  break;
209 
210  case WID_DT_STATION: { // Build station button
211  /* Determine the watery part of the dock. */
213  TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile);
214 
215  bool adjacent = _ctrl_pressed;
216  auto proc = [=](bool test, StationID to_join) -> bool {
217  if (test) {
218  return Command<CMD_BUILD_DOCK>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_DOCK>()), tile, INVALID_STATION, adjacent).Succeeded();
219  } else {
220  return Command<CMD_BUILD_DOCK>::Post(STR_ERROR_CAN_T_BUILD_DOCK_HERE, CcBuildDocks, tile, to_join, adjacent);
221  }
222  };
223 
224  ShowSelectStationIfNeeded(TileArea(tile, tile_to), proc);
225  break;
226  }
227 
228  case WID_DT_BUOY: // Build buoy button
229  Command<CMD_BUILD_BUOY>::Post(STR_ERROR_CAN_T_POSITION_BUOY_HERE, CcBuildDocks, tile);
230  break;
231 
232  case WID_DT_RIVER: // Build river button (in scenario editor)
234  break;
235 
236  case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
237  Command<CMD_BUILD_BRIDGE>::Post(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE, CcBuildBridge, tile, GetOtherAqueductEnd(tile), TRANSPORT_WATER, 0, 0);
238  break;
239 
240  default: NOT_REACHED();
241  }
242  }
243 
244  void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
245  {
246  VpSelectTilesWithMethod(pt.x, pt.y, select_method);
247  }
248 
249  void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
250  {
251  if (pt.x != -1) {
252  switch (select_proc) {
253  case DDSP_DEMOLISH_AREA:
254  GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
255  break;
256  case DDSP_CREATE_WATER:
257  Command<CMD_BUILD_CANAL>::Post(STR_ERROR_CAN_T_BUILD_CANALS, CcPlaySound_CONSTRUCTION_WATER, end_tile, start_tile, (_game_mode == GM_EDITOR && _ctrl_pressed) ? WATER_CLASS_SEA : WATER_CLASS_CANAL, false);
258  break;
259  case DDSP_CREATE_RIVER:
260  Command<CMD_BUILD_CANAL>::Post(STR_ERROR_CAN_T_PLACE_RIVERS, CcPlaySound_CONSTRUCTION_WATER, end_tile, start_tile, WATER_CLASS_RIVER, _ctrl_pressed);
261  break;
262 
263  default: break;
264  }
265  }
266  }
267 
268  void OnPlaceObjectAbort() override
269  {
270  if (_game_mode != GM_EDITOR && this->IsWidgetLowered(WID_DT_STATION)) SetViewportCatchmentStation(nullptr, true);
271 
272  this->RaiseButtons();
273 
278  }
279 
280  void OnPlacePresize(Point pt, TileIndex tile_from) override
281  {
282  TileIndex tile_to = tile_from;
283 
284  if (this->last_clicked_widget == WID_DT_BUILD_AQUEDUCT) {
285  GetOtherAqueductEnd(tile_from, &tile_to);
286  } else {
288  if (IsValidDiagDirection(dir)) {
289  /* Locks and docks always select the tile "down" the slope. */
290  tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir));
291  /* Locks also select the tile "up" the slope. */
292  if (this->last_clicked_widget == WID_DT_LOCK) tile_from = TileAddByDiagDir(tile_from, dir);
293  }
294  }
295 
296  VpSetPresizeRange(tile_from, tile_to);
297  }
298 
299  static HotkeyList hotkeys;
300 };
301 
308 {
309  if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
311  if (w == nullptr) return ES_NOT_HANDLED;
312  return w->OnHotkey(hotkey);
313 }
314 
315 const uint16 _dockstoolbar_aqueduct_keys[] = {'B', '8', 0};
316 
317 static Hotkey dockstoolbar_hotkeys[] = {
318  Hotkey('1', "canal", WID_DT_CANAL),
319  Hotkey('2', "lock", WID_DT_LOCK),
320  Hotkey('3', "demolish", WID_DT_DEMOLISH),
321  Hotkey('4', "depot", WID_DT_DEPOT),
322  Hotkey('5', "dock", WID_DT_STATION),
323  Hotkey('6', "buoy", WID_DT_BUOY),
324  Hotkey('7', "river", WID_DT_RIVER),
325  Hotkey(_dockstoolbar_aqueduct_keys, "aqueduct", WID_DT_BUILD_AQUEDUCT),
326  HOTKEY_LIST_END
327 };
328 HotkeyList BuildDocksToolbarWindow::hotkeys("dockstoolbar", dockstoolbar_hotkeys, DockToolbarGlobalHotkeys);
329 
336  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
337  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WATERWAYS_TOOLBAR_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
338  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
339  EndContainer(),
341  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_BUILD_CANALS_TOOLTIP),
342  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP),
343  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
344  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
345  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEPOT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DEPOT, STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP),
346  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_STATION), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DOCK, STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP),
347  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUOY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP),
348  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUILD_AQUEDUCT), SetMinimalSize(23, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP),
349  EndContainer(),
350 };
351 
352 static WindowDesc _build_docks_toolbar_desc(
353  WDP_ALIGN_TOOLBAR, "toolbar_water", 0, 0,
357  &BuildDocksToolbarWindow::hotkeys
358 );
359 
368 {
369  if (!Company::IsValidID(_local_company)) return nullptr;
370 
372  return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
373 }
374 
381  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
382  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WATERWAYS_TOOLBAR_CAPTION_SE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
383  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
384  EndContainer(),
386  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_CREATE_LAKE_TOOLTIP),
387  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP),
388  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
389  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
390  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_RIVER), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_RIVER, STR_WATERWAYS_TOOLBAR_CREATE_RIVER_TOOLTIP),
391  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUILD_AQUEDUCT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP),
392  EndContainer(),
393 };
394 
397  WDP_AUTO, "toolbar_water_scen", 0, 0,
401 );
402 
409 {
410  return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_scen_toolbar_desc, TRANSPORT_WATER);
411 }
412 
420 };
421 
423 public:
425  {
428  }
429 
430  void Close() override
431  {
433  this->PickerWindowBase::Close();
434  }
435 
436  void OnPaint() override
437  {
439 
440  this->DrawWidgets();
441 
443  SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
444  } else {
445  SetTileSelectSize(1, 1);
446  }
447 
448  /* strings such as 'Size' and 'Coverage Area' */
449  Rect r = this->GetWidget<NWidgetBase>(BDSW_ACCEPTANCE)->GetCurrentRect();
453  /* Resize background if the window is too small.
454  * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
455  * (This is the case, if making the window bigger moves the mouse into the window.) */
456  if (top > r.bottom) {
457  ResizeWindow(this, 0, top - r.bottom, false);
458  }
459  }
460 
461  void OnClick(Point pt, int widget, int click_count) override
462  {
463  switch (widget) {
464  case BDSW_LT_OFF:
465  case BDSW_LT_ON:
470  this->SetDirty();
471  SetViewportCatchmentStation(nullptr, true);
472  break;
473  }
474  }
475 
476  void OnRealtimeTick(uint delta_ms) override
477  {
479  }
480 };
481 
485  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
486  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_DOCK_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
487  EndContainer(),
488  NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BDSW_BACKGROUND),
489  NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BDSW_INFO), SetPadding(WidgetDimensions::unscaled.framerect), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
491  NWidget(WWT_TEXTBTN, COLOUR_GREY, BDSW_LT_OFF), SetMinimalSize(60, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
492  NWidget(WWT_TEXTBTN, COLOUR_GREY, BDSW_LT_ON), SetMinimalSize(60, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
493  EndContainer(),
495  EndContainer(),
496 };
497 
498 static WindowDesc _build_dock_station_desc(
499  WDP_AUTO, nullptr, 0, 0,
503 );
504 
505 static void ShowBuildDockStationPicker(Window *parent)
506 {
507  new BuildDocksStationWindow(&_build_dock_station_desc, parent);
508 }
509 
511 private:
512  static void UpdateDocksDirection()
513  {
514  if (_ship_depot_direction != AXIS_X) {
515  SetTileSelectSize(1, 2);
516  } else {
517  SetTileSelectSize(2, 1);
518  }
519  }
520 
521 public:
523  {
525  this->LowerWidget(_ship_depot_direction + WID_BDD_X);
526  UpdateDocksDirection();
527  }
528 
529  void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
530  {
531  switch (widget) {
532  case WID_BDD_X:
533  case WID_BDD_Y:
536  break;
537  }
538  }
539 
540  void DrawWidget(const Rect &r, int widget) const override
541  {
542  DrawPixelInfo tmp_dpi;
543 
544  switch (widget) {
545  case WID_BDD_X:
546  case WID_BDD_Y: {
547  Axis axis = widget == WID_BDD_X ? AXIS_X : AXIS_Y;
548 
549  if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.Width(), r.Height())) {
550  DrawPixelInfo *old_dpi = _cur_dpi;
551  _cur_dpi = &tmp_dpi;
552  int x = (r.Width() - ScaleSpriteTrad(96)) / 2;
553  int y = (r.Height() - ScaleSpriteTrad(64)) / 2;
554  int x1 = ScaleSpriteTrad(63);
555  int x2 = ScaleSpriteTrad(31);
556  DrawShipDepotSprite(x + (axis == AXIS_X ? x1 : x2), y + ScaleSpriteTrad(17), axis, DEPOT_PART_NORTH);
557  DrawShipDepotSprite(x + (axis == AXIS_X ? x2 : x1), y + ScaleSpriteTrad(33), axis, DEPOT_PART_SOUTH);
558  _cur_dpi = old_dpi;
559  }
560  break;
561  }
562  }
563  }
564 
565  void OnClick(Point pt, int widget, int click_count) override
566  {
567  switch (widget) {
568  case WID_BDD_X:
569  case WID_BDD_Y:
570  this->RaiseWidget(_ship_depot_direction + WID_BDD_X);
571  _ship_depot_direction = (widget == WID_BDD_X ? AXIS_X : AXIS_Y);
572  this->LowerWidget(_ship_depot_direction + WID_BDD_X);
574  UpdateDocksDirection();
575  this->SetDirty();
576  break;
577  }
578  }
579 };
580 
581 static const NWidgetPart _nested_build_docks_depot_widgets[] = {
583  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
584  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_DEPOT_BUILD_SHIP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
585  EndContainer(),
586  NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BDD_BACKGROUND),
588  NWidget(NWID_SPACER), SetFill(1, 0),
590  NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_X), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP), EndContainer(),
591  NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_Y), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP), EndContainer(),
592  EndContainer(),
593  NWidget(NWID_SPACER), SetFill(1, 0),
594  EndContainer(),
595  EndContainer(),
596 };
597 
598 static WindowDesc _build_docks_depot_desc(
599  WDP_AUTO, nullptr, 0, 0,
602  _nested_build_docks_depot_widgets, lengthof(_nested_build_docks_depot_widgets)
603 );
604 
605 
606 static void ShowBuildDocksDepotPicker(Window *parent)
607 {
608  new BuildDocksDepotWindow(&_build_docks_depot_desc, parent);
609 }
610 
611 
612 void InitializeDockGui()
613 {
614  _ship_depot_direction = AXIS_X;
615 }
WID_DT_LOCK
@ WID_DT_LOCK
Build lock button.
Definition: dock_widget.h:23
SetTileSelectSize
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
Definition: viewport.cpp:2483
PickerWindowBase::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:3563
DDSP_DEMOLISH_AREA
@ DDSP_DEMOLISH_AREA
Clear area.
Definition: viewport_type.h:108
CA_UNMODIFIED
@ CA_UNMODIFIED
Catchment for all stations with "modified catchment" disabled.
Definition: station_type.h:83
TILE_ADD
#define TILE_ADD(x, y)
Adds two tiles together.
Definition: map_func.h:244
sound_func.h
AXIS_Y
@ AXIS_Y
The y axis.
Definition: direction_type.h:127
dock_cmd.h
Rect::Height
int Height() const
Get height of Rect.
Definition: geometry_type.hpp:85
GUISettings::station_show_coverage
bool station_show_coverage
whether to highlight coverage area
Definition: settings_type.h:166
WC_BUILD_TOOLBAR
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
Definition: window_type.h:66
TileOffsByDiagDir
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
Definition: map_func.h:341
GameSettings::station
StationSettings station
settings related to station management
Definition: settings_type.h:598
WID_BDD_Y
@ WID_BDD_Y
Y-direction button.
Definition: dock_widget.h:17
water.h
GetTileMaxZ
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
Definition: tile_map.cpp:141
BuildDocksToolbarWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition: dock_gui.cpp:121
HotkeyList
List of hotkeys for a window.
Definition: hotkeys.h:40
VpSetPresizeRange
void VpSetPresizeRange(TileIndex from, TileIndex to)
Highlights all tiles between a set of two tiles.
Definition: viewport.cpp:2720
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
command_func.h
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:64
SetPadding
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1143
WDF_CONSTRUCTION
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:144
Commands
Commands
List of commands.
Definition: command_type.h:176
company_base.h
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition: window_gui.h:67
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:107
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:59
Axis
Axis
Allow incrementing of DiagDirDiff variables.
Definition: direction_type.h:125
BuildDocksToolbarWindow::OnPlaceObjectAbort
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
Definition: dock_gui.cpp:268
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
WC_SCEN_BUILD_TOOLBAR
@ WC_SCEN_BUILD_TOOLBAR
Scenario build toolbar; Window numbers:
Definition: window_type.h:73
CheckRedrawStationCoverage
void CheckRedrawStationCoverage(const Window *w)
Check whether we need to redraw the station coverage text.
Definition: station_gui.cpp:127
waypoint_cmd.h
BuildDocksStationWindow::OnRealtimeTick
void OnRealtimeTick(uint delta_ms) override
Called periodically.
Definition: dock_gui.cpp:476
WWT_IMGBTN
@ WWT_IMGBTN
(Toggle) Button with image
Definition: widget_type.h:50
WID_BDD_X
@ WID_BDD_X
X-direction button.
Definition: dock_widget.h:16
WWT_LABEL
@ WWT_LABEL
Centered label.
Definition: widget_type.h:55
WDP_ALIGN_TOOLBAR
@ WDP_ALIGN_TOOLBAR
Align toward the toolbar.
Definition: window_gui.h:92
BuildDocksDepotWindow
Definition: dock_gui.cpp:510
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
NWID_HORIZONTAL_LTR
@ NWID_HORIZONTAL_LTR
Horizontal container that doesn't change the order of the widgets for RTL languages.
Definition: widget_type.h:74
PlaceProc_DemolishArea
void PlaceProc_DemolishArea(TileIndex tile)
Start a drag for demolishing an area.
Definition: terraform_gui.cpp:150
TileIndex
The index/ID of a Tile.
Definition: tile_type.h:85
_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
IsValidDiagDirection
static bool IsValidDiagDirection(DiagDirection d)
Checks if an integer value is a valid DiagDirection.
Definition: direction_func.h:21
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:997
zoom_func.h
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:597
BuildDocksToolbarWindow::OnPlacePresize
void OnPlacePresize(Point pt, TileIndex tile_from) override
The user moves over the map when a tile highlight mode has been set when the special mouse mode has b...
Definition: dock_gui.cpp:280
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:53
dock_widget.h
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:46
ANIMCURSOR_DEMOLISH
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
Definition: sprites.h:1496
TRANSPORT_WATER
@ TRANSPORT_WATER
Transport over water.
Definition: transport_type.h:29
TileY
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Definition: map_func.h:215
WindowNumber
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:713
WC_BUILD_STATION
@ WC_BUILD_STATION
Build station; Window numbers:
Definition: window_type.h:390
ViewportPlaceMethod
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:88
DDSP_CREATE_WATER
@ DDSP_CREATE_WATER
Create a canal.
Definition: viewport_type.h:114
Window::OnHotkey
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:634
DDSP_CREATE_RIVER
@ DDSP_CREATE_RIVER
Create rivers.
Definition: viewport_type.h:115
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:975
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1111
_nested_build_docks_scen_toolbar_widgets
static const NWidgetPart _nested_build_docks_scen_toolbar_widgets[]
Nested widget parts of docks toolbar, scenario editor version.
Definition: dock_gui.cpp:379
CommandCost::Succeeded
bool Succeeded() const
Did this command succeed?
Definition: command_type.h:151
TileX
static uint TileX(TileIndex tile)
Get the X component of a tile.
Definition: map_func.h:205
DockToolbarGlobalHotkeys
static EventState DockToolbarGlobalHotkeys(int hotkey)
Handler for global hotkeys of the BuildDocksToolbarWindow.
Definition: dock_gui.cpp:307
DEPOT_PART_NORTH
@ DEPOT_PART_NORTH
Northern part of a depot.
Definition: water_map.h:69
BuildDocksDepotWindow::DrawWidget
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: dock_gui.cpp:540
gfx_func.h
WindowDesc
High level window description.
Definition: window_gui.h:102
WID_DT_BUOY
@ WID_DT_BUOY
Build buoy button.
Definition: dock_widget.h:27
BuildDocksToolbarWindow::OnPlaceMouseUp
void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
The user has dragged over the map when the tile highlight mode has been set.
Definition: dock_gui.cpp:249
window_gui.h
NC_EQUALSIZE
@ NC_EQUALSIZE
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:469
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:90
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:251
CommandCost
Common return value for all commands.
Definition: command_type.h:24
tilehighlight_func.h
ClientSettings::sound
SoundSettings sound
sound effect settings
Definition: settings_type.h:607
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1804
slope_func.h
VpStartPlaceSizing
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process)
highlighting tiles while only going over them with the mouse
Definition: viewport.cpp:2665
TileIndexDiff
int32 TileIndexDiff
An offset value between two tiles.
Definition: map_func.h:154
BuildDocksToolbarWindow
Toolbar window for constructing water infrastructure.
Definition: dock_gui.cpp:98
BuildDocksToolbarWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: dock_gui.cpp:150
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:1008
WID_DT_DEMOLISH
@ WID_DT_DEMOLISH
Demolish aka dynamite button.
Definition: dock_widget.h:24
HT_DIAGONAL
@ HT_DIAGONAL
Also allow 'diagonal rectangles'. Only usable in combination with HT_RECT or HT_POINT.
Definition: tilehighlight_type.h:28
RectPadding::Horizontal
uint Horizontal() const
Get total horizontal padding of RectPadding.
Definition: geometry_type.hpp:59
station_cmd.h
ES_NOT_HANDLED
@ ES_NOT_HANDLED
The passed event is not handled.
Definition: window_type.h:721
CommandCost::Failed
bool Failed() const
Did this command fail?
Definition: command_type.h:160
BuildDocksStationWindow::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: dock_gui.cpp:430
WATER_CLASS_CANAL
@ WATER_CLASS_CANAL
Canal.
Definition: water_map.h:49
WID_DT_STATION
@ WID_DT_STATION
Build station button.
Definition: dock_widget.h:26
VpSelectTilesWithMethod
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
Definition: viewport.cpp:3150
ScaleSpriteTrad
static int ScaleSpriteTrad(int value)
Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.
Definition: zoom_func.h:107
ShowSelectStationIfNeeded
void ShowSelectStationIfNeeded(TileArea ta, StationPickerCmdProc proc)
Show the station selection window when needed.
Definition: station_gui.cpp:2435
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:54
BuildDocksDepotWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: dock_gui.cpp:565
Window::parent
Window * parent
Parent window.
Definition: window_gui.h:266
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:46
safeguards.h
HandlePlacePushButton
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
Definition: main_gui.cpp:62
WC_BUILD_BRIDGE
@ WC_BUILD_BRIDGE
Build bridge; Window numbers:
Definition: window_type.h:382
DistanceFromEdgeDir
uint DistanceFromEdgeDir(TileIndex tile, DiagDirection dir)
Gets the distance to the edge of the map in given direction.
Definition: map.cpp:234
IsValidTile
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
Definition: tile_map.h:161
GetOtherAqueductEnd
static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to=nullptr)
Gets the other end of the aqueduct, if possible.
Definition: dock_gui.cpp:66
TileAddByDiagDir
static TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
Definition: map_func.h:382
ReverseDiagDir
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
Definition: direction_func.h:118
GetTileSlope
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
Definition: tile_map.cpp:59
INVALID_DIAGDIR
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
Definition: direction_type.h:84
BDSW_INFO
@ BDSW_INFO
'Coverage highlight' label.
Definition: dock_gui.cpp:418
sprites.h
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
BuildDocksToolbarWindow::last_clicked_widget
DockToolbarWidgets last_clicked_widget
Contains the last widget that has been clicked on this toolbar.
Definition: dock_gui.cpp:99
BDSW_ACCEPTANCE
@ BDSW_ACCEPTANCE
Acceptance info.
Definition: dock_gui.cpp:419
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:77
WATER_CLASS_RIVER
@ WATER_CLASS_RIVER
River.
Definition: water_map.h:50
tunnelbridge_cmd.h
stdafx.h
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:241
GUISettings::link_terraform_toolbar
bool link_terraform_toolbar
display terraform toolbar when displaying rail, road, water and airport toolbars
Definition: settings_type.h:119
RectPadding::Vertical
uint Vertical() const
Get total vertical padding of RectPadding.
Definition: geometry_type.hpp:65
WATER_CLASS_SEA
@ WATER_CLASS_SEA
Sea.
Definition: water_map.h:48
viewport_func.h
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:38
BuildDocksToolbarWindow::OnPlaceDrag
void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
The user is dragging over the map when the tile highlight mode has been set.
Definition: dock_gui.cpp:244
CanBuildVehicleInfrastructure
bool CanBuildVehicleInfrastructure(VehicleType type, byte subtype)
Check whether we can build infrastructure for the given vehicle type.
Definition: vehicle.cpp:1835
FillDrawPixelInfo
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
Set up a clipping area for only drawing into a certain area.
Definition: gfx.cpp:1786
WC_BUILD_DEPOT
@ WC_BUILD_DEPOT
Build depot; Window numbers:
Definition: window_type.h:410
_build_docks_scen_toolbar_desc
static WindowDesc _build_docks_scen_toolbar_desc(WDP_AUTO, "toolbar_water_scen", 0, 0, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_docks_scen_toolbar_widgets, lengthof(_nested_build_docks_scen_toolbar_widgets))
Window definition for the build docks in scenario editor window.
CA_DOCK
@ CA_DOCK
Catchment for docks with "modified catchment" enabled.
Definition: station_type.h:81
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:67
WID_DT_BUILD_AQUEDUCT
@ WID_DT_BUILD_AQUEDUCT
Build aqueduct button.
Definition: dock_widget.h:29
ConstructionSettings::max_bridge_length
uint16 max_bridge_length
maximum length of bridges
Definition: settings_type.h:345
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:55
DEPOT_PART_SOUTH
@ DEPOT_PART_SOUTH
Southern part of a depot.
Definition: water_map.h:70
SCT_ALL
@ SCT_ALL
Draw all cargoes.
Definition: station_gui.h:24
WID_DT_INVALID
@ WID_DT_INVALID
Used to initialize a variable.
Definition: dock_widget.h:31
SoundSettings::confirm
bool confirm
Play sound effect on successful constructions or other actions.
Definition: settings_type.h:216
DockToolbarWidgets
DockToolbarWidgets
Widgets of the BuildDocksToolbarWindow class.
Definition: dock_widget.h:21
vehicle_func.h
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1096
WC_SELECT_STATION
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
Definition: window_type.h:235
terraform_gui.h
ShowBuildDocksScenToolbar
Window * ShowBuildDocksScenToolbar()
Open the build water toolbar window for the scenario editor.
Definition: dock_gui.cpp:408
WIDGET_LIST_END
static const int WIDGET_LIST_END
indicate the end of widgets' list for vararg functions
Definition: widget_type.h:20
WC_SCEN_LAND_GEN
@ WC_SCEN_LAND_GEN
Landscape generation (in Scenario Editor); Window numbers:
Definition: window_type.h:442
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1229
BuildDocksToolbarWindow::OnPlaceObject
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
Definition: dock_gui.cpp:191
BuildDocksStationWindow::OnPaint
void OnPaint() override
The window must be repainted.
Definition: dock_gui.cpp:436
WidgetDimensions::fullbevel
RectPadding fullbevel
Always-scaled bevel border.
Definition: window_gui.h:46
BDSW_LT_OFF
@ BDSW_LT_OFF
'Off' button of coverage high light.
Definition: dock_gui.cpp:416
CloseWindowByClass
void CloseWindowByClass(WindowClass cls)
Close all windows of a given class.
Definition: window.cpp:1203
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1014
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
Window::SetWidgetsDisabledState
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
Definition: window.cpp:560
Window::IsWidgetLowered
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:422
_nested_build_dock_station_widgets
static const NWidgetPart _nested_build_dock_station_widgets[]
Nested widget parts of a build dock station window.
Definition: dock_gui.cpp:483
EventState
EventState
State of handling an event.
Definition: window_type.h:719
WID_DT_RIVER
@ WID_DT_RIVER
Build river button (in scenario editor).
Definition: dock_widget.h:28
HT_RECT
@ HT_RECT
rectangle (stations, depots, ...)
Definition: tilehighlight_type.h:21
VPM_X_AND_Y
@ VPM_X_AND_Y
area of land in X and Y directions
Definition: viewport_type.h:92
_nested_build_docks_toolbar_widgets
static const NWidgetPart _nested_build_docks_toolbar_widgets[]
Nested widget parts of docks toolbar, game version.
Definition: dock_gui.cpp:334
BDSW_BACKGROUND
@ BDSW_BACKGROUND
Background panel.
Definition: dock_gui.cpp:415
SND_02_CONSTRUCTION_WATER
@ SND_02_CONSTRUCTION_WATER
0 == 0x00 Construction: water infrastructure
Definition: sound_type.h:39
NWID_SPACER
@ NWID_SPACER
Invisible widget that takes some space.
Definition: widget_type.h:77
company_func.h
BuildDockStationWidgets
BuildDockStationWidgets
Widget numbers of the build-dock GUI.
Definition: dock_gui.cpp:414
PickerWindowBase
Base class for windows opened from a toolbar.
Definition: window_gui.h:874
SetViewportCatchmentStation
void SetViewportCatchmentStation(const Station *st, bool sel)
Select or deselect station for coverage area highlight.
Definition: viewport.cpp:3533
BDSW_LT_ON
@ BDSW_LT_ON
'On' button of coverage high light.
Definition: dock_gui.cpp:417
Window::top
int top
y position of top edge of the window
Definition: window_gui.h:247
AXIS_X
@ AXIS_X
The X axis.
Definition: direction_type.h:126
TILE_ADDXY
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
Definition: map_func.h:258
TileArea
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
Definition: tilearea_type.h:102
WID_DT_DEPOT
@ WID_DT_DEPOT
Build depot button.
Definition: dock_widget.h:25
CommandHelper
Definition: command_func.h:94
window_func.h
CcBuildBridge
void CcBuildBridge(Commands cmd, const CommandCost &result, TileIndex end_tile, TileIndex tile_start, TransportType transport_type, BridgeType, byte)
Callback executed after a build Bridge CMD has been called.
Definition: bridge_gui.cpp:58
SoundSettings::click_beep
bool click_beep
Beep on a random selection of buttons.
Definition: settings_type.h:217
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: stdafx.h:386
ShowTerraformToolbar
Window * ShowTerraformToolbar(Window *link)
Show the toolbar for terraforming in the game.
Definition: terraform_gui.cpp:371
SetPIP
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1191
CloseWindowById
void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
Close a window by its class and window number (if it is open).
Definition: window.cpp:1191
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1080
gui.h
GameSettings::construction
ConstructionSettings construction
construction of things in-game
Definition: settings_type.h:588
WID_DT_CANAL
@ WID_DT_CANAL
Build canal button.
Definition: dock_widget.h:22
Window
Data structure for an opened window.
Definition: window_gui.h:213
BuildDocksStationWindow
Definition: dock_gui.cpp:422
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:326
Window::RaiseWidget
void RaiseWidget(byte widget_index)
Marks a widget as raised.
Definition: window_gui.h:412
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:858
Rect::Width
int Width() const
Get width of Rect.
Definition: geometry_type.hpp:79
WidgetDimensions::scaled
static WidgetDimensions scaled
Widget dimensions scaled for current zoom level.
Definition: window_gui.h:68
VEH_SHIP
@ VEH_SHIP
Ship vehicle type.
Definition: vehicle_type.h:26
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:69
Window::LowerWidget
void LowerWidget(byte widget_index)
Marks a widget as lowered.
Definition: window_gui.h:403
BuildDocksStationWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: dock_gui.cpp:461
BuildDocksToolbarWindow::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: dock_gui.cpp:109
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
Definition: viewport.cpp:3434
HT_SPECIAL
@ HT_SPECIAL
special mode used for highlighting while dragging (and for tunnels/docks)
Definition: tilehighlight_type.h:23
station_gui.h
BuildDocksDepotWindow::UpdateWidgetSize
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
Definition: dock_gui.cpp:529
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:53
ClientSettings::gui
GUISettings gui
settings related to the GUI
Definition: settings_type.h:604
GetInclinedSlopeDirection
static DiagDirection GetInclinedSlopeDirection(Slope s)
Returns the direction of an inclined slope.
Definition: slope_func.h:239
DrawPixelInfo
Data about how and where to blit pixels.
Definition: gfx_type.h:151
GUISettings::persistent_buildingtools
bool persistent_buildingtools
keep the building tools active after usage
Definition: settings_type.h:167
StationSettings::modified_catchment
bool modified_catchment
different-size catchment areas
Definition: settings_type.h:558
ScaleGUITrad
static RectPadding ScaleGUITrad(const RectPadding &r)
Scale a RectPadding to GUI zoom level.
Definition: widget.cpp:168
Hotkey
All data for a single hotkey.
Definition: hotkeys.h:22
ShowBuildDocksToolbar
Window * ShowBuildDocksToolbar()
Open the build water toolbar window.
Definition: dock_gui.cpp:367
hotkeys.h
ResizeWindow
void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen)
Resize the window.
Definition: window.cpp:2088
water_cmd.h
WID_BDD_BACKGROUND
@ WID_BDD_BACKGROUND
Background of the window.
Definition: dock_widget.h:15
Window::Close
virtual void Close()
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:1107
WidgetDimensions::vsep_normal
int vsep_normal
Normal vertical spacing.
Definition: window_gui.h:61
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:111