stop hovering when the cursor points at no tile
A cursor resting on a panel or outside the window kept whatever it last pointed at: the ghost, the tunnel preview, the deconstruct tint all stayed put, because "not hovering" was not a state the build mode could hold. Make both ghost tiles optional, clear the hover with them, and re-derive it when the cursor comes back or a mode is entered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
This commit is contained in:
@@ -135,6 +135,17 @@ void BuildModeController::exitCurrentMode()
|
||||
enterMode(BuildMode::None);
|
||||
}
|
||||
|
||||
void BuildModeController::clearHover()
|
||||
{
|
||||
m_ghostTile.reset();
|
||||
m_ghostValid = false;
|
||||
m_tunnelGhostType = BuildingType::TunnelEntry;
|
||||
m_tunnelPartnerTile.reset();
|
||||
m_blueprintGhostTile.reset();
|
||||
m_hoveredGhostIsTransfer = false;
|
||||
m_deconstructHoverBuildingId.reset();
|
||||
}
|
||||
|
||||
BuildingType BuildModeController::getBuilderType() const
|
||||
{
|
||||
return m_builderType;
|
||||
@@ -150,7 +161,7 @@ BuildingType BuildModeController::getEffectiveBuilderType() const
|
||||
return isTunnelMode() ? m_tunnelGhostType : m_builderType;
|
||||
}
|
||||
|
||||
QPoint BuildModeController::getGhostTile() const
|
||||
const std::optional<QPoint>& BuildModeController::getGhostTile() const
|
||||
{
|
||||
return m_ghostTile;
|
||||
}
|
||||
@@ -240,7 +251,7 @@ Blueprint& BuildModeController::getMutableBlueprint()
|
||||
return m_blueprint;
|
||||
}
|
||||
|
||||
QPoint BuildModeController::getBlueprintGhostTile() const
|
||||
const std::optional<QPoint>& BuildModeController::getBlueprintGhostTile() const
|
||||
{
|
||||
return m_blueprintGhostTile;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user