2004-08-09 17:04:08 +00:00
|
|
|
#include "stdafx.h"
|
2005-06-02 19:30:21 +00:00
|
|
|
#include "openttd.h"
|
2005-02-13 11:18:02 +00:00
|
|
|
#include "table/sprites.h"
|
2004-11-25 10:47:30 +00:00
|
|
|
#include "table/strings.h"
|
2005-07-22 07:02:20 +00:00
|
|
|
#include "functions.h"
|
2004-12-15 22:18:54 +00:00
|
|
|
#include "map.h"
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "window.h"
|
2004-12-08 15:46:13 +00:00
|
|
|
#include "station.h"
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "gui.h"
|
|
|
|
#include "viewport.h"
|
|
|
|
#include "gfx.h"
|
2004-11-05 23:12:33 +00:00
|
|
|
#include "sound.h"
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "command.h"
|
2005-07-21 22:15:02 +00:00
|
|
|
#include "variables.h"
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2005-01-22 20:23:18 +00:00
|
|
|
static void ShowBuildDockStationPicker(void);
|
|
|
|
static void ShowBuildDocksDepotPicker(void);
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
static byte _ship_depot_direction;
|
|
|
|
|
2005-06-24 12:38:35 +00:00
|
|
|
void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
if (success) {
|
2004-12-04 09:26:39 +00:00
|
|
|
SndPlayTileFx(SND_02_SPLAT, tile);
|
2004-08-09 17:04:08 +00:00
|
|
|
ResetObjectToPlace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-24 12:38:35 +00:00
|
|
|
void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2004-12-04 09:26:39 +00:00
|
|
|
if (success) SndPlayTileFx(SND_02_SPLAT, tile);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-24 12:38:35 +00:00
|
|
|
static void PlaceDocks_Dock(TileIndex tile)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_DOCK | CMD_AUTO | CMD_MSG(STR_9802_CAN_T_BUILD_DOCK_HERE));
|
|
|
|
}
|
|
|
|
|
2005-06-24 12:38:35 +00:00
|
|
|
static void PlaceDocks_Depot(TileIndex tile)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
DoCommandP(tile, _ship_depot_direction, 0, CcBuildDocks, CMD_BUILD_SHIP_DEPOT | CMD_AUTO | CMD_MSG(STR_3802_CAN_T_BUILD_SHIP_DEPOT));
|
|
|
|
}
|
|
|
|
|
2005-06-24 12:38:35 +00:00
|
|
|
static void PlaceDocks_Buoy(TileIndex tile)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_BUOY | CMD_AUTO | CMD_MSG(STR_9835_CAN_T_POSITION_BUOY_HERE));
|
|
|
|
}
|
|
|
|
|
2005-06-24 12:38:35 +00:00
|
|
|
static void PlaceDocks_DemolishArea(TileIndex tile)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
- Fix: 'L' no longer opens ingame terraform bar in scenario editor bar, but the land generator one
- Feature: [ 1095110 ] Create Lake and draggable Create Desert tools (initial implementation GoneWacko), also added sticky buttons to land generator and town generator
- CodeChange: moved around some of the draggable tools, demystifying them
- CodeChange: change CmdBuildCanal to allow for XANDY dragging not only X or Y (only scenario editor)
- CodeChange: add some more enums to sprites.
- TODO: merge most of the ingame and scenario editor land terraform code. This can only be done after OnClickButton function is changed so it also includes the backreference to the widget being clicked, postponed to after 0.4.0
2005-04-02 23:05:09 +00:00
|
|
|
VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_DemolishArea);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2005-06-24 12:38:35 +00:00
|
|
|
static void PlaceDocks_BuildCanal(TileIndex tile)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
VpStartPlaceSizing(tile, VPM_X_OR_Y);
|
|
|
|
}
|
|
|
|
|
2005-06-24 12:38:35 +00:00
|
|
|
static void PlaceDocks_BuildLock(TileIndex tile)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_LOCK | CMD_AUTO | CMD_MSG(STR_CANT_BUILD_LOCKS));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-12 17:42:04 +00:00
|
|
|
static void BuildDocksClick_Canal(Window *w)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2005-06-06 13:47:06 +00:00
|
|
|
HandlePlacePushButton(w, 3, SPR_CURSOR_CANAL, 1, PlaceDocks_BuildCanal);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2004-12-12 17:42:04 +00:00
|
|
|
static void BuildDocksClick_Lock(Window *w)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2005-06-06 13:47:06 +00:00
|
|
|
HandlePlacePushButton(w, 4, SPR_CURSOR_LOCK, 1, PlaceDocks_BuildLock);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void BuildDocksClick_Demolish(Window *w)
|
|
|
|
{
|
2004-12-22 00:18:40 +00:00
|
|
|
HandlePlacePushButton(w, 6, ANIMCURSOR_DEMOLISH, 1, PlaceDocks_DemolishArea);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2004-12-12 17:42:04 +00:00
|
|
|
static void BuildDocksClick_Depot(Window *w)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2005-06-06 13:47:06 +00:00
|
|
|
if (HandlePlacePushButton(w, 7, SPR_CURSOR_SHIP_DEPOT, 1, PlaceDocks_Depot)) ShowBuildDocksDepotPicker();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2004-12-12 17:42:04 +00:00
|
|
|
static void BuildDocksClick_Dock(Window *w)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
|
2005-06-06 13:47:06 +00:00
|
|
|
if (HandlePlacePushButton(w, 8, SPR_CURSOR_DOCK, 3, PlaceDocks_Dock)) ShowBuildDockStationPicker();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2004-12-12 17:42:04 +00:00
|
|
|
static void BuildDocksClick_Buoy(Window *w)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2005-06-06 13:47:06 +00:00
|
|
|
HandlePlacePushButton(w, 9, SPR_CURSOR_BOUY, 1, PlaceDocks_Buoy);
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2004-12-12 17:42:04 +00:00
|
|
|
static void BuildDocksClick_Landscaping(Window *w)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2004-12-12 17:42:04 +00:00
|
|
|
ShowTerraformToolbar();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
typedef void OnButtonClick(Window *w);
|
|
|
|
static OnButtonClick * const _build_docks_button_proc[] = {
|
|
|
|
BuildDocksClick_Canal,
|
|
|
|
BuildDocksClick_Lock,
|
2004-12-12 17:42:04 +00:00
|
|
|
0,
|
|
|
|
BuildDocksClick_Demolish,
|
|
|
|
BuildDocksClick_Depot,
|
|
|
|
BuildDocksClick_Dock,
|
|
|
|
BuildDocksClick_Buoy,
|
|
|
|
BuildDocksClick_Landscaping,
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
|
|
|
|
{
|
|
|
|
switch(e->event) {
|
|
|
|
case WE_PAINT:
|
|
|
|
DrawWindowWidgets(w);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WE_CLICK: {
|
2004-12-22 00:18:40 +00:00
|
|
|
if (e->click.widget - 3 >= 0 && e->click.widget != 5) _build_docks_button_proc[e->click.widget - 3](w);
|
2004-08-09 17:04:08 +00:00
|
|
|
} break;
|
2005-01-15 08:58:31 +00:00
|
|
|
|
2005-01-08 09:40:22 +00:00
|
|
|
case WE_KEYPRESS: {
|
|
|
|
switch(e->keypress.keycode) {
|
|
|
|
case '1': BuildDocksClick_Canal(w); break;
|
|
|
|
case '2': BuildDocksClick_Lock(w); break;
|
|
|
|
case '3': BuildDocksClick_Demolish(w); break;
|
|
|
|
case '4': BuildDocksClick_Depot(w); break;
|
|
|
|
case '5': BuildDocksClick_Dock(w); break;
|
|
|
|
case '6': BuildDocksClick_Buoy(w); break;
|
|
|
|
case 'l': BuildDocksClick_Landscaping(w); break;
|
2005-01-15 08:58:31 +00:00
|
|
|
default:
|
2005-01-08 09:40:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
} break;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
case WE_PLACE_OBJ:
|
|
|
|
_place_proc(e->place.tile);
|
2004-09-10 19:02:27 +00:00
|
|
|
break;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
case WE_PLACE_DRAG: {
|
|
|
|
VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, e->place.userdata);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case WE_PLACE_MOUSEUP:
|
|
|
|
if (e->click.pt.x != -1) {
|
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
- Fix: 'L' no longer opens ingame terraform bar in scenario editor bar, but the land generator one
- Feature: [ 1095110 ] Create Lake and draggable Create Desert tools (initial implementation GoneWacko), also added sticky buttons to land generator and town generator
- CodeChange: moved around some of the draggable tools, demystifying them
- CodeChange: change CmdBuildCanal to allow for XANDY dragging not only X or Y (only scenario editor)
- CodeChange: add some more enums to sprites.
- TODO: merge most of the ingame and scenario editor land terraform code. This can only be done after OnClickButton function is changed so it also includes the backreference to the widget being clicked, postponed to after 0.4.0
2005-04-02 23:05:09 +00:00
|
|
|
if ((e->place.userdata & 0xF) == VPM_X_AND_Y) { // dragged actions
|
|
|
|
GUIPlaceProcDragXY(e);
|
|
|
|
} else if(e->place.userdata == VPM_X_OR_Y)
|
2004-08-09 17:04:08 +00:00
|
|
|
DoCommandP(e->place.tile, e->place.starttile, 0, CcBuildCanal, CMD_BUILD_CANAL | CMD_AUTO | CMD_MSG(STR_CANT_BUILD_CANALS));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WE_ABORT_PLACE_OBJ:
|
2004-12-22 00:18:40 +00:00
|
|
|
UnclickWindowButtons(w);
|
2004-08-09 17:04:08 +00:00
|
|
|
SetWindowDirty(w);
|
|
|
|
|
|
|
|
w = FindWindowById(WC_BUILD_STATION, 0);
|
|
|
|
if (w != NULL) WP(w,def_d).close=true;
|
|
|
|
|
|
|
|
w = FindWindowById(WC_BUILD_DEPOT, 0);
|
|
|
|
if (w != NULL) WP(w,def_d).close=true;
|
|
|
|
break;
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
case WE_PLACE_PRESIZE: {
|
2005-06-24 12:38:35 +00:00
|
|
|
TileIndex tile_from;
|
|
|
|
TileIndex tile_to;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
tile_from = tile_to = e->place.tile;
|
2005-06-25 16:44:57 +00:00
|
|
|
switch (GetTileSlope(tile_from, NULL)) {
|
|
|
|
case 3: tile_to += TileDiffXY(-1, 0); break;
|
|
|
|
case 6: tile_to += TileDiffXY( 0, -1); break;
|
|
|
|
case 9: tile_to += TileDiffXY( 0, 1); break;
|
|
|
|
case 12: tile_to += TileDiffXY( 1, 0); break;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
VpSetPresizeRange(tile_from, tile_to);
|
|
|
|
} break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const Widget _build_docks_toolb_widgets[] = {
|
2005-01-03 19:45:18 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
|
|
|
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 145, 0, 13, STR_9801_DOCK_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
|
|
|
{ WWT_STICKYBOX, RESIZE_NONE, 7, 146, 157, 0, 13, 0x0, STR_STICKY_BUTTON},
|
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
- Fix: 'L' no longer opens ingame terraform bar in scenario editor bar, but the land generator one
- Feature: [ 1095110 ] Create Lake and draggable Create Desert tools (initial implementation GoneWacko), also added sticky buttons to land generator and town generator
- CodeChange: moved around some of the draggable tools, demystifying them
- CodeChange: change CmdBuildCanal to allow for XANDY dragging not only X or Y (only scenario editor)
- CodeChange: add some more enums to sprites.
- TODO: merge most of the ingame and scenario editor land terraform code. This can only be done after OnClickButton function is changed so it also includes the backreference to the widget being clicked, postponed to after 0.4.0
2005-04-02 23:05:09 +00:00
|
|
|
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_BUILD_CANAL, STR_BUILD_CANALS_TIP},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_BUILD_LOCK, STR_BUILD_LOCKS_TIP},
|
2005-01-03 19:45:18 +00:00
|
|
|
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 7, 44, 47, 14, 35, 0x0, STR_NULL},
|
|
|
|
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 7, 48, 69, 14, 35, 703, STR_018D_DEMOLISH_BUILDINGS_ETC},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 7, 70, 91, 14, 35, 748, STR_981E_BUILD_SHIP_DEPOT_FOR_BUILDING},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 7, 92, 113, 14, 35, 746, STR_981D_BUILD_SHIP_DOCK},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 7, 114, 135, 14, 35, 693, STR_9834_POSITION_BUOY_WHICH_CAN},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 7, 136, 157, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP},
|
2004-09-07 21:48:09 +00:00
|
|
|
{ WIDGETS_END},
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const WindowDesc _build_docks_toolbar_desc = {
|
2004-12-12 17:42:04 +00:00
|
|
|
640-158, 22, 158, 36,
|
2004-08-09 17:04:08 +00:00
|
|
|
WC_BUILD_TOOLBAR,0,
|
2004-12-22 00:18:40 +00:00
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
|
2004-08-09 17:04:08 +00:00
|
|
|
_build_docks_toolb_widgets,
|
|
|
|
BuildDocksToolbWndProc
|
|
|
|
};
|
|
|
|
|
2005-01-22 20:23:18 +00:00
|
|
|
void ShowBuildDocksToolbar(void)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2005-01-08 20:55:21 +00:00
|
|
|
if (_current_player == OWNER_SPECTATOR) return;
|
2004-08-09 17:04:08 +00:00
|
|
|
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
|
|
|
|
AllocateWindowDesc(&_build_docks_toolbar_desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void BuildDockStationWndProc(Window *w, WindowEvent *e)
|
|
|
|
{
|
2004-12-08 15:46:13 +00:00
|
|
|
int rad;
|
2004-12-19 09:31:35 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
switch(e->event) {
|
|
|
|
case WE_PAINT: {
|
|
|
|
if (WP(w,def_d).close)
|
|
|
|
return;
|
2004-12-19 09:31:35 +00:00
|
|
|
w->click_state = (1<<3) << _station_show_coverage;
|
2004-08-09 17:04:08 +00:00
|
|
|
DrawWindowWidgets(w);
|
2004-12-08 15:46:13 +00:00
|
|
|
if (_patches.modified_catchment) {
|
|
|
|
rad = CA_DOCK;
|
|
|
|
} else {
|
|
|
|
rad = 4;
|
|
|
|
}
|
2004-12-19 09:31:35 +00:00
|
|
|
|
|
|
|
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
|
|
|
else SetTileSelectBigSize(0, 0, 0, 0);
|
|
|
|
|
2004-12-21 18:30:51 +00:00
|
|
|
DrawStringCentered(74, 17, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0);
|
|
|
|
DrawStationCoverageAreaText(4, 50, (uint)-1, rad);
|
2004-08-09 17:04:08 +00:00
|
|
|
} break;
|
|
|
|
|
|
|
|
case WE_CLICK: {
|
2004-12-19 09:31:35 +00:00
|
|
|
switch(e->click.widget) {
|
|
|
|
case 3: case 4:
|
|
|
|
_station_show_coverage = e->click.widget - 3;
|
|
|
|
SndPlayFx(SND_15_BEEP);
|
|
|
|
SetWindowDirty(w);
|
|
|
|
break;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case WE_MOUSELOOP: {
|
|
|
|
if (WP(w,def_d).close) {
|
|
|
|
DeleteWindow(w);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckRedrawStationCoverage(w);
|
|
|
|
break;
|
|
|
|
}
|
2005-01-20 08:36:15 +00:00
|
|
|
|
|
|
|
case WE_DESTROY:
|
2005-01-23 15:25:17 +00:00
|
|
|
if (!WP(w,def_d).close)
|
|
|
|
ResetObjectToPlace();
|
2005-01-20 08:36:15 +00:00
|
|
|
break;
|
2004-09-10 19:02:27 +00:00
|
|
|
}
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const Widget _build_dock_station_widgets[] = {
|
2005-01-03 19:45:18 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
|
|
|
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3068_DOCK, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 74, 0x0, STR_NULL},
|
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 14, 73, 30, 40, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE},
|
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 74, 133, 30, 40, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA},
|
2004-09-07 21:48:09 +00:00
|
|
|
{ WIDGETS_END},
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const WindowDesc _build_dock_station_desc = {
|
2004-12-21 18:30:51 +00:00
|
|
|
-1, -1, 148, 75,
|
2004-08-09 17:04:08 +00:00
|
|
|
WC_BUILD_STATION,WC_BUILD_TOOLBAR,
|
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
|
|
|
|
_build_dock_station_widgets,
|
|
|
|
BuildDockStationWndProc
|
|
|
|
};
|
|
|
|
|
2005-01-22 20:23:18 +00:00
|
|
|
static void ShowBuildDockStationPicker(void)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
AllocateWindowDesc(&_build_dock_station_desc);
|
|
|
|
}
|
|
|
|
|
2005-01-22 20:23:18 +00:00
|
|
|
static void UpdateDocksDirection(void)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
if (_ship_depot_direction != 0) {
|
|
|
|
SetTileSelectSize(1, 2);
|
|
|
|
} else {
|
|
|
|
SetTileSelectSize(2, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
|
|
|
|
{
|
|
|
|
switch(e->event) {
|
|
|
|
case WE_PAINT:
|
|
|
|
w->click_state = (1<<3) << _ship_depot_direction;
|
|
|
|
DrawWindowWidgets(w);
|
|
|
|
|
|
|
|
DrawShipDepotSprite(67, 35, 0);
|
|
|
|
DrawShipDepotSprite(35, 51, 1);
|
|
|
|
DrawShipDepotSprite(135, 35, 2);
|
|
|
|
DrawShipDepotSprite(167, 51, 3);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case WE_CLICK: {
|
|
|
|
switch(e->click.widget) {
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
_ship_depot_direction = e->click.widget - 3;
|
2004-12-04 09:26:39 +00:00
|
|
|
SndPlayFx(SND_15_BEEP);
|
2004-08-09 17:04:08 +00:00
|
|
|
UpdateDocksDirection();
|
|
|
|
SetWindowDirty(w);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
|
|
|
case WE_MOUSELOOP:
|
|
|
|
if (WP(w,def_d).close)
|
|
|
|
DeleteWindow(w);
|
|
|
|
break;
|
2005-01-20 08:36:15 +00:00
|
|
|
|
|
|
|
case WE_DESTROY:
|
2005-01-23 15:25:17 +00:00
|
|
|
if (!WP(w,def_d).close)
|
|
|
|
ResetObjectToPlace();
|
2005-01-20 08:36:15 +00:00
|
|
|
break;
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static const Widget _build_docks_depot_widgets[] = {
|
2005-01-03 19:45:18 +00:00
|
|
|
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
|
|
|
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 203, 0, 13, STR_3800_SHIP_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 7, 0, 203, 14, 85, 0x0, STR_NULL},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 14, 3, 100, 17, 82, 0x0, STR_3803_SELECT_SHIP_DEPOT_ORIENTATION},
|
|
|
|
{ WWT_PANEL, RESIZE_NONE, 14, 103, 200, 17, 82, 0x0, STR_3803_SELECT_SHIP_DEPOT_ORIENTATION},
|
2004-09-07 21:48:09 +00:00
|
|
|
{ WIDGETS_END},
|
2004-08-09 17:04:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const WindowDesc _build_docks_depot_desc = {
|
|
|
|
-1, -1, 204, 86,
|
|
|
|
WC_BUILD_DEPOT,WC_BUILD_TOOLBAR,
|
|
|
|
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
|
|
|
|
_build_docks_depot_widgets,
|
|
|
|
BuildDocksDepotWndProc
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-01-22 20:23:18 +00:00
|
|
|
static void ShowBuildDocksDepotPicker(void)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
AllocateWindowDesc(&_build_docks_depot_desc);
|
|
|
|
UpdateDocksDirection();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-22 20:23:18 +00:00
|
|
|
void InitializeDockGui(void)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
|
|
|
_ship_depot_direction = 0;
|
|
|
|
}
|