diff --git a/docs/requirements.md b/docs/requirements.md index 61f1f96..951c7f3 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -670,7 +670,7 @@ The controls panel tells the player which controls are available right now. It i |---|---|---|---| | General | no build mode active, nothing selected | `GENERAL` | — | | Selection | no build mode active, at least one object selected | `SELECTION` | ` buildings` or ` objects` | - | Build | builder mode active (REQ-BLD-BUILDER-MODE) | `BUILD MODE` | the building type's name | + | Build | builder mode active (REQ-BLD-BUILDER-MODE) | `BUILD MODE` | the name of the building type that would be placed at the hovered position, so in tunnel mode it follows the resolved end and reads `Tunnel Entry` or `Tunnel Exit` (REQ-BLD-TUNNEL-MODE) | | Blueprint | blueprint placement mode active (REQ-UI-BLUEPRINT-MODE) | `BLUEPRINT MODE` | the blueprint's name, or `Temporary` for a temporary blueprint (REQ-UI-BLUEPRINT-TEMP) | | Deconstruct | deconstruct mode active (REQ-UI-DECONSTRUCT-BUTTON) | `DECONSTRUCT MODE` | — | diff --git a/src/lib/core/ControlAction.h b/src/lib/core/ControlAction.h index d2bec18..4833548 100644 --- a/src/lib/core/ControlAction.h +++ b/src/lib/core/ControlAction.h @@ -109,7 +109,10 @@ enum class ControlContextKind struct ControlContext { BuildMode mode = BuildMode::None; - BuildingType builderType = BuildingType::Belt; // while mode == Builder + // While mode == Builder: the type a click would place at the current hover position, + // not the type the mode was entered with — tunnel mode resolves to either end + // (REQ-BLD-TUNNEL-MODE). + BuildingType builderType = BuildingType::Belt; bool draggingBelt = false; // A single-building blueprint whose ghost is over a configuration-transfer target, // so clicking hands over settings rather than placing (REQ-UI-BLUEPRINT-TRANSFER). diff --git a/src/ui/GameWorldView.cpp b/src/ui/GameWorldView.cpp index b4fa26f..2140d47 100644 --- a/src/ui/GameWorldView.cpp +++ b/src/ui/GameWorldView.cpp @@ -1138,7 +1138,12 @@ ControlContext GameWorldView::getControlContext() const context.mode = m_buildMode.getMode(); context.draggingBelt = m_buildMode.isDraggingBelt(); context.hoveredGhostIsTransfer = m_buildMode.isHoveredGhostTransfer(); - if (m_buildMode.isBuilderMode()) { context.builderType = m_buildMode.getBuilderType(); } + // The type a click would actually place, so the panel agrees with the ghost when + // tunnel mode resolves to an exit (REQ-BLD-TUNNEL-MODE). + if (m_buildMode.isBuilderMode()) + { + context.builderType = m_buildMode.getEffectiveBuilderType(); + } // Buildings win over field objects, so the two are never both non-empty // (REQ-UI-SELECTION-CATEGORIES).