| 1569 | } |
| 1570 | |
| 1571 | Dungeon::PartConstPtr DungeonGenerator::pickAnchor() { |
| 1572 | auto validAnchors = m_def->anchors().filtered([this](String const& anchorName) { |
| 1573 | auto anchorPart = m_def->parts().get(anchorName); |
| 1574 | return (!anchorPart->minimumThreatLevel() || m_threatLevel >= *anchorPart->minimumThreatLevel()) |
| 1575 | && (!anchorPart->maximumThreatLevel() || m_threatLevel <= *anchorPart->maximumThreatLevel()); |
| 1576 | }); |
| 1577 | |
| 1578 | if (validAnchors.empty()) |
| 1579 | return {}; |
| 1580 | |
| 1581 | return m_def->parts().get(m_rand.randFrom(validAnchors)); |
| 1582 | } |
| 1583 | |
| 1584 | List<Dungeon::ConnectorConstPtr> DungeonGenerator::findConnectablePart(Dungeon::ConnectorConstPtr connector) const { |
| 1585 | List<Dungeon::ConnectorConstPtr> result; |
no test coverage detected