From 40277243f5952ed411b801c0217051f24a481568 Mon Sep 17 00:00:00 2001 From: Krzysztof Grzadziel Date: Sat, 1 Feb 2025 16:56:12 +0100 Subject: [PATCH] Fix #13431: Press Ctrl to build diagonal canals in game mode Enable diagonal build shape for canals in game mode when Ctrl is pressed. In editor mode we keep current behaviour. --- src/dock_gui.cpp | 12 ++++++++++-- src/lang/english.txt | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index ac2c004cea..82f3858da6 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -152,7 +152,11 @@ struct BuildDocksToolbarWindow : Window { { switch (widget) { case WID_DT_CANAL: // Build canal button - HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT); + if (_game_mode == GM_EDITOR) { + HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT); + } else { + HandlePlacePushButton(this, WID_DT_CANAL, SPR_CURSOR_CANAL, HT_RECT | HT_DIAGONAL); + } break; case WID_DT_LOCK: // Build lock button @@ -255,7 +259,11 @@ struct BuildDocksToolbarWindow : Window { GUIPlaceProcDragXY(select_proc, start_tile, end_tile); break; case DDSP_CREATE_WATER: - Command::Post(STR_ERROR_CAN_T_BUILD_CANALS, CcPlaySound_CONSTRUCTION_WATER, end_tile, start_tile, (_game_mode == GM_EDITOR && _ctrl_pressed) ? WATER_CLASS_SEA : WATER_CLASS_CANAL, false); + if (_game_mode == GM_EDITOR) { + Command::Post(STR_ERROR_CAN_T_BUILD_CANALS, CcPlaySound_CONSTRUCTION_WATER, end_tile, start_tile, _ctrl_pressed ? WATER_CLASS_SEA : WATER_CLASS_CANAL, false); + } else { + Command::Post(STR_ERROR_CAN_T_BUILD_CANALS, CcPlaySound_CONSTRUCTION_WATER, end_tile, start_tile, WATER_CLASS_CANAL, _ctrl_pressed); + } break; case DDSP_CREATE_RIVER: Command::Post(STR_ERROR_CAN_T_PLACE_RIVERS, CcPlaySound_CONSTRUCTION_WATER, end_tile, start_tile, WATER_CLASS_RIVER, _ctrl_pressed); diff --git a/src/lang/english.txt b/src/lang/english.txt index 1ecbbae547..c3a4409c1f 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2950,7 +2950,7 @@ STR_STATION_BUILD_CARGO_TRAM_ORIENTATION_TOOLTIP :{BLACK}Select f # Waterways toolbar (last two for SE only) STR_WATERWAYS_TOOLBAR_CAPTION :{WHITE}Waterways Construction STR_WATERWAYS_TOOLBAR_CAPTION_SE :{WHITE}Waterways -STR_WATERWAYS_TOOLBAR_BUILD_CANALS_TOOLTIP :{BLACK}Build canals. Also press Shift to show cost estimate only +STR_WATERWAYS_TOOLBAR_BUILD_CANALS_TOOLTIP :{BLACK}Build canals. Ctrl+Click+Drag to select the area diagonally. Also press Shift to show cost estimate only STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP :{BLACK}Build locks. Also press Shift to show cost estimate only STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP :{BLACK}Build ship depot (for buying and servicing ships). Also press Shift to show cost estimate only STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP :{BLACK}Build ship dock. Ctrl+Click to select another station to join. Also press Shift to show cost estimate only