src/dock_gui.cpp
changeset 10686 8e02259158f3
parent 10671 dec6e7c78066
child 10703 2c998f3776d1
equal deleted inserted replaced
10685:955ddec7961e 10686:8e02259158f3
    23 #include "tilehighlight_func.h"
    23 #include "tilehighlight_func.h"
    24 
    24 
    25 #include "table/sprites.h"
    25 #include "table/sprites.h"
    26 #include "table/strings.h"
    26 #include "table/strings.h"
    27 
    27 
    28 static void ShowBuildDockStationPicker();
    28 static void ShowBuildDockStationPicker(Window *parent);
    29 static void ShowBuildDocksDepotPicker();
    29 static void ShowBuildDocksDepotPicker(Window *parent);
    30 
    30 
    31 static Axis _ship_depot_direction;
    31 static Axis _ship_depot_direction;
    32 
    32 
    33 void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
    33 void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
    34 {
    34 {
   103 }
   103 }
   104 
   104 
   105 static void BuildDocksClick_Depot(Window *w)
   105 static void BuildDocksClick_Depot(Window *w)
   106 {
   106 {
   107 	if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
   107 	if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
   108 	if (HandlePlacePushButton(w, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, VHM_RECT, PlaceDocks_Depot)) ShowBuildDocksDepotPicker();
   108 	if (HandlePlacePushButton(w, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, VHM_RECT, PlaceDocks_Depot)) ShowBuildDocksDepotPicker(w);
   109 }
   109 }
   110 
   110 
   111 static void BuildDocksClick_Dock(Window *w)
   111 static void BuildDocksClick_Dock(Window *w)
   112 {
   112 {
   113 	if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
   113 	if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
   114 	if (HandlePlacePushButton(w, DTW_STATION, SPR_CURSOR_DOCK, VHM_SPECIAL, PlaceDocks_Dock)) ShowBuildDockStationPicker();
   114 	if (HandlePlacePushButton(w, DTW_STATION, SPR_CURSOR_DOCK, VHM_SPECIAL, PlaceDocks_Dock)) ShowBuildDockStationPicker(w);
   115 }
   115 }
   116 
   116 
   117 static void BuildDocksClick_Buoy(Window *w)
   117 static void BuildDocksClick_Buoy(Window *w)
   118 {
   118 {
   119 	if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
   119 	if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
   253 		BDSW_LT_ON,
   253 		BDSW_LT_ON,
   254 		BDSW_INFO,
   254 		BDSW_INFO,
   255 	};
   255 	};
   256 
   256 
   257 public:
   257 public:
   258 	BuildDocksStationWindow(const WindowDesc *desc) : PickerWindowBase(desc)
   258 	BuildDocksStationWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
   259 	{
   259 	{
   260 		this->LowerWidget(_station_show_coverage + BDSW_LT_OFF);
   260 		this->LowerWidget(_station_show_coverage + BDSW_LT_OFF);
   261 		this->FindWindowPlacementAndResize(desc);
   261 		this->FindWindowPlacementAndResize(desc);
   262 	}
   262 	}
   263 
   263 
   317 	WC_BUILD_STATION, WC_BUILD_TOOLBAR,
   317 	WC_BUILD_STATION, WC_BUILD_TOOLBAR,
   318 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   318 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   319 	_build_dock_station_widgets,
   319 	_build_dock_station_widgets,
   320 };
   320 };
   321 
   321 
   322 static void ShowBuildDockStationPicker()
   322 static void ShowBuildDockStationPicker(Window *parent)
   323 {
   323 {
   324 	new BuildDocksStationWindow(&_build_dock_station_desc);
   324 	new BuildDocksStationWindow(&_build_dock_station_desc, parent);
   325 }
   325 }
   326 
   326 
   327 struct BuildDocksDepotWindow : public PickerWindowBase {
   327 struct BuildDocksDepotWindow : public PickerWindowBase {
   328 private:
   328 private:
   329 	enum BuildDockDepotWidgets {
   329 	enum BuildDockDepotWidgets {
   342 			SetTileSelectSize(2, 1);
   342 			SetTileSelectSize(2, 1);
   343 		}
   343 		}
   344 	}
   344 	}
   345 
   345 
   346 public:
   346 public:
   347 	BuildDocksDepotWindow(const WindowDesc *desc) : PickerWindowBase(desc)
   347 	BuildDocksDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
   348 	{
   348 	{
   349 		this->LowerWidget(_ship_depot_direction + BDDW_X);
   349 		this->LowerWidget(_ship_depot_direction + BDDW_X);
   350 		UpdateDocksDirection();
   350 		UpdateDocksDirection();
   351 		this->FindWindowPlacementAndResize(desc);
   351 		this->FindWindowPlacementAndResize(desc);
   352 	}
   352 	}
   392 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   392 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
   393 	_build_docks_depot_widgets,
   393 	_build_docks_depot_widgets,
   394 };
   394 };
   395 
   395 
   396 
   396 
   397 static void ShowBuildDocksDepotPicker()
   397 static void ShowBuildDocksDepotPicker(Window *parent)
   398 {
   398 {
   399 	new BuildDocksDepotWindow(&_build_docks_depot_desc);
   399 	new BuildDocksDepotWindow(&_build_docks_depot_desc, parent);
   400 }
   400 }
   401 
   401 
   402 
   402 
   403 void InitializeDockGui()
   403 void InitializeDockGui()
   404 {
   404 {