2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file dock_gui.cpp GUI to create amazing water objects. */
|
2007-02-23 18:55:07 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "stdafx.h"
|
2008-01-06 18:56:43 +00:00
|
|
|
#include "terraform_gui.h"
|
2007-12-19 20:45:46 +00:00
|
|
|
#include "window_gui.h"
|
|
|
|
#include "station_gui.h"
|
2007-12-21 21:50:46 +00:00
|
|
|
#include "command_func.h"
|
2007-11-24 08:45:04 +00:00
|
|
|
#include "water.h"
|
2007-12-25 11:26:07 +00:00
|
|
|
#include "window_func.h"
|
2007-12-27 13:35:39 +00:00
|
|
|
#include "vehicle_func.h"
|
2007-12-29 09:24:26 +00:00
|
|
|
#include "sound_func.h"
|
2008-01-09 09:45:45 +00:00
|
|
|
#include "viewport_func.h"
|
|
|
|
#include "gfx_func.h"
|
2008-09-30 20:51:04 +00:00
|
|
|
#include "company_func.h"
|
2008-01-25 15:47:58 +00:00
|
|
|
#include "slope_func.h"
|
2008-05-07 13:10:15 +00:00
|
|
|
#include "tilehighlight_func.h"
|
2008-09-30 20:51:04 +00:00
|
|
|
#include "company_base.h"
|
2010-07-03 18:18:58 +00:00
|
|
|
#include "hotkeys.h"
|
2013-06-15 15:05:54 +00:00
|
|
|
#include "gui.h"
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2011-12-15 22:22:55 +00:00
|
|
|
#include "widgets/dock_widget.h"
|
|
|
|
|
2008-01-13 01:21:35 +00:00
|
|
|
#include "table/sprites.h"
|
|
|
|
#include "table/strings.h"
|
|
|
|
|
2008-05-24 11:19:30 +00:00
|
|
|
static void ShowBuildDockStationPicker(Window *parent);
|
|
|
|
static void ShowBuildDocksDepotPicker(Window *parent);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2006-03-08 06:55:33 +00:00
|
|
|
static Axis _ship_depot_direction;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2010-01-11 18:46:09 +00:00
|
|
|
void CcBuildDocks(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2010-01-11 18:46:09 +00:00
|
|
|
if (result.Failed()) return;
|
|
|
|
|
2012-12-23 21:09:09 +00:00
|
|
|
if (_settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT, tile);
|
2010-01-11 18:46:09 +00:00
|
|
|
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2010-01-11 18:46:09 +00:00
|
|
|
void CcBuildCanal(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2012-12-23 21:09:09 +00:00
|
|
|
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT, tile);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-11 19:49:44 +00:00
|
|
|
/**
|
|
|
|
* Gets the other end of the aqueduct, if possible.
|
|
|
|
* @param tile_from The begin tile for the aqueduct.
|
|
|
|
* @param [out] tile_to The tile till where to show a selection for the aqueduct.
|
|
|
|
* @return The other end of the aqueduct, or otherwise a tile in line with the aqueduct to cause the right error message.
|
|
|
|
*/
|
|
|
|
static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = NULL)
|
|
|
|
{
|
2011-11-04 11:30:37 +00:00
|
|
|
int z;
|
2011-11-04 10:31:46 +00:00
|
|
|
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from, &z));
|
2010-12-11 19:49:44 +00:00
|
|
|
|
|
|
|
/* If the direction isn't right, just return the next tile so the command
|
|
|
|
* complains about the wrong slope instead of the ends not matching up.
|
|
|
|
* Make sure the coordinate is always a valid tile within the map, so we
|
|
|
|
* don't go "off" the map. That would cause the wrong error message. */
|
|
|
|
if (!IsValidDiagDirection(dir)) return TILE_ADDXY(tile_from, TileX(tile_from) > 2 ? -1 : 1, 0);
|
|
|
|
|
|
|
|
/* Direction the aqueduct is built to. */
|
|
|
|
TileIndexDiff offset = TileOffsByDiagDir(ReverseDiagDir(dir));
|
|
|
|
/* The maximum length of the aqueduct. */
|
2011-02-04 15:37:23 +00:00
|
|
|
int max_length = min(_settings_game.construction.max_bridge_length, DistanceFromEdgeDir(tile_from, ReverseDiagDir(dir)) - 1);
|
2010-12-11 19:49:44 +00:00
|
|
|
|
|
|
|
TileIndex endtile = tile_from;
|
|
|
|
for (int length = 0; IsValidTile(endtile) && TileX(endtile) != 0 && TileY(endtile) != 0; length++) {
|
|
|
|
endtile = TILE_ADD(endtile, offset);
|
|
|
|
|
|
|
|
if (length > max_length) break;
|
|
|
|
|
2011-11-04 10:31:46 +00:00
|
|
|
if (GetTileMaxZ(endtile) > z) {
|
2010-12-11 19:49:44 +00:00
|
|
|
if (tile_to != NULL) *tile_to = endtile;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return endtile;
|
|
|
|
}
|
|
|
|
|
2013-01-08 22:46:42 +00:00
|
|
|
/** Toolbar window for constructing water infrastructure. */
|
2008-05-18 21:34:35 +00:00
|
|
|
struct BuildDocksToolbarWindow : Window {
|
2010-10-15 19:14:43 +00:00
|
|
|
DockToolbarWidgets last_clicked_widget; ///< Contains the last widget that has been clicked on this toolbar.
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
BuildDocksToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
|
2008-05-18 21:34:35 +00:00
|
|
|
{
|
2011-12-16 16:27:45 +00:00
|
|
|
this->last_clicked_widget = WID_DT_INVALID;
|
2013-05-26 19:23:42 +00:00
|
|
|
this->InitNested(window_number);
|
2010-09-28 21:58:06 +00:00
|
|
|
this->OnInvalidateData();
|
2008-05-29 15:13:28 +00:00
|
|
|
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~BuildDocksToolbarWindow()
|
|
|
|
{
|
2009-01-02 21:01:27 +00:00
|
|
|
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
|
|
|
|
2011-03-13 21:31:29 +00:00
|
|
|
/**
|
|
|
|
* Some data on this window has become invalid.
|
|
|
|
* @param data Information about the changed data.
|
|
|
|
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
|
|
|
|
*/
|
|
|
|
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
|
2010-09-28 21:58:06 +00:00
|
|
|
{
|
2011-03-13 21:31:29 +00:00
|
|
|
if (!gui_scope) return;
|
2010-09-28 21:58:06 +00:00
|
|
|
this->SetWidgetsDisabledState(!CanBuildVehicleInfrastructure(VEH_SHIP),
|
2011-12-16 16:27:45 +00:00
|
|
|
WID_DT_DEPOT,
|
|
|
|
WID_DT_STATION,
|
|
|
|
WID_DT_BUOY,
|
2010-09-28 21:58:06 +00:00
|
|
|
WIDGET_LIST_END);
|
|
|
|
}
|
|
|
|
|
2010-01-30 18:34:48 +00:00
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
2008-05-18 21:34:35 +00:00
|
|
|
{
|
2010-12-20 13:16:22 +00:00
|
|
|
switch (widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_CANAL: // Build canal button
|
|
|
|
HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT);
|
2010-12-20 13:16:22 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_LOCK: // Build lock button
|
|
|
|
HandlePlacePushButton(this, WID_DT_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL);
|
2010-12-20 13:16:22 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_DEMOLISH: // Demolish aka dynamite button
|
|
|
|
HandlePlacePushButton(this, WID_DT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
2010-12-20 13:16:22 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_DEPOT: // Build depot button
|
2010-12-20 13:17:54 +00:00
|
|
|
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
|
2011-12-16 16:27:45 +00:00
|
|
|
if (HandlePlacePushButton(this, WID_DT_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this);
|
2010-12-20 13:16:22 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_STATION: // Build station button
|
2010-12-20 13:17:54 +00:00
|
|
|
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
|
2011-12-16 16:27:45 +00:00
|
|
|
if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this);
|
2010-12-20 13:16:22 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_BUOY: // Build buoy button
|
2010-12-20 13:17:54 +00:00
|
|
|
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
|
2011-12-16 16:27:45 +00:00
|
|
|
HandlePlacePushButton(this, WID_DT_BUOY, SPR_CURSOR_BUOY, HT_RECT);
|
2010-12-20 13:16:22 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_RIVER: // Build river button (in scenario editor)
|
2010-12-20 13:17:54 +00:00
|
|
|
if (_game_mode != GM_EDITOR) return;
|
2011-12-16 16:27:45 +00:00
|
|
|
HandlePlacePushButton(this, WID_DT_RIVER, SPR_CURSOR_RIVER, HT_RECT);
|
2010-12-20 13:16:22 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
|
|
|
|
HandlePlacePushButton(this, WID_DT_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL);
|
2010-12-20 13:16:22 +00:00
|
|
|
break;
|
|
|
|
|
2011-03-20 20:51:31 +00:00
|
|
|
default: return;
|
2010-12-20 13:16:22 +00:00
|
|
|
}
|
2011-03-20 20:51:31 +00:00
|
|
|
this->last_clicked_widget = (DockToolbarWidgets)widget;
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void OnPlaceObject(Point pt, TileIndex tile)
|
|
|
|
{
|
2010-12-20 13:19:59 +00:00
|
|
|
switch (this->last_clicked_widget) {
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_CANAL: // Build canal button
|
2010-12-20 13:19:59 +00:00
|
|
|
VpStartPlaceSizing(tile, (_game_mode == GM_EDITOR) ? VPM_X_AND_Y : VPM_X_OR_Y, DDSP_CREATE_WATER);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_LOCK: // Build lock button
|
2010-12-20 13:19:59 +00:00
|
|
|
DoCommandP(tile, 0, 0, CMD_BUILD_LOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_LOCKS), CcBuildDocks);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_DEMOLISH: // Demolish aka dynamite button
|
2010-12-20 13:19:59 +00:00
|
|
|
PlaceProc_DemolishArea(tile);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_DEPOT: // Build depot button
|
2010-12-20 13:19:59 +00:00
|
|
|
DoCommandP(tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_STATION: { // Build station button
|
2010-12-20 13:19:59 +00:00
|
|
|
uint32 p2 = (uint32)INVALID_STATION << 16; // no station to join
|
|
|
|
|
|
|
|
/* tile is always the land tile, so need to evaluate _thd.pos */
|
|
|
|
CommandContainer cmdcont = { tile, _ctrl_pressed, p2, CMD_BUILD_DOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_DOCK_HERE), CcBuildDocks, "" };
|
|
|
|
|
|
|
|
/* Determine the watery part of the dock. */
|
2011-11-04 10:22:27 +00:00
|
|
|
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
|
2010-12-20 13:19:59 +00:00
|
|
|
TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile);
|
|
|
|
|
|
|
|
ShowSelectStationIfNeeded(cmdcont, TileArea(tile, tile_to));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_BUOY: // Build buoy button
|
2010-12-20 13:19:59 +00:00
|
|
|
DoCommandP(tile, 0, 0, CMD_BUILD_BUOY | CMD_MSG(STR_ERROR_CAN_T_POSITION_BUOY_HERE), CcBuildDocks);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_RIVER: // Build river button (in scenario editor)
|
2010-12-20 13:19:59 +00:00
|
|
|
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_RIVER);
|
|
|
|
break;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button
|
2010-12-20 13:19:59 +00:00
|
|
|
DoCommandP(tile, GetOtherAqueductEnd(tile), TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: NOT_REACHED();
|
|
|
|
}
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-05-18 21:34:35 +00:00
|
|
|
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
|
|
|
|
{
|
|
|
|
VpSelectTilesWithMethod(pt.x, pt.y, select_method);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2008-05-18 21:34:35 +00:00
|
|
|
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
|
|
|
|
{
|
|
|
|
if (pt.x != -1) {
|
|
|
|
switch (select_proc) {
|
2007-05-23 13:52:10 +00:00
|
|
|
case DDSP_DEMOLISH_AREA:
|
2008-05-18 21:34:35 +00:00
|
|
|
GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
|
2007-05-23 12:45:56 +00:00
|
|
|
break;
|
2007-05-23 13:52:10 +00:00
|
|
|
case DDSP_CREATE_WATER:
|
2010-04-17 23:34:00 +00:00
|
|
|
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), CcBuildCanal);
|
2008-06-25 17:30:16 +00:00
|
|
|
break;
|
|
|
|
case DDSP_CREATE_RIVER:
|
2010-04-17 23:34:00 +00:00
|
|
|
DoCommandP(end_tile, start_tile, WATER_CLASS_RIVER, CMD_BUILD_CANAL | CMD_MSG(STR_ERROR_CAN_T_PLACE_RIVERS), CcBuildCanal);
|
2007-05-23 12:45:56 +00:00
|
|
|
break;
|
2008-05-18 21:34:35 +00:00
|
|
|
|
2007-05-23 12:45:56 +00:00
|
|
|
default: break;
|
2005-10-23 13:04:44 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-05-18 21:34:35 +00:00
|
|
|
virtual void OnPlaceObjectAbort()
|
|
|
|
{
|
|
|
|
this->RaiseButtons();
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-07-21 22:25:21 +00:00
|
|
|
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
|
|
|
|
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
|
2009-02-08 16:00:57 +00:00
|
|
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
2009-07-21 22:25:21 +00:00
|
|
|
DeleteWindowByClass(WC_BUILD_BRIDGE);
|
2008-05-18 21:34:35 +00:00
|
|
|
}
|
2008-01-25 15:47:58 +00:00
|
|
|
|
2008-05-18 21:34:35 +00:00
|
|
|
virtual void OnPlacePresize(Point pt, TileIndex tile_from)
|
|
|
|
{
|
2010-12-11 19:49:44 +00:00
|
|
|
TileIndex tile_to = tile_from;
|
|
|
|
|
2011-12-16 16:27:45 +00:00
|
|
|
if (this->last_clicked_widget == WID_DT_BUILD_AQUEDUCT) {
|
2010-12-11 19:49:44 +00:00
|
|
|
GetOtherAqueductEnd(tile_from, &tile_to);
|
|
|
|
} else {
|
2011-11-04 10:22:27 +00:00
|
|
|
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from));
|
2010-12-11 19:49:44 +00:00
|
|
|
if (IsValidDiagDirection(dir)) {
|
|
|
|
/* Locks and docks always select the tile "down" the slope. */
|
|
|
|
tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir));
|
|
|
|
/* Locks also select the tile "up" the slope. */
|
2011-12-16 16:27:45 +00:00
|
|
|
if (this->last_clicked_widget == WID_DT_LOCK) tile_from = TileAddByDiagDir(tile_from, dir);
|
2010-12-11 19:49:44 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-25 15:47:58 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
VpSetPresizeRange(tile_from, tile_to);
|
|
|
|
}
|
2010-07-03 18:18:58 +00:00
|
|
|
|
2013-06-15 15:28:09 +00:00
|
|
|
static HotkeyList hotkeys;
|
2008-05-18 21:34:35 +00:00
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2013-06-15 15:31:22 +00:00
|
|
|
/**
|
|
|
|
* Handler for global hotkeys of the BuildDocksToolbarWindow.
|
|
|
|
* @param hotkey Hotkey
|
|
|
|
* @return ES_HANDLED if hotkey was accepted.
|
|
|
|
*/
|
|
|
|
static EventState DockToolbarGlobalHotkeys(int hotkey)
|
|
|
|
{
|
|
|
|
if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
|
|
|
|
Window *w = ShowBuildDocksToolbar();
|
|
|
|
if (w == NULL) return ES_NOT_HANDLED;
|
|
|
|
return w->OnHotkey(hotkey);
|
|
|
|
}
|
|
|
|
|
2010-07-03 18:18:58 +00:00
|
|
|
const uint16 _dockstoolbar_aqueduct_keys[] = {'B', '8', 0};
|
|
|
|
|
2013-06-15 15:28:09 +00:00
|
|
|
static Hotkey dockstoolbar_hotkeys[] = {
|
2013-06-15 15:27:33 +00:00
|
|
|
Hotkey('1', "canal", WID_DT_CANAL),
|
|
|
|
Hotkey('2', "lock", WID_DT_LOCK),
|
|
|
|
Hotkey('3', "demolish", WID_DT_DEMOLISH),
|
|
|
|
Hotkey('4', "depot", WID_DT_DEPOT),
|
|
|
|
Hotkey('5', "dock", WID_DT_STATION),
|
|
|
|
Hotkey('6', "buoy", WID_DT_BUOY),
|
|
|
|
Hotkey('7', "river", WID_DT_RIVER),
|
|
|
|
Hotkey(_dockstoolbar_aqueduct_keys, "aqueduct", WID_DT_BUILD_AQUEDUCT),
|
|
|
|
HOTKEY_LIST_END
|
2010-07-03 18:18:58 +00:00
|
|
|
};
|
2013-06-15 15:31:22 +00:00
|
|
|
HotkeyList BuildDocksToolbarWindow::hotkeys("dockstoolbar", dockstoolbar_hotkeys, DockToolbarGlobalHotkeys);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-03-28 12:40:57 +00:00
|
|
|
/**
|
|
|
|
* Nested widget parts of docks toolbar, game version.
|
2011-12-16 16:27:45 +00:00
|
|
|
* Position of #WID_DT_RIVER widget has changed.
|
2009-03-28 12:40:57 +00:00
|
|
|
*/
|
|
|
|
static const NWidgetPart _nested_build_docks_toolbar_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
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),
|
2009-03-28 12:40:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_HORIZONTAL_LTR),
|
2011-12-16 16:27:45 +00:00
|
|
|
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),
|
|
|
|
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),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
|
|
|
|
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),
|
|
|
|
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),
|
|
|
|
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUOY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP),
|
|
|
|
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),
|
2009-03-28 12:40:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _build_docks_toolbar_desc(
|
2013-05-26 19:25:01 +00:00
|
|
|
WDP_ALIGN_TOOLBAR, "toolbar_water", 0, 0,
|
2007-02-01 15:49:12 +00:00
|
|
|
WC_BUILD_TOOLBAR, WC_NONE,
|
2009-11-24 17:28:29 +00:00
|
|
|
WDF_CONSTRUCTION,
|
2013-06-15 15:30:44 +00:00
|
|
|
_nested_build_docks_toolbar_widgets, lengthof(_nested_build_docks_toolbar_widgets),
|
|
|
|
&BuildDocksToolbarWindow::hotkeys
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2010-07-04 09:27:15 +00:00
|
|
|
/**
|
|
|
|
* Open the build water toolbar window
|
|
|
|
*
|
|
|
|
* If the terraform toolbar is linked to the toolbar, that window is also opened.
|
|
|
|
*
|
|
|
|
* @return newly opened water toolbar, or NULL if the toolbar could not be opened.
|
|
|
|
*/
|
|
|
|
Window *ShowBuildDocksToolbar()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2010-07-04 09:27:15 +00:00
|
|
|
if (!Company::IsValidID(_local_company)) return NULL;
|
2006-10-31 21:15:56 +00:00
|
|
|
|
2008-05-04 09:39:16 +00:00
|
|
|
DeleteWindowByClass(WC_BUILD_TOOLBAR);
|
2010-07-04 09:27:15 +00:00
|
|
|
return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2009-03-28 12:40:57 +00:00
|
|
|
/**
|
|
|
|
* Nested widget parts of docks toolbar, scenario editor version.
|
2011-12-16 16:27:45 +00:00
|
|
|
* Positions of #WID_DT_DEPOT, #WID_DT_STATION, and #WID_DT_BUOY widgets have changed.
|
2009-03-28 12:40:57 +00:00
|
|
|
*/
|
|
|
|
static const NWidgetPart _nested_build_docks_scen_toolbar_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
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),
|
2009-03-28 12:40:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2011-12-16 16:27:45 +00:00
|
|
|
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),
|
|
|
|
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),
|
2009-11-24 21:13:36 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(5, 22), SetFill(1, 1), EndContainer(),
|
2011-12-16 16:27:45 +00:00
|
|
|
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_DT_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
|
|
|
|
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),
|
|
|
|
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),
|
2009-03-28 12:40:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2009-03-28 11:17:01 +00:00
|
|
|
/** Window definition for the build docks in scenario editor window. */
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _build_docks_scen_toolbar_desc(
|
2013-05-26 19:25:01 +00:00
|
|
|
WDP_AUTO, "toolbar_water_scen", 0, 0,
|
2008-06-25 17:30:16 +00:00
|
|
|
WC_SCEN_BUILD_TOOLBAR, WC_NONE,
|
2009-11-24 17:28:29 +00:00
|
|
|
WDF_CONSTRUCTION,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_build_docks_scen_toolbar_widgets, lengthof(_nested_build_docks_scen_toolbar_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
2008-06-25 17:30:16 +00:00
|
|
|
|
2010-07-04 09:27:15 +00:00
|
|
|
/**
|
|
|
|
* Open the build water toolbar window for the scenario editor.
|
|
|
|
*
|
|
|
|
* @return newly opened water toolbar, or NULL if the toolbar could not be opened.
|
|
|
|
*/
|
|
|
|
Window *ShowBuildDocksScenToolbar()
|
2008-06-25 17:30:16 +00:00
|
|
|
{
|
2010-07-04 09:27:15 +00:00
|
|
|
return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_scen_toolbar_desc, TRANSPORT_WATER);
|
2008-06-25 17:30:16 +00:00
|
|
|
}
|
|
|
|
|
2009-03-28 12:40:57 +00:00
|
|
|
/** Widget numbers of the build-dock GUI. */
|
|
|
|
enum BuildDockStationWidgets {
|
|
|
|
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.
|
|
|
|
};
|
2008-05-17 20:49:45 +00:00
|
|
|
|
2009-03-28 12:40:57 +00:00
|
|
|
struct BuildDocksStationWindow : public PickerWindowBase {
|
2008-05-17 20:49:45 +00:00
|
|
|
public:
|
2013-05-26 19:23:42 +00:00
|
|
|
BuildDocksStationWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
2008-05-17 20:49:45 +00:00
|
|
|
{
|
2013-05-26 19:23:42 +00:00
|
|
|
this->InitNested(TRANSPORT_WATER);
|
2009-01-04 11:11:11 +00:00
|
|
|
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
2008-05-17 20:49:45 +00:00
|
|
|
}
|
2006-10-03 20:16:20 +00:00
|
|
|
|
2009-01-08 16:35:45 +00:00
|
|
|
virtual ~BuildDocksStationWindow()
|
|
|
|
{
|
|
|
|
DeleteWindowById(WC_SELECT_STATION, 0);
|
|
|
|
}
|
|
|
|
|
2008-05-17 20:49:45 +00:00
|
|
|
virtual void OnPaint()
|
|
|
|
{
|
2008-05-29 15:13:28 +00:00
|
|
|
int rad = (_settings_game.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
|
2005-11-14 19:48:04 +00:00
|
|
|
|
2008-05-17 20:49:45 +00:00
|
|
|
this->DrawWidgets();
|
2005-11-13 14:54:09 +00:00
|
|
|
|
2009-01-04 11:11:11 +00:00
|
|
|
if (_settings_client.gui.station_show_coverage) {
|
2007-06-08 18:15:11 +00:00
|
|
|
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
|
|
|
} else {
|
|
|
|
SetTileSelectSize(1, 1);
|
|
|
|
}
|
2004-12-19 09:31:35 +00:00
|
|
|
|
2009-07-10 22:03:09 +00:00
|
|
|
/* strings such as 'Size' and 'Coverage Area' */
|
2009-09-19 11:31:12 +00:00
|
|
|
int top = this->GetWidget<NWidgetBase>(BDSW_LT_OFF)->pos_y + this->GetWidget<NWidgetBase>(BDSW_LT_OFF)->current_y + WD_PAR_VSEP_NORMAL;
|
|
|
|
NWidgetBase *back_nwi = this->GetWidget<NWidgetBase>(BDSW_BACKGROUND);
|
2009-07-21 10:46:32 +00:00
|
|
|
int right = back_nwi->pos_x + back_nwi->current_x;
|
|
|
|
int bottom = back_nwi->pos_y + back_nwi->current_y;
|
|
|
|
top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL;
|
|
|
|
top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL;
|
2013-06-11 18:36:26 +00:00
|
|
|
/* Resize background if the window is too small.
|
|
|
|
* Never make the window smaller to avoid oscillating if the size change affects the acceptance.
|
|
|
|
* (This is the case, if making the window bigger moves the mouse into the window.) */
|
|
|
|
if (top > bottom) {
|
2009-07-21 10:46:32 +00:00
|
|
|
ResizeWindow(this, 0, top - bottom);
|
2008-01-27 11:01:10 +00:00
|
|
|
}
|
2005-11-14 19:48:04 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2010-01-30 18:34:48 +00:00
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
2008-05-17 20:49:45 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
|
|
|
case BDSW_LT_OFF:
|
|
|
|
case BDSW_LT_ON:
|
2009-01-04 11:11:11 +00:00
|
|
|
this->RaiseWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
|
|
|
_settings_client.gui.station_show_coverage = (widget != BDSW_LT_OFF);
|
|
|
|
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
|
2012-12-23 21:09:09 +00:00
|
|
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
2008-05-17 20:49:45 +00:00
|
|
|
this->SetDirty();
|
2005-11-14 19:48:04 +00:00
|
|
|
break;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
2008-05-17 20:49:45 +00:00
|
|
|
}
|
2005-01-20 08:36:15 +00:00
|
|
|
|
2008-05-17 20:49:45 +00:00
|
|
|
virtual void OnTick()
|
|
|
|
{
|
|
|
|
CheckRedrawStationCoverage(this);
|
2004-09-10 19:02:27 +00:00
|
|
|
}
|
2008-05-17 20:49:45 +00:00
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-03-28 12:40:57 +00:00
|
|
|
/** Nested widget parts of a build dock station window. */
|
|
|
|
static const NWidgetPart _nested_build_dock_station_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_DOCK_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
2009-03-28 12:40:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, BDSW_BACKGROUND),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
2009-07-21 10:46:32 +00:00
|
|
|
NWidget(WWT_LABEL, COLOUR_DARK_GREEN, BDSW_INFO), SetMinimalSize(148, 14), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL),
|
2009-03-28 12:40:57 +00:00
|
|
|
NWidget(NWID_HORIZONTAL), SetPIP(14, 0, 14),
|
2009-11-22 18:26:01 +00:00
|
|
|
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),
|
2009-03-28 12:40:57 +00:00
|
|
|
EndContainer(),
|
2009-07-21 10:46:32 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 20), SetResize(0, 1),
|
2009-03-28 12:40:57 +00:00
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _build_dock_station_desc(
|
2013-05-26 19:25:01 +00:00
|
|
|
WDP_AUTO, NULL, 0, 0,
|
2006-11-10 19:24:14 +00:00
|
|
|
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
2009-11-24 17:28:29 +00:00
|
|
|
WDF_CONSTRUCTION,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_build_dock_station_widgets, lengthof(_nested_build_dock_station_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-05-24 11:19:30 +00:00
|
|
|
static void ShowBuildDockStationPicker(Window *parent)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2008-05-24 11:19:30 +00:00
|
|
|
new BuildDocksStationWindow(&_build_dock_station_desc, parent);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2008-05-17 20:49:45 +00:00
|
|
|
struct BuildDocksDepotWindow : public PickerWindowBase {
|
|
|
|
private:
|
|
|
|
static void UpdateDocksDirection()
|
|
|
|
{
|
|
|
|
if (_ship_depot_direction != AXIS_X) {
|
|
|
|
SetTileSelectSize(1, 2);
|
|
|
|
} else {
|
|
|
|
SetTileSelectSize(2, 1);
|
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2008-05-17 20:49:45 +00:00
|
|
|
public:
|
2013-05-26 19:23:42 +00:00
|
|
|
BuildDocksDepotWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
2008-05-17 20:49:45 +00:00
|
|
|
{
|
2013-05-26 19:23:42 +00:00
|
|
|
this->InitNested(TRANSPORT_WATER);
|
2011-12-19 20:46:17 +00:00
|
|
|
this->LowerWidget(_ship_depot_direction + WID_BDD_X);
|
2008-05-17 20:49:45 +00:00
|
|
|
UpdateDocksDirection();
|
|
|
|
}
|
2006-10-03 20:16:20 +00:00
|
|
|
|
2008-05-17 20:49:45 +00:00
|
|
|
virtual void OnPaint()
|
|
|
|
{
|
|
|
|
this->DrawWidgets();
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2011-12-19 20:46:17 +00:00
|
|
|
DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_x + 64, this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_y + 18, AXIS_X, DEPOT_PART_NORTH);
|
|
|
|
DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_x + 32, this->GetWidget<NWidgetBase>(WID_BDD_X)->pos_y + 34, AXIS_X, DEPOT_PART_SOUTH);
|
|
|
|
DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + 32, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + 18, AXIS_Y, DEPOT_PART_NORTH);
|
|
|
|
DrawShipDepotSprite(this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_x + 64, this->GetWidget<NWidgetBase>(WID_BDD_Y)->pos_y + 34, AXIS_Y, DEPOT_PART_SOUTH);
|
2008-05-17 20:49:45 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2010-01-30 18:34:48 +00:00
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
2008-05-17 20:49:45 +00:00
|
|
|
{
|
|
|
|
switch (widget) {
|
2011-12-19 20:46:17 +00:00
|
|
|
case WID_BDD_X:
|
|
|
|
case WID_BDD_Y:
|
|
|
|
this->RaiseWidget(_ship_depot_direction + WID_BDD_X);
|
|
|
|
_ship_depot_direction = (widget == WID_BDD_X ? AXIS_X : AXIS_Y);
|
|
|
|
this->LowerWidget(_ship_depot_direction + WID_BDD_X);
|
2012-12-23 21:09:09 +00:00
|
|
|
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
|
2008-05-17 20:49:45 +00:00
|
|
|
UpdateDocksDirection();
|
|
|
|
this->SetDirty();
|
|
|
|
break;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-17 20:49:45 +00:00
|
|
|
};
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-03-26 21:12:14 +00:00
|
|
|
static const NWidgetPart _nested_build_docks_depot_widgets[] = {
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
2009-11-24 18:05:55 +00:00
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_DEPOT_BUILD_SHIP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
2009-03-26 21:12:14 +00:00
|
|
|
EndContainer(),
|
2011-12-19 20:46:17 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BDD_BACKGROUND),
|
2009-03-26 21:12:14 +00:00
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
|
|
|
NWidget(NWID_HORIZONTAL_LTR),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(3, 0),
|
2011-12-19 20:46:17 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_X), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP),
|
2009-03-26 21:12:14 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(2, 0),
|
2011-12-19 20:46:17 +00:00
|
|
|
NWidget(WWT_PANEL, COLOUR_GREY, WID_BDD_Y), SetMinimalSize(98, 66), SetDataTip(0x0, STR_DEPOT_BUILD_SHIP_ORIENTATION_TOOLTIP),
|
2009-03-26 21:12:14 +00:00
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(3, 0),
|
|
|
|
EndContainer(),
|
|
|
|
NWidget(NWID_SPACER), SetMinimalSize(0, 3),
|
|
|
|
EndContainer(),
|
|
|
|
};
|
|
|
|
|
2013-05-26 19:23:42 +00:00
|
|
|
static WindowDesc _build_docks_depot_desc(
|
2013-05-26 19:25:01 +00:00
|
|
|
WDP_AUTO, NULL, 0, 0,
|
2006-11-10 19:24:14 +00:00
|
|
|
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
2009-11-24 17:28:29 +00:00
|
|
|
WDF_CONSTRUCTION,
|
2009-11-15 10:26:01 +00:00
|
|
|
_nested_build_docks_depot_widgets, lengthof(_nested_build_docks_depot_widgets)
|
2009-03-15 15:12:06 +00:00
|
|
|
);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
|
2008-05-24 11:19:30 +00:00
|
|
|
static void ShowBuildDocksDepotPicker(Window *parent)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2008-05-24 11:19:30 +00:00
|
|
|
new BuildDocksDepotWindow(&_build_docks_depot_desc, parent);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void InitializeDockGui()
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2006-03-08 06:55:33 +00:00
|
|
|
_ship_depot_direction = AXIS_X;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|