OpenTTD Source  12.0-beta2
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 
29 #include "widgets/dock_widget.h"
30 
31 #include "table/sprites.h"
32 #include "table/strings.h"
33 
34 #include "safeguards.h"
35 
36 static void ShowBuildDockStationPicker(Window *parent);
37 static void ShowBuildDocksDepotPicker(Window *parent);
38 
39 static Axis _ship_depot_direction;
40 
41 void CcBuildDocks(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
42 {
43  if (result.Failed()) return;
44 
45  if (_settings_client.sound.confirm) SndPlayTileFx(SND_02_CONSTRUCTION_WATER, tile);
47 }
48 
49 void CcPlaySound_CONSTRUCTION_WATER(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
50 {
51  if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_CONSTRUCTION_WATER, tile);
52 }
53 
54 
61 static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = nullptr)
62 {
63  int z;
65 
66  /* If the direction isn't right, just return the next tile so the command
67  * complains about the wrong slope instead of the ends not matching up.
68  * Make sure the coordinate is always a valid tile within the map, so we
69  * don't go "off" the map. That would cause the wrong error message. */
70  if (!IsValidDiagDirection(dir)) return TILE_ADDXY(tile_from, TileX(tile_from) > 2 ? -1 : 1, 0);
71 
72  /* Direction the aqueduct is built to. */
74  /* The maximum length of the aqueduct. */
75  int max_length = std::min<int>(_settings_game.construction.max_bridge_length, DistanceFromEdgeDir(tile_from, ReverseDiagDir(dir)) - 1);
76 
77  TileIndex endtile = tile_from;
78  for (int length = 0; IsValidTile(endtile) && TileX(endtile) != 0 && TileY(endtile) != 0; length++) {
79  endtile = TILE_ADD(endtile, offset);
80 
81  if (length > max_length) break;
82 
83  if (GetTileMaxZ(endtile) > z) {
84  if (tile_to != nullptr) *tile_to = endtile;
85  break;
86  }
87  }
88 
89  return endtile;
90 }
91 
95 
97  {
98  this->last_clicked_widget = WID_DT_INVALID;
99  this->InitNested(window_number);
100  this->OnInvalidateData();
102  }
103 
104  void Close() override
105  {
106  if (_game_mode == GM_NORMAL && this->IsWidgetLowered(WID_DT_STATION)) SetViewportCatchmentStation(nullptr, true);
108  this->Window::Close();
109  }
110 
116  void OnInvalidateData(int data = 0, bool gui_scope = true) override
117  {
118  if (!gui_scope) return;
119 
120  bool can_build = CanBuildVehicleInfrastructure(VEH_SHIP);
121  this->SetWidgetsDisabledState(!can_build,
122  WID_DT_DEPOT,
124  WID_DT_BUOY,
126  if (!can_build) {
129  }
130 
131  if (_game_mode != GM_EDITOR) {
132  if (!can_build) {
133  /* Show in the tooltip why this button is disabled. */
134  this->GetWidget<NWidgetCore>(WID_DT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
135  this->GetWidget<NWidgetCore>(WID_DT_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
136  this->GetWidget<NWidgetCore>(WID_DT_BUOY)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE);
137  } else {
138  this->GetWidget<NWidgetCore>(WID_DT_DEPOT)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP);
139  this->GetWidget<NWidgetCore>(WID_DT_STATION)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP);
140  this->GetWidget<NWidgetCore>(WID_DT_BUOY)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP);
141  }
142  }
143  }
144 
145  void OnClick(Point pt, int widget, int click_count) override
146  {
147  switch (widget) {
148  case WID_DT_CANAL: // Build canal button
149  HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT);
150  break;
151 
152  case WID_DT_LOCK: // Build lock button
153  HandlePlacePushButton(this, WID_DT_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL);
154  break;
155 
156  case WID_DT_DEMOLISH: // Demolish aka dynamite button
158  break;
159 
160  case WID_DT_DEPOT: // Build depot button
161  if (HandlePlacePushButton(this, WID_DT_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this);
162  break;
163 
164  case WID_DT_STATION: // Build station button
165  if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this);
166  break;
167 
168  case WID_DT_BUOY: // Build buoy button
169  HandlePlacePushButton(this, WID_DT_BUOY, SPR_CURSOR_BUOY, HT_RECT);
170  break;
171 
172  case WID_DT_RIVER: // Build river button (in scenario editor)
173  if (_game_mode != GM_EDITOR) return;
174  HandlePlacePushButton(this, WID_DT_RIVER, SPR_CURSOR_RIVER, HT_RECT | HT_DIAGONAL);
175  break;
176 
177  case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
178  HandlePlacePushButton(this, WID_DT_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL);
179  break;
180 
181  default: return;
182  }
183  this->last_clicked_widget = (DockToolbarWidgets)widget;
184  }
185 
186  void OnPlaceObject(Point pt, TileIndex tile) override
187  {
188  switch (this->last_clicked_widget) {
189  case WID_DT_CANAL: // Build canal button
190  VpStartPlaceSizing(tile, (_game_mode == GM_EDITOR) ? VPM_X_AND_Y : VPM_X_OR_Y, DDSP_CREATE_WATER);
191  break;
192 
193  case WID_DT_LOCK: // Build lock button
194  DoCommandP(tile, 0, 0, CMD_BUILD_LOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_LOCKS), CcBuildDocks);
195  break;
196 
197  case WID_DT_DEMOLISH: // Demolish aka dynamite button
199  break;
200 
201  case WID_DT_DEPOT: // Build depot button
202  DoCommandP(tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks);
203  break;
204 
205  case WID_DT_STATION: { // Build station button
206  uint32 p2 = (uint32)INVALID_STATION << 16; // no station to join
207 
208  /* tile is always the land tile, so need to evaluate _thd.pos */
209  CommandContainer cmdcont = { tile, _ctrl_pressed, p2, CMD_BUILD_DOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_DOCK_HERE), CcBuildDocks, "" };
210 
211  /* Determine the watery part of the dock. */
213  TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile);
214 
215  ShowSelectStationIfNeeded(cmdcont, TileArea(tile, tile_to));
216  break;
217  }
218 
219  case WID_DT_BUOY: // Build buoy button
220  DoCommandP(tile, 0, 0, CMD_BUILD_BUOY | CMD_MSG(STR_ERROR_CAN_T_POSITION_BUOY_HERE), CcBuildDocks);
221  break;
222 
223  case WID_DT_RIVER: // Build river button (in scenario editor)
225  break;
226 
227  case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
228  DoCommandP(tile, GetOtherAqueductEnd(tile), TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge);
229  break;
230 
231  default: NOT_REACHED();
232  }
233  }
234 
235  void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override
236  {
237  VpSelectTilesWithMethod(pt.x, pt.y, select_method);
238  }
239 
240  void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override
241  {
242  if (pt.x != -1) {
243  switch (select_proc) {
244  case DDSP_DEMOLISH_AREA:
245  GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
246  break;
247  case DDSP_CREATE_WATER:
248  DoCommandP(end_tile, start_tile, (_game_mode == GM_EDITOR && _ctrl_pressed) ? WATER_CLASS_SEA : WATER_CLASS_CANAL, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_BUILD_CANALS), CcPlaySound_CONSTRUCTION_WATER);
249  break;
250  case DDSP_CREATE_RIVER:
251  DoCommandP(end_tile, start_tile, WATER_CLASS_RIVER | (_ctrl_pressed ? 1 << 2 : 0), CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_PLACE_RIVERS), CcPlaySound_CONSTRUCTION_WATER);
252  break;
253 
254  default: break;
255  }
256  }
257  }
258 
259  void OnPlaceObjectAbort() override
260  {
261  if (_game_mode != GM_EDITOR && this->IsWidgetLowered(WID_DT_STATION)) SetViewportCatchmentStation(nullptr, true);
262 
263  this->RaiseButtons();
264 
269  }
270 
271  void OnPlacePresize(Point pt, TileIndex tile_from) override
272  {
273  TileIndex tile_to = tile_from;
274 
275  if (this->last_clicked_widget == WID_DT_BUILD_AQUEDUCT) {
276  GetOtherAqueductEnd(tile_from, &tile_to);
277  } else {
279  if (IsValidDiagDirection(dir)) {
280  /* Locks and docks always select the tile "down" the slope. */
281  tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir));
282  /* Locks also select the tile "up" the slope. */
283  if (this->last_clicked_widget == WID_DT_LOCK) tile_from = TileAddByDiagDir(tile_from, dir);
284  }
285  }
286 
287  VpSetPresizeRange(tile_from, tile_to);
288  }
289 
290  static HotkeyList hotkeys;
291 };
292 
299 {
300  if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
302  if (w == nullptr) return ES_NOT_HANDLED;
303  return w->OnHotkey(hotkey);
304 }
305 
306 const uint16 _dockstoolbar_aqueduct_keys[] = {'B', '8', 0};
307 
308 static Hotkey dockstoolbar_hotkeys[] = {
309  Hotkey('1', "canal", WID_DT_CANAL),
310  Hotkey('2', "lock", WID_DT_LOCK),
311  Hotkey('3', "demolish", WID_DT_DEMOLISH),
312  Hotkey('4', "depot", WID_DT_DEPOT),
313  Hotkey('5', "dock", WID_DT_STATION),
314  Hotkey('6', "buoy", WID_DT_BUOY),
315  Hotkey('7', "river", WID_DT_RIVER),
316  Hotkey(_dockstoolbar_aqueduct_keys, "aqueduct", WID_DT_BUILD_AQUEDUCT),
317  HOTKEY_LIST_END
318 };
319 HotkeyList BuildDocksToolbarWindow::hotkeys("dockstoolbar", dockstoolbar_hotkeys, DockToolbarGlobalHotkeys);
320 
327  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
328  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WATERWAYS_TOOLBAR_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
329  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
330  EndContainer(),
332  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),
333  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),
334  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
335  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
336  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),
337  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),
338  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUOY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP),
339  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),
340  EndContainer(),
341 };
342 
343 static WindowDesc _build_docks_toolbar_desc(
344  WDP_ALIGN_TOOLBAR, "toolbar_water", 0, 0,
348  &BuildDocksToolbarWindow::hotkeys
349 );
350 
359 {
360  if (!Company::IsValidID(_local_company)) return nullptr;
361 
363  return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
364 }
365 
372  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
373  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WATERWAYS_TOOLBAR_CAPTION_SE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
374  NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
375  EndContainer(),
377  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),
378  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),
379  NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
380  NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
381  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),
382  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),
383  EndContainer(),
384 };
385 
388  WDP_AUTO, "toolbar_water_scen", 0, 0,
392 );
393 
400 {
401  return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_scen_toolbar_desc, TRANSPORT_WATER);
402 }
403 
410 };
411 
413 public:
415  {
418  }
419 
420  void Close() override
421  {
423  this->PickerWindowBase::Close();
424  }
425 
426  void OnPaint() override
427  {
429 
430  this->DrawWidgets();
431 
433  SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
434  } else {
435  SetTileSelectSize(1, 1);
436  }
437 
438  /* strings such as 'Size' and 'Coverage Area' */
439  int top = this->GetWidget<NWidgetBase>(BDSW_LT_OFF)->pos_y + this->GetWidget<NWidgetBase>(BDSW_LT_OFF)->current_y + WD_PAR_VSEP_NORMAL;
440  NWidgetBase *back_nwi = this->GetWidget<NWidgetBase>(BDSW_BACKGROUND);
441  int right = back_nwi->pos_x + back_nwi->current_x;
442  int bottom = back_nwi->pos_y + back_nwi->current_y;
445  /* Resize background if the window is too small.
446  * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
447  * (This is the case, if making the window bigger moves the mouse into the window.) */
448  if (top > bottom) {
449  ResizeWindow(this, 0, top - bottom, false);
450  }
451  }
452 
453  void OnClick(Point pt, int widget, int click_count) override
454  {
455  switch (widget) {
456  case BDSW_LT_OFF:
457  case BDSW_LT_ON:
462  this->SetDirty();
463  SetViewportCatchmentStation(nullptr, true);
464  break;
465  }
466  }
467 
468  void OnRealtimeTick(uint delta_ms) override
469  {
471  }
472 };
473 
477  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
478  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_DOCK_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
479  EndContainer(),
480  NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BDSW_BACKGROUND),
482  NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BDSW_INFO), SetMinimalSize(148, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
483  NWidget(NWID_HORIZONTAL), SetPIP(14, 0, 14),
484  NWidget(WWT_TEXTBTN, COLOUR_GREY, BDSW_LT_OFF), SetMinimalSize(40, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
485  NWidget(WWT_TEXTBTN, COLOUR_GREY, BDSW_LT_ON), SetMinimalSize(40, 12), SetFill(1, 0), SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
486  EndContainer(),
488  EndContainer(),
489 };
490 
491 static WindowDesc _build_dock_station_desc(
492  WDP_AUTO, nullptr, 0, 0,
496 );
497 
498 static void ShowBuildDockStationPicker(Window *parent)
499 {
500  new BuildDocksStationWindow(&_build_dock_station_desc, parent);
501 }
502 
504 private:
505  static void UpdateDocksDirection()
506  {
507  if (_ship_depot_direction != AXIS_X) {
508  SetTileSelectSize(1, 2);
509  } else {
510  SetTileSelectSize(2, 1);
511  }
512  }
513 
514 public:
516  {
518  this->LowerWidget(_ship_depot_direction + WID_BDD_X);
519  UpdateDocksDirection();
520  }
521 
522  void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
523  {
524  switch (widget) {
525  case WID_BDD_X:
526  case WID_BDD_Y:
527  size->width = ScaleGUITrad(96) + 2;
528  size->height = ScaleGUITrad(64) + 2;
529  break;
530  }
531  }
532 
533  void OnPaint() override
534  {
535  this->DrawWidgets();
536 
537  int x1 = ScaleGUITrad(63) + 1;
538  int x2 = ScaleGUITrad(31) + 1;
539  int y1 = ScaleGUITrad(17) + 1;
540  int y2 = ScaleGUITrad(33) + 1;
541 
542  DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_x + x1, this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_y + y1, AXIS_X, DEPOT_PART_NORTH);
543  DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_x + x2, this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_y + y2, AXIS_X, DEPOT_PART_SOUTH);
544  DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + x2, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + y1, AXIS_Y, DEPOT_PART_NORTH);
545  DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + x1, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + y2, AXIS_Y, DEPOT_PART_SOUTH);
546  }
547 
548  void OnClick(Point pt, int widget, int click_count) override
549  {
550  switch (widget) {
551  case WID_BDD_X:
552  case WID_BDD_Y:
553  this->RaiseWidget(_ship_depot_direction + WID_BDD_X);
554  _ship_depot_direction = (widget == WID_BDD_X ? AXIS_X : AXIS_Y);
555  this->LowerWidget(_ship_depot_direction + WID_BDD_X);
557  UpdateDocksDirection();
558  this->SetDirty();
559  break;
560  }
561  }
562 };
563 
564 static const NWidgetPart _nested_build_docks_depot_widgets[] = {
566  NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
567  NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_DEPOT_BUILD_SHIP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
568  EndContainer(),
569  NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BDD_BACKGROUND),
573  NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_X), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP),
574  EndContainer(),
576  NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_Y), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP),
577  EndContainer(),
579  EndContainer(),
581  EndContainer(),
582 };
583 
584 static WindowDesc _build_docks_depot_desc(
585  WDP_AUTO, nullptr, 0, 0,
588  _nested_build_docks_depot_widgets, lengthof(_nested_build_docks_depot_widgets)
589 );
590 
591 
592 static void ShowBuildDocksDepotPicker(Window *parent)
593 {
594  new BuildDocksDepotWindow(&_build_docks_depot_desc, parent);
595 }
596 
597 
598 void InitializeDockGui()
599 {
600  _ship_depot_direction = AXIS_X;
601 }
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:2472
PickerWindowBase::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: window.cpp:3512
DDSP_DEMOLISH_AREA
@ DDSP_DEMOLISH_AREA
Clear area.
Definition: viewport_type.h:116
CA_UNMODIFIED
@ CA_UNMODIFIED
Catchment for all stations with "modified catchment" disabled.
Definition: station_type.h:82
CMD_MSG
#define CMD_MSG(x)
Used to combine a StringID with the command.
Definition: command_type.h:372
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:83
TILE_ADD
#define TILE_ADD(x, y)
Adds to tiles together.
Definition: map_func.h:244
sound_func.h
GUISettings::station_show_coverage
bool station_show_coverage
whether to highlight coverage area
Definition: settings_type.h:161
WC_BUILD_TOOLBAR
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
Definition: window_type.h:65
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:587
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:116
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:2709
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
WDF_CONSTRUCTION
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:210
company_base.h
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:115
BuildDocksToolbarWindow::OnPlaceObjectAbort
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
Definition: dock_gui.cpp:259
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:72
CheckRedrawStationCoverage
void CheckRedrawStationCoverage(const Window *w)
Check whether we need to redraw the station coverage text.
Definition: station_gui.cpp:126
BuildDocksStationWindow::OnRealtimeTick
void OnRealtimeTick(uint delta_ms) override
Called periodically.
Definition: dock_gui.cpp:468
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:158
BuildDocksDepotWindow
Definition: dock_gui.cpp:503
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:146
BuildDocksDepotWindow::OnPaint
void OnPaint() override
The window must be repainted.
Definition: dock_gui.cpp:533
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:35
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:993
zoom_func.h
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:584
CMD_BUILD_BRIDGE
@ CMD_BUILD_BRIDGE
build a bridge
Definition: command_type.h:181
CommandContainer
Structure for buffering the build command when selecting a station to join.
Definition: command_type.h:479
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:271
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:52
dock_widget.h
ANIMCURSOR_DEMOLISH
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
Definition: sprites.h:1498
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:711
WC_BUILD_STATION
@ WC_BUILD_STATION
Build station; Window numbers:
Definition: window_type.h:389
WATER_CLASS_RIVER
@ WATER_CLASS_RIVER
River.
Definition: water_map.h:50
ViewportPlaceMethod
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:96
DDSP_CREATE_WATER
@ DDSP_CREATE_WATER
Create a canal.
Definition: viewport_type.h:122
Window::OnHotkey
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:621
DDSP_CREATE_RIVER
@ DDSP_CREATE_RIVER
Create rivers.
Definition: viewport_type.h:123
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:971
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1107
_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:370
CMD_BUILD_SHIP_DEPOT
@ CMD_BUILD_SHIP_DEPOT
build a ship depot
Definition: command_type.h:209
CommandCost::Succeeded
bool Succeeded() const
Did this command succeed?
Definition: command_type.h:150
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:298
DEPOT_PART_NORTH
@ DEPOT_PART_NORTH
Northern part of a depot.
Definition: water_map.h:58
CcBuildBridge
void CcBuildBridge(const CommandCost &result, TileIndex end_tile, uint32 p1, uint32 p2, uint32 cmd)
Callback executed after a build Bridge CMD has been called.
Definition: bridge_gui.cpp:61
CMD_BUILD_DOCK
@ CMD_BUILD_DOCK
build a dock
Definition: command_type.h:207
gfx_func.h
WindowDesc
High level window description.
Definition: window_gui.h:168
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:240
window_gui.h
AXIS_Y
@ AXIS_Y
The y axis.
Definition: direction_type.h:125
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:156
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:317
CommandCost
Common return value for all commands.
Definition: command_type.h:23
tilehighlight_func.h
ClientSettings::sound
SoundSettings sound
sound effect settings
Definition: settings_type.h:596
DoCommandP
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
Definition: command.cpp:541
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1789
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:2654
TileIndexDiff
int32 TileIndexDiff
An offset value between to tiles.
Definition: map_func.h:154
BuildDocksToolbarWindow
Toolbar window for constructing water infrastructure.
Definition: dock_gui.cpp:93
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:145
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:993
WD_FRAMERECT_LEFT
@ WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
Definition: window_gui.h:62
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
WD_PAR_VSEP_NORMAL
@ WD_PAR_VSEP_NORMAL
Normal amount of vertical space between two paragraphs of text.
Definition: window_gui.h:139
WD_FRAMERECT_RIGHT
@ WD_FRAMERECT_RIGHT
Offset at right to draw the frame rectangular area.
Definition: window_gui.h:63
ES_NOT_HANDLED
@ ES_NOT_HANDLED
The passed event is not handled.
Definition: window_type.h:719
CommandCost::Failed
bool Failed() const
Did this command fail?
Definition: command_type.h:159
BuildDocksStationWindow::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: dock_gui.cpp:420
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:126
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:3139
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:53
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:548
Window::parent
Window * parent
Parent window.
Definition: window_gui.h:332
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:46
CMD_BUILD_CANAL
@ CMD_BUILD_CANAL
build a canal
Definition: command_type.h:278
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:61
WC_BUILD_BRIDGE
@ WC_BUILD_BRIDGE
Build bridge; Window numbers:
Definition: window_type.h:381
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:61
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:409
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:94
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:77
WATER_CLASS_CANAL
@ WATER_CLASS_CANAL
Canal.
Definition: water_map.h:49
stdafx.h
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:307
GUISettings::link_terraform_toolbar
bool link_terraform_toolbar
display terraform toolbar when displaying rail, road, water and airport toolbars
Definition: settings_type.h:115
viewport_func.h
NWidgetBase::current_y
uint current_y
Current vertical size (after resizing).
Definition: widget_type.h:187
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:37
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:235
CanBuildVehicleInfrastructure
bool CanBuildVehicleInfrastructure(VehicleType type, byte subtype)
Check whether we can build infrastructure for the given vehicle type.
Definition: vehicle.cpp:1821
ShowSelectStationIfNeeded
void ShowSelectStationIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the station selection window when needed.
Definition: station_gui.cpp:2464
WC_BUILD_DEPOT
@ WC_BUILD_DEPOT
Build depot; Window numbers:
Definition: window_type.h:409
_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:80
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:336
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:54
DEPOT_PART_SOUTH
@ DEPOT_PART_SOUTH
Southern part of a depot.
Definition: water_map.h:59
SCT_ALL
@ SCT_ALL
Draw all cargoes.
Definition: station_gui.h:22
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:208
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:1092
WC_SELECT_STATION
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
Definition: window_type.h:234
terraform_gui.h
ShowBuildDocksScenToolbar
Window * ShowBuildDocksScenToolbar()
Open the build water toolbar window for the scenario editor.
Definition: dock_gui.cpp:399
NWidgetBase::pos_x
int pos_x
Horizontal position of top-left corner of the widget in the window.
Definition: widget_type.h:189
WIDGET_LIST_END
static const int WIDGET_LIST_END
indicate the end of widgets' list for vararg functions
Definition: widget_type.h:20
CMD_BUILD_LOCK
@ CMD_BUILD_LOCK
build a lock
Definition: command_type.h:303
WC_SCEN_LAND_GEN
@ WC_SCEN_LAND_GEN
Landscape generation (in Scenario Editor); Window numbers:
Definition: window_type.h:441
ScaleGUITrad
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
Definition: zoom_func.h:76
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1207
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:186
BuildDocksStationWindow::OnPaint
void OnPaint() override
The window must be repainted.
Definition: dock_gui.cpp:426
BDSW_LT_OFF
@ BDSW_LT_OFF
'Off' button of coverage high light.
Definition: dock_gui.cpp:407
CloseWindowByClass
void CloseWindowByClass(WindowClass cls)
Close all windows of a given class.
Definition: window.cpp:1188
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1010
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
TRANSPORT_WATER
@ TRANSPORT_WATER
Transport over water.
Definition: transport_type.h:29
Window::SetWidgetsDisabledState
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
Definition: window.cpp:547
Window::IsWidgetLowered
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
Definition: window_gui.h:487
_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:475
EventState
EventState
State of handling an event.
Definition: window_type.h:717
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:100
_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:325
BDSW_BACKGROUND
@ BDSW_BACKGROUND
Background panel.
Definition: dock_gui.cpp:406
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:405
PickerWindowBase
Base class for windows opened from a toolbar.
Definition: window_gui.h:917
SetViewportCatchmentStation
void SetViewportCatchmentStation(const Station *st, bool sel)
Select or deselect station for coverage area highlight.
Definition: viewport.cpp:3524
BDSW_LT_ON
@ BDSW_LT_ON
'On' button of coverage high light.
Definition: dock_gui.cpp:408
Window::top
int top
y position of top edge of the window
Definition: window_gui.h:313
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
window_func.h
SoundSettings::click_beep
bool click_beep
Beep on a random selection of buttons.
Definition: settings_type.h:209
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: stdafx.h:378
ShowTerraformToolbar
Window * ShowTerraformToolbar(Window *link)
Show the toolbar for terraforming in the game.
Definition: terraform_gui.cpp:357
SetPIP
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1169
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:1176
NWidgetBase::pos_y
int pos_y
Vertical position of top-left corner of the widget in the window.
Definition: widget_type.h:190
Axis
Axis
Allow incrementing of DiagDirDiff variables.
Definition: direction_type.h:123
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1076
gui.h
GameSettings::construction
ConstructionSettings construction
construction of things in-game
Definition: settings_type.h:577
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:279
BuildDocksStationWindow
Definition: dock_gui.cpp:412
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:477
WATER_CLASS_SEA
@ WATER_CLASS_SEA
Sea.
Definition: water_map.h:48
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:636
VEH_SHIP
@ VEH_SHIP
Ship vehicle type.
Definition: vehicle_type.h:26
Window::LowerWidget
void LowerWidget(byte widget_index)
Marks a widget as lowered.
Definition: window_gui.h:468
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:453
VPM_X_OR_Y
@ VPM_X_OR_Y
drag in X or Y direction
Definition: viewport_type.h:97
NWidgetBase::current_x
uint current_x
Current horizontal size (after resizing).
Definition: widget_type.h:186
BuildDocksToolbarWindow::Close
void Close() override
Hide the window and all its child windows, and mark them for a later deletion.
Definition: dock_gui.cpp:104
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
Definition: viewport.cpp:3423
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:522
CMD_BUILD_BUOY
@ CMD_BUILD_BUOY
build a buoy
Definition: command_type.h:210
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:593
GetInclinedSlopeDirection
static DiagDirection GetInclinedSlopeDirection(Slope s)
Returns the direction of an inclined slope.
Definition: slope_func.h:239
GUISettings::persistent_buildingtools
bool persistent_buildingtools
keep the building tools active after usage
Definition: settings_type.h:162
StationSettings::modified_catchment
bool modified_catchment
different-size catchment areas
Definition: settings_type.h:547
Hotkey
All data for a single hotkey.
Definition: hotkeys.h:22
ShowBuildDocksToolbar
Window * ShowBuildDocksToolbar()
Open the build water toolbar window.
Definition: dock_gui.cpp:358
hotkeys.h
ResizeWindow
void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen)
Resize the window.
Definition: window.cpp:2069
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:1092
AXIS_X
@ AXIS_X
The X axis.
Definition: direction_type.h:124
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:107