static void PlaceDocks_Dock(TileIndex tile) { 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, "" }; ShowSelectStationIfNeeded(cmdcont, TileArea(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE)); }
/** * Place an airport. * @param tile Position to put the new airport. */ static void PlaceAirport(TileIndex tile) { if (_selected_airport_index == -1) return; uint32 p2 = _ctrl_pressed; SB(p2, 16, 16, INVALID_STATION); // no station to join uint32 p1 = AirportClass::Get(_selected_airport_class, _selected_airport_index)->GetIndex(); p1 |= _selected_airport_layout << 8; CommandContainer cmdcont = { tile, p1, p2, CMD_BUILD_AIRPORT | CMD_MSG(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE), CcBuildAirport, "" }; ShowSelectStationIfNeeded(cmdcont, TileArea(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE)); }
virtual void OnPlaceObject(Point pt, TileIndex tile) { switch (this->last_clicked_widget) { case WID_DT_CANAL: // Build canal button VpStartPlaceSizing(tile, (_game_mode == GM_EDITOR) ? VPM_X_AND_Y : VPM_X_OR_Y, DDSP_CREATE_WATER); break; case WID_DT_LOCK: // Build lock button DoCommandP(tile, 0, 0, CMD_BUILD_LOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_LOCKS), CcBuildDocks); break; case WID_DT_DEMOLISH: // Demolish aka dynamite button PlaceProc_DemolishArea(tile); break; case WID_DT_DEPOT: // Build depot button DoCommandP(tile, _ship_depot_direction, 0, CMD_BUILD_SHIP_DEPOT | CMD_MSG(STR_ERROR_CAN_T_BUILD_SHIP_DEPOT), CcBuildDocks); break; case WID_DT_STATION: { // Build station button 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. */ DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile)); TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile); ShowSelectStationIfNeeded(cmdcont, TileArea(tile, tile_to)); break; } case WID_DT_BUOY: // Build buoy button DoCommandP(tile, 0, 0, CMD_BUILD_BUOY | CMD_MSG(STR_ERROR_CAN_T_POSITION_BUOY_HERE), CcBuildDocks); break; case WID_DT_RIVER: // Build river button (in scenario editor) VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_RIVER); break; case WID_DT_BUILD_AQUEDUCT: // Build aqueduct button DoCommandP(tile, GetOtherAqueductEnd(tile), TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge); break; default: NOT_REACHED(); } }