src/dock_gui.cpp
branchgamebalance
changeset 9895 7bd07f43b0e3
parent 6451 7baba06b4b85
child 9910 0b2aebc8283e
equal deleted inserted replaced
9894:70d78ac95d6c 9895:7bd07f43b0e3
    15 #include "gfx.h"
    15 #include "gfx.h"
    16 #include "sound.h"
    16 #include "sound.h"
    17 #include "command.h"
    17 #include "command.h"
    18 #include "variables.h"
    18 #include "variables.h"
    19 
    19 
    20 static void ShowBuildDockStationPicker(void);
    20 static void ShowBuildDockStationPicker();
    21 static void ShowBuildDocksDepotPicker(void);
    21 static void ShowBuildDocksDepotPicker();
    22 
    22 
    23 static Axis _ship_depot_direction;
    23 static Axis _ship_depot_direction;
    24 
    24 
    25 void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
    25 void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
    26 {
    26 {
   154 	case WE_PLACE_MOUSEUP:
   154 	case WE_PLACE_MOUSEUP:
   155 		if (e->we.place.pt.x != -1) {
   155 		if (e->we.place.pt.x != -1) {
   156 			if ((e->we.place.userdata & 0xF) == VPM_X_AND_Y) { // dragged actions
   156 			if ((e->we.place.userdata & 0xF) == VPM_X_AND_Y) { // dragged actions
   157 				GUIPlaceProcDragXY(e);
   157 				GUIPlaceProcDragXY(e);
   158 			} else if (e->we.place.userdata == VPM_X_OR_Y) {
   158 			} else if (e->we.place.userdata == VPM_X_OR_Y) {
   159 				DoCommandP(e->we.place.tile, e->we.place.starttile, _ctrl_pressed, CcBuildCanal, CMD_BUILD_CANAL | CMD_AUTO | CMD_MSG(STR_CANT_BUILD_CANALS));
   159 				DoCommandP(e->we.place.tile, e->we.place.starttile, 0, CcBuildCanal, CMD_BUILD_CANAL | CMD_AUTO | CMD_MSG(STR_CANT_BUILD_CANALS));
   160 			}
   160 			}
   161 		}
   161 		}
   162 		break;
   162 		break;
   163 
   163 
   164 	case WE_ABORT_PLACE_OBJ:
   164 	case WE_ABORT_PLACE_OBJ:
   214 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
   214 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
   215 	_build_docks_toolb_widgets,
   215 	_build_docks_toolb_widgets,
   216 	BuildDocksToolbWndProc
   216 	BuildDocksToolbWndProc
   217 };
   217 };
   218 
   218 
   219 void ShowBuildDocksToolbar(void)
   219 void ShowBuildDocksToolbar()
   220 {
   220 {
   221 	if (!IsValidPlayer(_current_player)) return;
   221 	if (!IsValidPlayer(_current_player)) return;
   222 
   222 
   223 	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
   223 	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
   224 	Window *w = AllocateWindowDesc(&_build_docks_toolbar_desc);
   224 	Window *w = AllocateWindowDesc(&_build_docks_toolbar_desc);
   288 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   288 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   289 	_build_dock_station_widgets,
   289 	_build_dock_station_widgets,
   290 	BuildDockStationWndProc
   290 	BuildDockStationWndProc
   291 };
   291 };
   292 
   292 
   293 static void ShowBuildDockStationPicker(void)
   293 static void ShowBuildDockStationPicker()
   294 {
   294 {
   295 	AllocateWindowDesc(&_build_dock_station_desc);
   295 	AllocateWindowDesc(&_build_dock_station_desc);
   296 }
   296 }
   297 
   297 
   298 static void UpdateDocksDirection(void)
   298 static void UpdateDocksDirection()
   299 {
   299 {
   300 	if (_ship_depot_direction != AXIS_X) {
   300 	if (_ship_depot_direction != AXIS_X) {
   301 		SetTileSelectSize(1, 2);
   301 		SetTileSelectSize(1, 2);
   302 	} else {
   302 	} else {
   303 		SetTileSelectSize(2, 1);
   303 		SetTileSelectSize(2, 1);
   358 	_build_docks_depot_widgets,
   358 	_build_docks_depot_widgets,
   359 	BuildDocksDepotWndProc
   359 	BuildDocksDepotWndProc
   360 };
   360 };
   361 
   361 
   362 
   362 
   363 static void ShowBuildDocksDepotPicker(void)
   363 static void ShowBuildDocksDepotPicker()
   364 {
   364 {
   365 	AllocateWindowDesc(&_build_docks_depot_desc);
   365 	AllocateWindowDesc(&_build_docks_depot_desc);
   366 	UpdateDocksDirection();
   366 	UpdateDocksDirection();
   367 }
   367 }
   368 
   368 
   369 
   369 
   370 void InitializeDockGui(void)
   370 void InitializeDockGui()
   371 {
   371 {
   372 	_ship_depot_direction = AXIS_X;
   372 	_ship_depot_direction = AXIS_X;
   373 }
   373 }