载入中...
搜索中...
未找到
HexCell.h
浏览该文件的文档.
53 [[nodiscard]] constexpr std::int32_t waterLevel() const noexcept { return static_cast<std::int32_t>(get(31u, 5u)); }
55 [[nodiscard]] constexpr std::int32_t urbanLevel() const noexcept { return static_cast<std::int32_t>(get(3u, 10u)); }
57 [[nodiscard]] constexpr std::int32_t farmLevel() const noexcept { return static_cast<std::int32_t>(get(3u, 12u)); }
59 [[nodiscard]] constexpr std::int32_t plantLevel() const noexcept { return static_cast<std::int32_t>(get(3u, 14u)); }
74 [[nodiscard]] constexpr bool isUnderwater() const noexcept { return waterLevel() > elevation(); }
105 [[nodiscard]] constexpr std::uint32_t get(std::uint32_t mask, std::uint32_t shift) const noexcept {
143 [[nodiscard]] constexpr bool hasNone(HexFlags other) const noexcept { return (packed_ & other.packed_) == 0u; }
145 [[nodiscard]] constexpr HexFlags with(HexFlags other) const noexcept { return HexFlags{packed_ | other.packed_}; }
152 [[nodiscard]] constexpr bool hasRoad(HexDirection d) const noexcept { return has(direction(d)); }
164 [[nodiscard]] constexpr bool hasAnyRiverIn() const noexcept { return (packed_ & (0x3fu << 6)) != 0u; }
166 [[nodiscard]] constexpr bool hasAnyRiverOut() const noexcept { return (packed_ & (0x3fu << 12)) != 0u; }
168 [[nodiscard]] constexpr bool hasRiver() const noexcept { return hasAnyRiverIn() || hasAnyRiverOut(); }
193 [[nodiscard]] constexpr bool isExplored() const noexcept { return (packed_ & (1u << 20)) != 0u; }
195 [[nodiscard]] constexpr bool isExplorable() const noexcept { return (packed_ & (1u << 21)) != 0u; }
198 [[nodiscard]] constexpr HexFlags withRoad(HexDirection d) const noexcept { return with(direction(d)); }
200 [[nodiscard]] constexpr HexFlags withoutRoad(HexDirection d) const noexcept { return without(direction(d)); }
Pointy-top hex metrics, directions and vertex helpers.
Packed boolean cell state (roads, rivers, walls, exploration).
Definition HexCell.h:123
constexpr bool hasRiver() const noexcept
Whether this cell has any river connection at all.
Definition HexCell.h:168
constexpr bool hasRiverBeginOrEnd() const noexcept
Whether the cell is a river source or sink (exactly one connection).
Definition HexCell.h:176
constexpr bool hasRiverThrough(HexDirection d) const noexcept
Whether a river enters and/or leaves through d.
Definition HexCell.h:172
constexpr HexFlags withoutRiverIn(HexDirection d) const noexcept
Without river in.
Definition HexCell.h:207
constexpr HexFlags withRiverOut(HexDirection d) const noexcept
With river out.
Definition HexCell.h:212
constexpr HexFlags withExplorable(bool value) const noexcept
With explorable.
Definition HexCell.h:230
constexpr bool hasAnyRiverOut() const noexcept
Whether any river leaves this cell.
Definition HexCell.h:166
constexpr bool hasAnyRiverIn() const noexcept
Whether any river flows into this cell.
Definition HexCell.h:164
constexpr HexFlags withoutRiverOut(HexDirection d) const noexcept
Without river out.
Definition HexCell.h:217
constexpr bool hasRiverOut(HexDirection d) const noexcept
True when river out.
Definition HexCell.h:159
constexpr HexValues withTerrainType(std::int32_t value) const noexcept
With terrain type.
Definition HexCell.h:100
constexpr HexValues withFarmLevel(std::int32_t value) const noexcept
With farm level.
Definition HexCell.h:88
constexpr bool isUnderwater() const noexcept
Whether the cell is flooded above its terrain surface.
Definition HexCell.h:74
constexpr HexValues withSpecialIndex(std::int32_t value) const noexcept
With special index.
Definition HexCell.h:96
constexpr HexValues withElevation(std::int32_t value) const noexcept
Definition HexCell.h:76
constexpr std::int32_t viewElevation() const noexcept
Elevation used for line of sight: the higher of land and water.
Definition HexCell.h:70
constexpr HexValues withPlantLevel(std::int32_t value) const noexcept
With plant level.
Definition HexCell.h:92
constexpr HexValues withWaterLevel(std::int32_t value) const noexcept
With water level.
Definition HexCell.h:80
constexpr HexValues withUrbanLevel(std::int32_t value) const noexcept
With urban level.
Definition HexCell.h:84
Definition HexCell.h:9
constexpr bool canHoldUnit(const HexCellData &cell) noexcept
Whether a cell record is in a state that can hold a unit.
Definition HexCell.h:261
constexpr std::int32_t clampTerrainType(std::int32_t index) noexcept
Terrain type index clamped into the supported palette range.
Definition HexCell.h:24
constexpr std::int32_t kHexTerrainTypeCount
Number of entries in the terrain palette.
Definition HexCell.h:21
Definition Container.h:602
One cell of the hex map: packed values plus packed flags.
Definition HexCell.h:244