Highlight tunnel connections in green when selected

This commit is contained in:
2026-07-21 21:16:21 +02:00
parent a75222f111
commit a8a6a04f1e
6 changed files with 220 additions and 12 deletions

View File

@@ -52,3 +52,15 @@ struct TunnelCompletion
TunnelCompletion resolveTunnelCompletion(const TunnelLookup& lookup, QPoint hoverTile,
Rotation rotation, int maxDistance,
QVector2D cursorWorldPos);
// Finds the matching end of an existing tunnel building at `tile` of the given `type`
// (TunnelEntry or TunnelExit) facing `rotation`, applying the pairing scan of
// REQ-BLD-TUNNEL-PAIR over `lookup`:
// - for an entry, the first same-direction tunnel along its facing direction, if it
// is an exit;
// - for an exit, the first same-direction tunnel opposite its facing direction, if it
// is an entry.
// Returns the partner tile, or std::nullopt when the tunnel is unpaired.
std::optional<QPoint> findTunnelPartner(const TunnelLookup& lookup, QPoint tile,
BuildingType type, Rotation rotation,
int maxDistance);