MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / pickAnchor

Method pickAnchor

source/game/StarDungeonGenerator.cpp:1571–1582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1569}
1570
1571Dungeon::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
1584List<Dungeon::ConnectorConstPtr> DungeonGenerator::findConnectablePart(Dungeon::ConnectorConstPtr connector) const {
1585 List<Dungeon::ConnectorConstPtr> result;

Callers 1

generateMethod · 0.80

Calls 5

minimumThreatLevelMethod · 0.80
maximumThreatLevelMethod · 0.80
filteredMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected