OpenTTD

dock_gui.cpp
Go to the documentation of this file.
1 /* $Id: dock_gui.cpp 27577 2016-05-22 10:52:02Z frosch $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
9
12 #include "stdafx.h"
13 #include "terraform_gui.h"
14 #include "window_gui.h"
15 #include "station_gui.h"
16 #include "command_func.h"
17 #include "water.h"
18 #include "window_func.h"
19 #include "vehicle_func.h"
20 #include "sound_func.h"
21 #include "viewport_func.h"
22 #include "gfx_func.h"
23 #include "company_func.h"
24 #include "slope_func.h"
25 #include "tilehighlight_func.h"
26 #include "company_base.h"
27 #include "hotkeys.h"
28 #include "gui.h"
29 #include "zoom_func.h"
30
31 #include "widgets/dock_widget.h"
32
33 #include "table/sprites.h"
34 #include "table/strings.h"
35
36 #include "safeguards.h"
37
38 static void ShowBuildDockStationPicker(Window *parent);
39 static void ShowBuildDocksDepotPicker(Window *parent);
40
41 static Axis _ship_depot_direction;
42
43 void CcBuildDocks(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
44 {
45 if (result.Failed()) return;
46
47 if (_settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT_WATER, tile);
48 if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
49 }
50
51 void CcPlaySound_SPLAT_WATER(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
52 {
53 if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT_WATER, tile);
54 }
55
56
63 static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = NULL)
64 {
65 int z;
66 DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from, &z));
67
68 /* If the direction isn't right, just return the next tile so the command
69 * complains about the wrong slope instead of the ends not matching up.
70 * Make sure the coordinate is always a valid tile within the map, so we
71 * don't go "off" the map. That would cause the wrong error message. */
72 if (!IsValidDiagDirection(dir)) return TILE_ADDXY(tile_from, TileX(tile_from) > 2 ? -1 : 1, 0);
73
74 /* Direction the aqueduct is built to. */
75 TileIndexDiff offset = TileOffsByDiagDir(ReverseDiagDir(dir));
76 /* The maximum length of the aqueduct. */
77 int max_length = min(_settings_game.construction.max_bridge_length, DistanceFromEdgeDir(tile_from, ReverseDiagDir(dir)) - 1);
78
79 TileIndex endtile = tile_from;
80 for (int length = 0; IsValidTile(endtile) && TileX(endtile) != 0 && TileY(endtile) != 0; length++) {
81 endtile = TILE_ADD(endtile, offset);
82
83 if (length > max_length) break;
84
85 if (GetTileMaxZ(endtile) > z) {
86 if (tile_to != NULL) *tile_to = endtile;
87 break;
88 }
89 }
90
91 return endtile;
92 }
93
95 struct BuildDocksToolbarWindow : Window {
96 DockToolbarWidgets last_clicked_widget;
97
98 BuildDocksToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
99 {
100 this->last_clicked_widget = WID_DT_INVALID;
101 this->InitNested(window_number);
102 this->OnInvalidateData();
103 if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
104 }
105
106 ~BuildDocksToolbarWindow()
107 {
108 if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
109 }
110
116 virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
117 {
118 if (!gui_scope) return;
119
120 bool can_build = CanBuildVehicleInfrastructure(VEH_SHIP);
121 this->SetWidgetsDisabledState(!can_build,
122 WID_DT_DEPOT,
123 WID_DT_STATION,
124 WID_DT_BUOY,
125 WIDGET_LIST_END);
126 if (!can_build) {
127 DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
128 DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
129 }
130 }
131
132 virtual void OnClick(Point pt, int widget, int click_count)
133 {
134 switch (widget) {
135 case WID_DT_CANAL: // Build canal button
136 HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT);
137 break;
138
139 case WID_DT_LOCK: // Build lock button
140 HandlePlacePushButton(this, WID_DT_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL);
141 break;
142
143 case WID_DT_DEMOLISH: // Demolish aka dynamite button
144 HandlePlacePushButton(this, WID_DT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
145 break;
146
147 case WID_DT_DEPOT: // Build depot button
148 if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
149 if (HandlePlacePushButton(this, WID_DT_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this);
150 break;
151
152 case WID_DT_STATION: // Build station button
153 if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
154 if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this);
155 break;
156
157 case WID_DT_BUOY: // Build buoy button
158 if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
159 HandlePlacePushButton(this, WID_DT_BUOY, SPR_CURSOR_BUOY, HT_RECT);
160 break;
161
162 case WID_DT_RIVER: // Build river button (in scenario editor)
163 if (_game_mode != GM_EDITOR) return;
164 HandlePlacePushButton(this, WID_DT_RIVER, SPR_CURSOR_RIVER, HT_RECT);
165 break;
166
167 case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
168 HandlePlacePushButton(this, WID_DT_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL);
169 break;
170
171 default: return;
172 }
173 this->last_clicked_widget = (DockToolbarWidgets)widget;
174 }
175
176 virtual void OnPlaceObject(Point pt, TileIndex tile)
177 {
178 switch (this->last_clicked_widget) {
179 case WID_DT_CANAL: // Build canal button
180 VpStartPlaceSizing(tile, (_game_mode == GM_EDITOR) ? VPM_X_AND_Y : VPM_X_OR_Y, DDSP_CREATE_WATER);
181 break;
182
183 case WID_DT_LOCK: // Build lock button
184 DoCommandP(tile, 0, 0, CMD_BUILD_LOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_LOCKS), CcBuildDocks);
185 break;
186
187 case WID_DT_DEMOLISH: // Demolish aka dynamite button
188 PlaceProc_DemolishArea(tile);
189 break;
190
191 case WID_DT_DEPOT: // Build depot button
192 DoCommandP(tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks);
193 break;
194
195 case WID_DT_STATION: { // Build station button
196 uint32 p2 = (uint32)INVALID_STATION << 16; // no station to join
197
198 /* tile is always the land tile, so need to evaluate _thd.pos */
199 CommandContainer cmdcont = { tile, _ctrl_pressed, p2, CMD_BUILD_DOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_DOCK_HERE), CcBuildDocks, "" };
200
201 /* Determine the watery part of the dock. */
202 DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
203 TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile);
204
205 ShowSelectStationIfNeeded(cmdcont, TileArea(tile, tile_to));
206 break;
207 }
208
209 case WID_DT_BUOY: // Build buoy button
210 DoCommandP(tile, 0, 0, CMD_BUILD_BUOY | CMD_MSG(STR_ERROR_CAN_T_POSITION_BUOY_HERE), CcBuildDocks);
211 break;
212
213 case WID_DT_RIVER: // Build river button (in scenario editor)
214 VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_RIVER);
215 break;
216
217 case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
218 DoCommandP(tile, GetOtherAqueductEnd(tile), TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge);
219 break;
220
221 default: NOT_REACHED();
222 }
223 }
224
225 virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
226 {
227 VpSelectTilesWithMethod(pt.x, pt.y, select_method);
228 }
229
230 virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
231 {
232 if (pt.x != -1) {
233 switch (select_proc) {
234 case DDSP_DEMOLISH_AREA:
235 GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
236 break;
237 case DDSP_CREATE_WATER:
238 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_SPLAT_WATER);
239 break;
240 case DDSP_CREATE_RIVER:
241 DoCommandP(end_tile, start_tile, WATER_CLASS_RIVER, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_PLACE_RIVERS), CcPlaySound_SPLAT_WATER);
242 break;
243
244 default: break;
245 }
246 }
247 }
248
249 virtual void OnPlaceObjectAbort()
250 {
251 this->RaiseButtons();
252
253 DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
254 DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
255 DeleteWindowById(WC_SELECT_STATION, 0);
256 DeleteWindowByClass(WC_BUILD_BRIDGE);
257 }
258
259 virtual void OnPlacePresize(Point pt, TileIndex tile_from)
260 {
261 TileIndex tile_to = tile_from;
262
263 if (this->last_clicked_widget == WID_DT_BUILD_AQUEDUCT) {
264 GetOtherAqueductEnd(tile_from, &tile_to);
265 } else {
266 DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from));
267 if (IsValidDiagDirection(dir)) {
268 /* Locks and docks always select the tile "down" the slope. */
269 tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir));
270 /* Locks also select the tile "up" the slope. */
271 if (this->last_clicked_widget == WID_DT_LOCK) tile_from = TileAddByDiagDir(tile_from, dir);
272 }
273 }
274
275 VpSetPresizeRange(tile_from, tile_to);
276 }
277
278 static HotkeyList hotkeys;
279 };
280
286 static EventState DockToolbarGlobalHotkeys(int hotkey)
287 {
288 if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
289 Window *w = ShowBuildDocksToolbar();
290 if (w == NULL) return ES_NOT_HANDLED;
291 return w->OnHotkey(hotkey);
292 }
293
294 const uint16 _dockstoolbar_aqueduct_keys[] = {'B', '8', 0};
295
296 static Hotkey dockstoolbar_hotkeys[] = {
297 Hotkey('1', "canal", WID_DT_CANAL),
298 Hotkey('2', "lock", WID_DT_LOCK),
299 Hotkey('3', "demolish", WID_DT_DEMOLISH),
300 Hotkey('4', "depot", WID_DT_DEPOT),
301 Hotkey('5', "dock", WID_DT_STATION),
302 Hotkey('6', "buoy", WID_DT_BUOY),
303 Hotkey('7', "river", WID_DT_RIVER),
304 Hotkey(_dockstoolbar_aqueduct_keys, "aqueduct", WID_DT_BUILD_AQUEDUCT),
305 HOTKEY_LIST_END
306 };
307 HotkeyList BuildDocksToolbarWindow::hotkeys("dockstoolbar", dockstoolbar_hotkeys, DockToolbarGlobalHotkeys);
308
313 static const NWidgetPart _nested_build_docks_toolbar_widgets[] = {
314 NWidget(NWID_HORIZONTAL),
315 NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
316 NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WATERWAYS_TOOLBAR_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
317 NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
318 EndContainer(),
319 NWidget(NWID_HORIZONTAL_LTR),
320 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),
321 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),
322 NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
323 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
324 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),
325 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),
326 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUOY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP),
327 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),
328 EndContainer(),
329 };
330
331 static WindowDesc _build_docks_toolbar_desc(
332 WDP_ALIGN_TOOLBAR, "toolbar_water", 0, 0,
333 WC_BUILD_TOOLBAR, WC_NONE,
334 WDF_CONSTRUCTION,
335 _nested_build_docks_toolbar_widgets, lengthof(_nested_build_docks_toolbar_widgets),
336 &BuildDocksToolbarWindow::hotkeys
337 );
338
346 Window *ShowBuildDocksToolbar()
347 {
348 if (!Company::IsValidID(_local_company)) return NULL;
349
350 DeleteWindowByClass(WC_BUILD_TOOLBAR);
351 return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
352 }
353
358 static const NWidgetPart _nested_build_docks_scen_toolbar_widgets[] = {
359 NWidget(NWID_HORIZONTAL),
360 NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
361 NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WATERWAYS_TOOLBAR_CAPTION_SE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
362 NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
363 EndContainer(),
364 NWidget(NWID_HORIZONTAL),
365 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),
366 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),
367 NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
368 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
369 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),
370 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),
371 EndContainer(),
372 };
373
375 static WindowDesc _build_docks_scen_toolbar_desc(
376 WDP_AUTO, "toolbar_water_scen", 0, 0,
377 WC_SCEN_BUILD_TOOLBAR, WC_NONE,
378 WDF_CONSTRUCTION,
379 _nested_build_docks_scen_toolbar_widgets, lengthof(_nested_build_docks_scen_toolbar_widgets)
380 );
381
387 Window *ShowBuildDocksScenToolbar()
388 {
389 return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_scen_toolbar_desc, TRANSPORT_WATER);
390 }
391
393 enum BuildDockStationWidgets {
394 BDSW_BACKGROUND,
395 BDSW_LT_OFF,
396 BDSW_LT_ON,
397 BDSW_INFO,
398 };
399
400 struct BuildDocksStationWindow : public PickerWindowBase {
401 public:
402 BuildDocksStationWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
403 {
404 this->InitNested(TRANSPORT_WATER);
405 this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
406 }
407
408 virtual ~BuildDocksStationWindow()
409 {
410 DeleteWindowById(WC_SELECT_STATION, 0);
411 }
412
413 virtual void OnPaint()
414 {
415 int rad = (_settings_game.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
416
417 this->DrawWidgets();
418
419 if (_settings_client.gui.station_show_coverage) {
420 SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
421 } else {
422 SetTileSelectSize(1, 1);
423 }
424
425 /* strings such as 'Size' and 'Coverage Area' */
426 int top = this->GetWidget<NWidgetBase>(BDSW_LT_OFF)->pos_y + this->GetWidget<NWidgetBase>(BDSW_LT_OFF)->current_y + WD_PAR_VSEP_NORMAL;
427 NWidgetBase *back_nwi = this->GetWidget<NWidgetBase>(BDSW_BACKGROUND);
428 int right = back_nwi->pos_x + back_nwi->current_x;
429 int bottom = back_nwi->pos_y + back_nwi->current_y;
430 top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL;
431 top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL;
432 /* Resize background if the window is too small.
433 * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
434 * (This is the case, if making the window bigger moves the mouse into the window.) */
435 if (top > bottom) {
436 ResizeWindow(this, 0, top - bottom, false);
437 }
438 }
439
440 virtual void OnClick(Point pt, int widget, int click_count)
441 {
442 switch (widget) {
443 case BDSW_LT_OFF:
444 case BDSW_LT_ON:
445 this->RaiseWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
446 _settings_client.gui.station_show_coverage = (widget != BDSW_LT_OFF);
447 this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
448 if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
449 this->SetDirty();
450 break;
451 }
452 }
453
454 virtual void OnTick()
455 {
456 CheckRedrawStationCoverage(this);
457 }
458 };
459
461 static const NWidgetPart _nested_build_dock_station_widgets[] = {
462 NWidget(NWID_HORIZONTAL),
463 NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
464 NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_DOCK_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
465 EndContainer(),
466 NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BDSW_BACKGROUND),
467 NWidget(NWID_SPACER), SetMinimalSize(0, 3),
468 NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BDSW_INFO), SetMinimalSize(148, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
469 NWidget(NWID_HORIZONTAL), SetPIP(14, 0, 14),
470 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),
471 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),
472 EndContainer(),
473 NWidget(NWID_SPACER), SetMinimalSize(0, 20), SetResize(0, 1),
474 EndContainer(),
475 };
476
477 static WindowDesc _build_dock_station_desc(
478 WDP_AUTO, NULL, 0, 0,
479 WC_BUILD_STATION, WC_BUILD_TOOLBAR,
480 WDF_CONSTRUCTION,
481 _nested_build_dock_station_widgets, lengthof(_nested_build_dock_station_widgets)
482 );
483
484 static void ShowBuildDockStationPicker(Window *parent)
485 {
486 new BuildDocksStationWindow(&_build_dock_station_desc, parent);
487 }
488
489 struct BuildDocksDepotWindow : public PickerWindowBase {
490 private:
491 static void UpdateDocksDirection()
492 {
493 if (_ship_depot_direction != AXIS_X) {
494 SetTileSelectSize(1, 2);
495 } else {
496 SetTileSelectSize(2, 1);
497 }
498 }
499
500 public:
501 BuildDocksDepotWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
502 {
503 this->InitNested(TRANSPORT_WATER);
504 this->LowerWidget(_ship_depot_direction + WID_BDD_X);
505 UpdateDocksDirection();
506 }
507
508 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
509 {
510 switch (widget) {
511 case WID_BDD_X:
512 case WID_BDD_Y:
513 size->width = ScaleGUITrad(96) + 2;
514 size->height = ScaleGUITrad(64) + 2;
515 break;
516 }
517 }
518
519 virtual void OnPaint()
520 {
521 this->DrawWidgets();
522
523 int x1 = ScaleGUITrad(63) + 1;
524 int x2 = ScaleGUITrad(31) + 1;
525 int y1 = ScaleGUITrad(17) + 1;
526 int y2 = ScaleGUITrad(33) + 1;
527
528 DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_x + x1, this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_y + y1, AXIS_X, DEPOT_PART_NORTH);
529 DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_x + x2, this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_y + y2, AXIS_X, DEPOT_PART_SOUTH);
530 DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + x2, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + y1, AXIS_Y, DEPOT_PART_NORTH);
531 DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + x1, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + y2, AXIS_Y, DEPOT_PART_SOUTH);
532 }
533
534 virtual void OnClick(Point pt, int widget, int click_count)
535 {
536 switch (widget) {
537 case WID_BDD_X:
538 case WID_BDD_Y:
539 this->RaiseWidget(_ship_depot_direction + WID_BDD_X);
540 _ship_depot_direction = (widget == WID_BDD_X ? AXIS_X : AXIS_Y);
541 this->LowerWidget(_ship_depot_direction + WID_BDD_X);
542 if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
543 UpdateDocksDirection();
544 this->SetDirty();
545 break;
546 }
547 }
548 };
549
550 static const NWidgetPart _nested_build_docks_depot_widgets[] = {
551 NWidget(NWID_HORIZONTAL),
552 NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
553 NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_DEPOT_BUILD_SHIP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
554 EndContainer(),
555 NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BDD_BACKGROUND),
556 NWidget(NWID_SPACER), SetMinimalSize(0, 3),
557 NWidget(NWID_HORIZONTAL_LTR),
558 NWidget(NWID_SPACER), SetMinimalSize(3, 0),
559 NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_X), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP),
560 EndContainer(),
561 NWidget(NWID_SPACER), SetMinimalSize(2, 0),
562 NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_Y), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP),
563 EndContainer(),
564 NWidget(NWID_SPACER), SetMinimalSize(3, 0),
565 EndContainer(),
566 NWidget(NWID_SPACER), SetMinimalSize(0, 3),
567 EndContainer(),
568 };
569
570 static WindowDesc _build_docks_depot_desc(
571 WDP_AUTO, NULL, 0, 0,
572 WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
573 WDF_CONSTRUCTION,
574 _nested_build_docks_depot_widgets, lengthof(_nested_build_docks_depot_widgets)
575 );
576
577
578 static void ShowBuildDocksDepotPicker(Window *parent)
579 {
580 new BuildDocksDepotWindow(&_build_docks_depot_desc, parent);
581 }
582
583
584 void InitializeDockGui()
585 {
586 _ship_depot_direction = AXIS_X;
587 }
EventState
EventState
State of handling an event.
Definition: window_type.h:701
ViewportDragDropSelectionProcess
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you&#39;ve selected it...
Definition: viewport_type.h:97
SCT_ALL
Draw all cargoes.
Definition: station_gui.h:24
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:77
BuildDocksToolbarWindow::OnPlaceObjectAbort
virtual void OnPlaceObjectAbort()
The user cancelled a tile highlight mode that has been set.
Definition: dock_gui.cpp:249
company_base.h
Definition of stuff that is very close to a company, like the company struct itself.
WC_SELECT_STATION
Select station (when joining stations); Window numbers:
Definition: window_type.h:237
GUISettings::link_terraform_toolbar
bool link_terraform_toolbar
display terraform toolbar when displaying rail, road, water and airport toolbars
Definition: settings_type.h:87
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:317
Window::OnHotkey
virtual EventState OnHotkey(int hotkey)
A hotkey has been pressed.
Definition: window.cpp:590
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:930
WID_DT_RIVER
Build river button (in scenario editor).
Definition: dock_widget.h:30
CheckRedrawStationCoverage
void CheckRedrawStationCoverage(const Window *w)
Check whether we need to redraw the station coverage text.
Definition: station_gui.cpp:88
CMD_BUILD_DOCK
build a dock
Definition: command_type.h:208
BuildDocksDepotWindow::UpdateWidgetSize
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
Definition: dock_gui.cpp:508
Window::parent
Window * parent
Parent window.
Definition: window_gui.h:332
BuildDocksStationWindow::OnPaint
virtual void OnPaint()
The window must be repainted.
Definition: dock_gui.cpp:413
Hotkey
All data for a single hotkey.
Definition: hotkeys.h:24
WindowDesc
High level window description.
Definition: window_gui.h:168
ANIMCURSOR_DEMOLISH
static const CursorID ANIMCURSOR_DEMOLISH
704 - 707 - demolish dynamite
Definition: sprites.h:1467
WC_SCEN_LAND_GEN
Landscape generation (in Scenario Editor); Window numbers:
Definition: window_type.h:444
INVALID_DIAGDIR
Flag for an invalid DiagDirection.
Definition: direction_type.h:87
TileIndexDiff
int32 TileIndexDiff
An offset value between to tiles.
Definition: map_func.h:156
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:604
GUISettings::station_show_coverage
bool station_show_coverage
whether to highlight coverage area
Definition: settings_type.h:133
WC_SCEN_BUILD_TOOLBAR
Scenario build toolbar; Window numbers:
Definition: window_type.h:75
hotkeys.h
Hotkey related functions.
WID_DT_DEPOT
Build depot button.
Definition: dock_widget.h:27
WWT_LABEL
Centered label.
Definition: widget_type.h:57
BDSW_INFO
&#39;Coverage highlight&#39; label.
Definition: dock_gui.cpp:397
ShowSelectStationIfNeeded
void ShowSelectStationIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the station selection window when needed.
Definition: station_gui.cpp:2408
station_gui.h
Contains enums and function declarations connected with stations GUI.
ShowTerraformToolbar
Window * ShowTerraformToolbar(Window *link)
Show the toolbar for terraforming in the game.
Definition: terraform_gui.cpp:358
WID_DT_STATION
Build station button.
Definition: dock_widget.h:28
BuildDocksToolbarWindow::OnPlaceMouseUp
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
The user has dragged over the map when the tile highlight mode has been set.
Definition: dock_gui.cpp:230
WD_PAR_VSEP_NORMAL
Normal amount of vertical space between two paragraphs of text.
Definition: window_gui.h:139
NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:75
ES_NOT_HANDLED
The passed event is not handled.
Definition: window_type.h:703
SetTileSelectSize
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
Definition: viewport.cpp:2295
Window::SetWidgetsDisabledState
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
Definition: window.cpp:516
WID_BDD_BACKGROUND
Background of the window.
Definition: dock_widget.h:17
ScaleGUITrad
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
Definition: zoom_func.h:82
TRANSPORT_WATER
Transport over water.
Definition: transport_type.h:31
BuildDocksStationWindow::OnClick
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Definition: dock_gui.cpp:440
BuildDocksToolbarWindow::last_clicked_widget
DockToolbarWidgets last_clicked_widget
Contains the last widget that has been clicked on this toolbar.
Definition: dock_gui.cpp:96
vehicle_func.h
Functions related to vehicles.
TileX
static uint TileX(TileIndex tile)
Get the X component of a tile.
Definition: map_func.h:207
WATER_CLASS_RIVER
River.
Definition: water_map.h:52
WID_BDD_Y
Y-direction button.
Definition: dock_widget.h:19
ShowBuildDocksToolbar
Window * ShowBuildDocksToolbar()
Open the build water toolbar window.
Definition: dock_gui.cpp:346
TileAddByDiagDir
static TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
Definition: map_func.h:372
Window::top
int top
y position of top edge of the window
Definition: window_gui.h:313
WID_BDD_X
X-direction button.
Definition: dock_widget.h:18
WC_BUILD_DEPOT
Build depot; Window numbers:
Definition: window_type.h:412
BuildDocksDepotWindow::OnPaint
virtual void OnPaint()
The window must be repainted.
Definition: dock_gui.cpp:519
WATER_CLASS_SEA
Sea.
Definition: water_map.h:50
WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:69
BuildDocksStationWindow::OnTick
virtual void OnTick()
Called once per (game) tick.
Definition: dock_gui.cpp:454
VpSetPresizeRange
void VpSetPresizeRange(TileIndex from, TileIndex to)
Highlights all tiles between a set of two tiles.
Definition: viewport.cpp:2514
DockToolbarGlobalHotkeys
static EventState DockToolbarGlobalHotkeys(int hotkey)
Handler for global hotkeys of the BuildDocksToolbarWindow.
Definition: dock_gui.cpp:286
CanBuildVehicleInfrastructure
bool CanBuildVehicleInfrastructure(VehicleType type)
Check whether we can build infrastructure for the given vehicle type.
Definition: vehicle.cpp:1743
GUISettings::persistent_buildingtools
bool persistent_buildingtools
keep the building tools active after usage
Definition: settings_type.h:134
CommandCost
Common return value for all commands.
Definition: command_type.h:25
WID_DT_BUOY
Build buoy button.
Definition: dock_widget.h:29
SND_02_SPLAT_WATER
Water construction.
Definition: sound_type.h:41
Window::RaiseWidget
void RaiseWidget(byte widget_index)
Marks a widget as raised.
Definition: window_gui.h:478
_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:461
GameSettings::station
StationSettings station
settings related to station management
Definition: settings_type.h:555
window_gui.h
Functions, definitions and such used only by the GUI.
_local_company
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:46
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:910
viewport_func.h
Functions related to (drawing on) viewports.
Window
Data structure for an opened window.
Definition: window_gui.h:271
DDSP_DEMOLISH_AREA
Clear area.
Definition: viewport_type.h:98
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:36
GetTileSlope
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
Definition: tile_map.cpp:115
IsValidTile
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
Definition: tile_map.h:154
Window::InitNested
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
Definition: window.cpp:1833
DockToolbarWidgets
DockToolbarWidgets
Widgets of the BuildDocksToolbarWindow class.
Definition: dock_widget.h:23
TileOffsByDiagDir
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
Definition: map_func.h:343
TileArea
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
Definition: tilearea_type.h:96
NWID_SPACER
Invisible widget that takes some space.
Definition: widget_type.h:79
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:56
AXIS_Y
The y axis.
Definition: direction_type.h:129
NWidgetBase::pos_y
uint pos_y
Vertical position of top-left corner of the widget in the window.
Definition: widget_type.h:178
WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:210
ClientSettings::sound
SoundSettings sound
sound effect settings
Definition: settings_type.h:564
GetOtherAqueductEnd
static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to=NULL)
Gets the other end of the aqueduct, if possible.
Definition: dock_gui.cpp:63
NWidgetBase::current_y
uint current_y
Current vertical size (after resizing).
Definition: widget_type.h:175
ViewportPlaceMethod
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
Definition: viewport_type.h:78
ReverseDiagDir
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
Definition: direction_func.h:120
Window::RaiseButtons
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Definition: window.cpp:553
CommandContainer
Structure for buffering the build command when selecting a station to join.
Definition: command_type.h:472
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1014
gfx_func.h
Functions related to the gfx engine.
slope_func.h
Functions related to slopes.
VPM_X_OR_Y
drag in X or Y direction
Definition: viewport_type.h:79
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:76
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:947
CommandCost::Succeeded
bool Succeeded() const
Did this command succeed?
Definition: command_type.h:152
stdafx.h
Definition of base types and functions in a cross-platform compatible way.
BuildDocksToolbarWindow::OnInvalidateData
virtual void OnInvalidateData(int data=0, bool gui_scope=true)
Some data on this window has become invalid.
Definition: dock_gui.cpp:116
TILE_ADDXY
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
Definition: map_func.h:260
BDSW_BACKGROUND
Background panel.
Definition: dock_gui.cpp:394
safeguards.h
A number of safeguards to prevent using unsafe methods.
HotkeyList
List of hotkeys for a window.
Definition: hotkeys.h:42
HT_RECT
rectangle (stations, depots, ...)
Definition: tilehighlight_type.h:23
WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:50
IsValidDiagDirection
static bool IsValidDiagDirection(DiagDirection d)
Checks if an integer value is a valid DiagDirection.
Definition: direction_func.h:23
Window::LowerWidget
void LowerWidget(byte widget_index)
Marks a widget as lowered.
Definition: window_gui.h:469
terraform_gui.h
GUI stuff related to terraforming.
ConstructionSettings::max_bridge_length
uint16 max_bridge_length
maximum length of bridges
Definition: settings_type.h:303
BuildDocksToolbarWindow::OnPlacePresize
virtual void OnPlacePresize(Point pt, TileIndex tile_from)
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:259
_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.
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new &#39;real&#39; widget.
Definition: widget_type.h:1114
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:126
WC_BUILD_STATION
Build station; Window numbers:
Definition: window_type.h:392
DDSP_CREATE_RIVER
Create rivers.
Definition: viewport_type.h:105
DoCommandP
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
Definition: command.cpp:527
DiagDirection
DiagDirection
Enumeration for diagonal directions.
Definition: direction_type.h:80
VpStartPlaceSizing
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process)
highlighting tiles while only going over them with the mouse
Definition: viewport.cpp:2471
CA_UNMODIFIED
Catchment for all stations with "modified catchment" disabled.
Definition: station_type.h:87
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: depend.cpp:42
WC_BUILD_BRIDGE
Build bridge; Window numbers:
Definition: window_type.h:384
PlaceProc_DemolishArea
void PlaceProc_DemolishArea(TileIndex tile)
Start a drag for demolishing an area.
Definition: terraform_gui.cpp:147
DDSP_CREATE_WATER
Create a canal.
Definition: viewport_type.h:104
min
static T min(const T a, const T b)
Returns the minimum of two values.
Definition: math_func.hpp:42
NWidgetBase::pos_x
uint pos_x
Horizontal position of top-left corner of the widget in the window.
Definition: widget_type.h:177
BuildDocksDepotWindow
Definition: dock_gui.cpp:489
DistanceFromEdgeDir
uint DistanceFromEdgeDir(TileIndex tile, DiagDirection dir)
Gets the distance to the edge of the map in given direction.
Definition: map.cpp:236
HT_DIAGONAL
Also allow &#39;diagonal rectangles&#39;. Only usable in combination with HT_RECT or HT_POINT.
Definition: tilehighlight_type.h:30
GetInclinedSlopeDirection
static DiagDirection GetInclinedSlopeDirection(Slope s)
Returns the direction of an inclined slope.
Definition: slope_func.h:241
sound_func.h
Functions related to sound.
BuildDocksToolbarWindow
Toolbar window for constructing water infrastructure.
Definition: dock_gui.cpp:95
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:108
DeleteWindowByClass
void DeleteWindowByClass(WindowClass cls)
Delete all windows of a given class.
Definition: window.cpp:1150
CommandCost::Failed
bool Failed() const
Did this command fail?
Definition: command_type.h:161
VpSelectTilesWithMethod
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
Definition: viewport.cpp:2940
dock_widget.h
Types related to the dock widgets.
WIDGET_LIST_END
static const int WIDGET_LIST_END
indicate the end of widgets&#39; list for vararg functions
Definition: widget_type.h:22
VEH_SHIP
Ship vehicle type.
Definition: vehicle_type.h:26
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:959
WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
Definition: window_type.h:68
AXIS_X
The X axis.
Definition: direction_type.h:128
WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:40
DeleteWindowById
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
Definition: window.cpp:1137
DEPOT_PART_NORTH
Northern part of a depot.
Definition: water_map.h:60
CA_DOCK
Catchment for docks with "modified catchment" enabled.
Definition: station_type.h:85
company_func.h
Functions related to companies.
WID_DT_DEMOLISH
Demolish aka dynamite button.
Definition: dock_widget.h:26
WID_DT_BUILD_AQUEDUCT
Build aqueduct button.
Definition: dock_widget.h:31
WID_DT_LOCK
Build lock button.
Definition: dock_widget.h:25
VPM_X_AND_Y
area of land in X and Y directions
Definition: viewport_type.h:82
CcBuildBridge
void CcBuildBridge(const CommandCost &result, TileIndex end_tile, uint32 p1, uint32 p2)
Callback executed after a build Bridge CMD has been called.
Definition: bridge_gui.cpp:61
ClientSettings::gui
GUISettings gui
settings related to the GUI
Definition: settings_type.h:561
WDP_ALIGN_TOOLBAR
Align toward the toolbar.
Definition: window_gui.h:158
WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:61
WATER_CLASS_CANAL
Canal.
Definition: water_map.h:51
GetTileMaxZ
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
Definition: tile_map.cpp:215
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
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:103
StationSettings::modified_catchment
bool modified_catchment
different-size catchment areas
Definition: settings_type.h:516
WID_DT_CANAL
Build canal button.
Definition: dock_widget.h:24
_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:313
TileY
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Definition: map_func.h:217
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL).
Definition: widget_type.h:999
WID_DT_INVALID
Used to initialize a variable.
Definition: dock_widget.h:33
zoom_func.h
Functions related to zooming.
DEPOT_PART_SOUTH
Southern part of a depot.
Definition: water_map.h:61
NWidgetBase::current_x
uint current_x
Current horizontal size (after resizing).
Definition: widget_type.h:174
CMD_BUILD_CANAL
build a canal
Definition: command_type.h:276
SoundSettings::confirm
bool confirm
Play sound effect on succesful constructions or other actions.
Definition: settings_type.h:177
BuildDocksToolbarWindow::OnClick
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Definition: dock_gui.cpp:132
command_func.h
Functions related to commands.
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:28
CMD_BUILD_BUOY
build a buoy
Definition: command_type.h:211
Pool::PoolItem<&_company_pool >::IsValidID
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-NULL) Titem.
Definition: pool_type.hpp:235
HT_SPECIAL
special mode used for highlighting while dragging (and for tunnels/docks)
Definition: tilehighlight_type.h:25
BuildDocksToolbarWindow::OnPlaceDrag
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
The user is dragging over the map when the tile highlight mode has been set.
Definition: dock_gui.cpp:225
BuildDocksStationWindow
Definition: dock_gui.cpp:400
CMD_BUILD_BRIDGE
build a bridge
Definition: command_type.h:183
GameSettings::construction
ConstructionSettings construction
construction of things in-game
Definition: settings_type.h:545
_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:358
WD_FRAMERECT_RIGHT
Offset at right to draw the frame rectangular area.
Definition: window_gui.h:63
WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:66
BuildDocksDepotWindow::OnClick
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Definition: dock_gui.cpp:534
BuildDocksToolbarWindow::OnPlaceObject
virtual void OnPlaceObject(Point pt, TileIndex tile)
The user clicked some place on the map when a tile highlight mode has been set.
Definition: dock_gui.cpp:176
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:983
CMD_MSG
#define CMD_MSG(x)
Used to combine a StringID with the command.
Definition: command_type.h:366
WindowNumber
int32 WindowNumber
Number to differentiate different windows of the same class.
Definition: window_type.h:695
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows)...
Definition: viewport.cpp:3211
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:307
tilehighlight_func.h
Functions related to tile highlights.
window_func.h
Window functions not directly related to making/drawing windows.
CMD_BUILD_SHIP_DEPOT
build a ship depot
Definition: command_type.h:210
WDP_AUTO
Find a place automatically.
Definition: window_gui.h:156
water.h
Functions related to water (management)
WWT_IMGBTN
(Toggle) Button with image
Definition: widget_type.h:52
TILE_ADD
#define TILE_ADD(x, y)
Adds to tiles together.
Definition: map_func.h:246
gui.h
GUI functions that shouldn&#39;t be here.
ShowBuildDocksScenToolbar
Window * ShowBuildDocksScenToolbar()
Open the build water toolbar window for the scenario editor.
Definition: dock_gui.cpp:387
ResizeWindow
void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen)
Resize the window.
Definition: window.cpp:2116
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:34
SoundSettings::click_beep
bool click_beep
Beep on a random selection of buttons.
Definition: settings_type.h:178
WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
Definition: window_gui.h:62
sprites.h
This file contains all sprite-related enums and defines.
Axis
Axis
Allow incrementing of DiagDirDiff variables.
Definition: direction_type.h:127
NWID_HORIZONTAL_LTR
Horizontal container that doesn&#39;t change the order of the widgets for RTL languages.
Definition: widget_type.h:76
SetPIP
static NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
Widget part function for setting a pre/inter/post spaces.
Definition: widget_type.h:1076
BDSW_LT_OFF
&#39;Off&#39; button of coverage high light.
Definition: dock_gui.cpp:395
PickerWindowBase
Base class for windows opened from a toolbar.
Definition: window_gui.h:836
CMD_BUILD_LOCK
build a lock
Definition: command_type.h:298
BuildDockStationWidgets
BuildDockStationWidgets
Widget numbers of the build-dock GUI.
Definition: dock_gui.cpp:393
WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:55
BDSW_LT_ON
&#39;On&#39; button of coverage high light.
Definition: dock_gui.cpp:396