dock_gui.c
changeset 1977 4392ae3d8e31
parent 1914 5ede46fd496f
child 1981 de031d2aed47
equal deleted inserted replaced
1976:41c542bd18c4 1977:4392ae3d8e31
    14 static void ShowBuildDockStationPicker(void);
    14 static void ShowBuildDockStationPicker(void);
    15 static void ShowBuildDocksDepotPicker(void);
    15 static void ShowBuildDocksDepotPicker(void);
    16 
    16 
    17 static byte _ship_depot_direction;
    17 static byte _ship_depot_direction;
    18 
    18 
    19 void CcBuildDocks(bool success, uint tile, uint32 p1, uint32 p2)
    19 void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
    20 {
    20 {
    21 	if (success) {
    21 	if (success) {
    22 		SndPlayTileFx(SND_02_SPLAT, tile);
    22 		SndPlayTileFx(SND_02_SPLAT, tile);
    23 		ResetObjectToPlace();
    23 		ResetObjectToPlace();
    24 	}
    24 	}
    25 }
    25 }
    26 
    26 
    27 void CcBuildCanal(bool success, uint tile, uint32 p1, uint32 p2)
    27 void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2)
    28 {
    28 {
    29 	if (success) SndPlayTileFx(SND_02_SPLAT, tile);
    29 	if (success) SndPlayTileFx(SND_02_SPLAT, tile);
    30 }
    30 }
    31 
    31 
    32 
    32 
    33 static void PlaceDocks_Dock(uint tile)
    33 static void PlaceDocks_Dock(TileIndex tile)
    34 {
    34 {
    35 	DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_DOCK | CMD_AUTO | CMD_MSG(STR_9802_CAN_T_BUILD_DOCK_HERE));
    35 	DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_DOCK | CMD_AUTO | CMD_MSG(STR_9802_CAN_T_BUILD_DOCK_HERE));
    36 }
    36 }
    37 
    37 
    38 static void PlaceDocks_Depot(uint tile)
    38 static void PlaceDocks_Depot(TileIndex tile)
    39 {
    39 {
    40 	DoCommandP(tile, _ship_depot_direction, 0, CcBuildDocks, CMD_BUILD_SHIP_DEPOT | CMD_AUTO | CMD_MSG(STR_3802_CAN_T_BUILD_SHIP_DEPOT));
    40 	DoCommandP(tile, _ship_depot_direction, 0, CcBuildDocks, CMD_BUILD_SHIP_DEPOT | CMD_AUTO | CMD_MSG(STR_3802_CAN_T_BUILD_SHIP_DEPOT));
    41 }
    41 }
    42 
    42 
    43 static void PlaceDocks_Buoy(uint tile)
    43 static void PlaceDocks_Buoy(TileIndex tile)
    44 {
    44 {
    45 	DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_BUOY | CMD_AUTO | CMD_MSG(STR_9835_CAN_T_POSITION_BUOY_HERE));
    45 	DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_BUOY | CMD_AUTO | CMD_MSG(STR_9835_CAN_T_POSITION_BUOY_HERE));
    46 }
    46 }
    47 
    47 
    48 static void PlaceDocks_DemolishArea(uint tile)
    48 static void PlaceDocks_DemolishArea(TileIndex tile)
    49 {
    49 {
    50 	VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_DemolishArea);
    50 	VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_DemolishArea);
    51 }
    51 }
    52 
    52 
    53 static void PlaceDocks_BuildCanal(uint tile)
    53 static void PlaceDocks_BuildCanal(TileIndex tile)
    54 {
    54 {
    55 	VpStartPlaceSizing(tile, VPM_X_OR_Y);
    55 	VpStartPlaceSizing(tile, VPM_X_OR_Y);
    56 }
    56 }
    57 
    57 
    58 static void PlaceDocks_BuildLock(uint tile)
    58 static void PlaceDocks_BuildLock(TileIndex tile)
    59 {
    59 {
    60 	DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_LOCK | CMD_AUTO | CMD_MSG(STR_CANT_BUILD_LOCKS));
    60 	DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_LOCK | CMD_AUTO | CMD_MSG(STR_CANT_BUILD_LOCKS));
    61 }
    61 }
    62 
    62 
    63 
    63 
   162 		w = FindWindowById(WC_BUILD_DEPOT, 0);
   162 		w = FindWindowById(WC_BUILD_DEPOT, 0);
   163 		if (w != NULL) WP(w,def_d).close=true;
   163 		if (w != NULL) WP(w,def_d).close=true;
   164 		break;
   164 		break;
   165 
   165 
   166 	case WE_PLACE_PRESIZE: {
   166 	case WE_PLACE_PRESIZE: {
   167 		uint tile_from, tile_to;
   167 		TileIndex tile_from;
       
   168 		TileIndex tile_to;
   168 
   169 
   169 		tile_from = tile_to = e->place.tile;
   170 		tile_from = tile_to = e->place.tile;
   170 		switch(GetTileSlope(tile_from, NULL)) {
   171 		switch(GetTileSlope(tile_from, NULL)) {
   171 		case 3: tile_to += TILE_XY(-1,0); break;
   172 		case 3: tile_to += TILE_XY(-1,0); break;
   172 		case 6:	tile_to += TILE_XY(0,-1);	break;
   173 		case 6:	tile_to += TILE_XY(0,-1);	break;