fix: swap dock tiles

This commit is contained in:
2023-04-10 00:11:52 +01:00
parent c34122aeff
commit ee1fcd4b17

View File

@@ -258,15 +258,15 @@ struct BuildDocksToolbarWindow : Window {
break; break;
case DDSP_BUILD_STATION: { case DDSP_BUILD_STATION: {
/* Determine the watery part of the dock. */ /* Determine the watery part of the dock. */
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(end_tile)); DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(start_tile));
TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(end_tile, ReverseDiagDir(dir)) : end_tile); TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(start_tile, ReverseDiagDir(dir)) : start_tile);
bool adjacent = _ctrl_pressed; bool adjacent = _ctrl_pressed;
auto proc = [=](bool test, StationID to_join) -> bool { auto proc = [=](bool test, StationID to_join) -> bool {
if (test) { if (test) {
return Command<CMD_BUILD_DOCK>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_DOCK>()), end_tile, INVALID_STATION, adjacent).Succeeded(); return Command<CMD_BUILD_DOCK>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_DOCK>()), start_tile, INVALID_STATION, adjacent).Succeeded();
} else { } else {
return Command<CMD_BUILD_DOCK>::Post(STR_ERROR_CAN_T_BUILD_DOCK_HERE, CcBuildDocks, end_tile, to_join, adjacent); return Command<CMD_BUILD_DOCK>::Post(STR_ERROR_CAN_T_BUILD_DOCK_HERE, CcBuildDocks, start_tile, to_join, adjacent);
} }
}; };
ShowSelectStationIfNeeded(TileArea(start_tile, tile_to), proc); ShowSelectStationIfNeeded(TileArea(start_tile, tile_to), proc);