# dock_gui.cpp File Reference

GUI to create amazing water objects. More...

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "tile_map.h"`
`#include "terraform_gui.h"`
`#include "window_gui.h"`
`#include "station_gui.h"`
`#include "command_func.h"`
`#include "water.h"`
`#include "window_func.h"`
`#include "vehicle_func.h"`
`#include "sound_func.h"`
`#include "viewport_func.h"`
`#include "gfx_func.h"`
`#include "company_func.h"`
`#include "slope_func.h"`
`#include "tilehighlight_func.h"`
`#include "company_base.h"`
`#include "station_type.h"`
`#include "table/sprites.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Data Structures
struct | BuildDocksToolbarWindow
struct | BuildDocksStationWindow
struct | BuildDocksDepotWindow
## Typedefs
typedef void | OnButtonClick (Window *w)
## Enumerations
enum | DockToolbarWidgets { DTW_BUTTONS_BEGIN, DTW_CANAL = DTW_BUTTONS_BEGIN, DTW_LOCK, DTW_DEMOLISH, DTW_DEPOT, DTW_STATION, DTW_BUOY, DTW_RIVER, DTW_BUILD_AQUEDUCT, DTW_END }
| Enum referring to the widgets of the build dock toolbar. More...
enum | BuildDockStationWidgets { BDSW_BACKGROUND, BDSW_LT_OFF, BDSW_LT_ON, BDSW_INFO }
| Widget numbers of the build-dock GUI. More...
enum | BuildDockDepotWidgets { BDDW_BACKGROUND, BDDW_X, BDDW_Y }
| Widgets for the build ship depot window. More...
## Functions
static void | ShowBuildDockStationPicker (Window *parent)
static void | ShowBuildDocksDepotPicker (Window *parent)
void | CcBuildDocks (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
void | CcBuildCanal (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
static void | PlaceDocks_Dock (TileIndex tile)
static void | PlaceDocks_Depot (TileIndex tile)
static void | PlaceDocks_Buoy (TileIndex tile)
static void | PlaceDocks_BuildCanal (TileIndex tile)
static void | PlaceDocks_BuildLock (TileIndex tile)
static void | PlaceDocks_BuildRiver (TileIndex tile)
static void | PlaceDocks_Aqueduct (TileIndex tile)
static void | BuildDocksClick_Canal (Window *w)
static void | BuildDocksClick_Lock (Window *w)
static void | BuildDocksClick_Demolish (Window *w)
static void | BuildDocksClick_Depot (Window *w)
static void | BuildDocksClick_Dock (Window *w)
static void | BuildDocksClick_Buoy (Window *w)
static void | BuildDocksClick_River (Window *w)
static void | BuildDocksClick_Aqueduct (Window *w)
void | ShowBuildDocksToolbar ()
void | ShowBuildDocksScenToolbar ()
void | InitializeDockGui ()
## Variables
static Axis | _ship_depot_direction
static OnButtonClick *const | _build_docks_button_proc []
static const NWidgetPart | _nested_build_docks_toolbar_widgets []
| Nested widget parts of docks toolbar, game version.
static const WindowDesc | _build_docks_toolbar_desc (WDP_ALIGN_TOOLBAR, 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_docks_toolbar_widgets, lengthof(_nested_build_docks_toolbar_widgets))
static const NWidgetPart | _nested_build_docks_scen_toolbar_widgets []
| Nested widget parts of docks toolbar, scenario editor version.
static const WindowDesc | _build_docks_scen_toolbar_desc (WDP_AUTO, 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.
static const NWidgetPart | _nested_build_dock_station_widgets []
| Nested widget parts of a build dock station window.
static const WindowDesc | _build_dock_station_desc (WDP_AUTO, 0, 0, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_build_dock_station_widgets, lengthof(_nested_build_dock_station_widgets))
static const NWidgetPart | _nested_build_docks_depot_widgets []
static const WindowDesc | _build_docks_depot_desc (WDP_AUTO, 0, 0, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, _nested_build_docks_depot_widgets, lengthof(_nested_build_docks_depot_widgets))

## Detailed Description

GUI to create amazing water objects.

Definition in file dock_gui.cpp.

## Enumeration Type Documentation

enum BuildDockDepotWidgets

Widgets for the build ship depot window.

Definition at line 425 of file dock_gui.cpp.

enum BuildDockStationWidgets

Widget numbers of the build-dock GUI.

Enumerator:

  BDSW_BACKGROUND | Background panel.
  BDSW_LT_OFF | 'Off' button of coverage high light.
  BDSW_LT_ON | 'On' button of coverage high light.
  BDSW_INFO | 'Coverage highlight' label.

Definition at line 330 of file dock_gui.cpp.

enum DockToolbarWidgets

Enum referring to the widgets of the build dock toolbar.

Enumerator:

  DTW_BUTTONS_BEGIN | Begin of clickable buttons (except seperating panel).
  DTW_CANAL | Build canal button.
  DTW_LOCK | Build lock button.
  DTW_DEMOLISH | Demolish aka dynamite button.
  DTW_DEPOT | Build depot button.
  DTW_STATION | Build station button.
  DTW_BUOY | Build buoy button.
  DTW_RIVER | Build river button (in scenario editor).
  DTW_BUILD_AQUEDUCT | Build aqueduct button.
  DTW_END | End of toolbar widgets.

Definition at line 94 of file dock_gui.cpp.

## Variable Documentation

OnButtonClick* const _build_docks_button_proc[]`[static]`

Initial value:

     {
      BuildDocksClick_Canal,
      BuildDocksClick_Lock,
      BuildDocksClick_Demolish,
      BuildDocksClick_Depot,
      BuildDocksClick_Dock,
      BuildDocksClick_Buoy,
      BuildDocksClick_River,
      BuildDocksClick_Aqueduct
    }

Definition at line 155 of file dock_gui.cpp.

const WindowDesc _build_docks_scen_toolbar_desc(WDP_AUTO, 0, 0, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_docks_scen_toolbar_widgets, lengthof(_nested_build_docks_scen_toolbar_widgets))`[static]`

Window definition for the build docks in scenario editor window.

const NWidgetPart _nested_build_dock_station_widgets[]`[static]`

Initial value:

     {
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
        NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_DOCK_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
      EndContainer(),
      NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BDSW_BACKGROUND),
        NWidget(NWID_SPACER), SetMinimalSize(0, 3),
        NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BDSW_INFO), SetMinimalSize(148, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
        NWidget(NWID_HORIZONTAL), SetPIP(14, 0, 14),
          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),
          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),
        EndContainer(),
        NWidget(NWID_SPACER), SetMinimalSize(0, 20), SetResize(0, 1),
      EndContainer(),
    }

Nested widget parts of a build dock station window.

Definition at line 396 of file dock_gui.cpp.

const NWidgetPart _nested_build_docks_depot_widgets[]`[static]`

Initial value:

     {
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
        NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_DEPOT_BUILD_SHIP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
      EndContainer(),
      NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BDDW_BACKGROUND),
        NWidget(NWID_SPACER), SetMinimalSize(0, 3),
        NWidget(NWID_HORIZONTAL_LTR),
          NWidget(NWID_SPACER), SetMinimalSize(3, 0),
          NWidget(WWT_PANEL, COLOUR_GREY, BDDW_X), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP),
          EndContainer(),
          NWidget(NWID_SPACER), SetMinimalSize(2, 0),
          NWidget(WWT_PANEL, COLOUR_GREY, BDDW_Y), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP),
          EndContainer(),
          NWidget(NWID_SPACER), SetMinimalSize(3, 0),
        EndContainer(),
        NWidget(NWID_SPACER), SetMinimalSize(0, 3),
      EndContainer(),
    }

Definition at line 476 of file dock_gui.cpp.

const NWidgetPart _nested_build_docks_scen_toolbar_widgets[]`[static]`

Initial value:

     {
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
        NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WATERWAYS_TOOLBAR_CAPTION_SE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
        NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
      EndContainer(),
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_CREATE_LAKE_TOOLTIP),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP),
        NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_RIVER), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_RIVER, STR_WATERWAYS_TOOLBAR_CREATE_RIVER_TOOLTIP),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP),
      EndContainer(),
    }

Nested widget parts of docks toolbar, scenario editor version.

Positions of DTW_DEPOT, DTW_STATION, and DTW_BUOY widgets have changed.

Definition at line 300 of file dock_gui.cpp.

const NWidgetPart _nested_build_docks_toolbar_widgets[]`[static]`

Initial value:

     {
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
        NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WATERWAYS_TOOLBAR_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
        NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
      EndContainer(),
      NWidget(NWID_HORIZONTAL_LTR),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_CANAL), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_CANAL, STR_WATERWAYS_TOOLBAR_BUILD_CANALS_TOOLTIP),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_LOCK), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUILD_LOCK, STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP),
        NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEPOT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DEPOT, STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_STATION), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DOCK, STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BOUY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP),
        NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(23, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP),
      EndContainer(),
    }

Nested widget parts of docks toolbar, game version.

Position of DTW_RIVER widget has changed.

Definition at line 263 of file dock_gui.cpp.