载入中...
搜索中...
未找到
LineOfSightRouter.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
21#include "common/Result.h"
22#include "sensing/Targeting.h"
23
24#include <array>
25#include <string_view>
26#include <vector>
27
28namespace eve::sensing {
29
38public:
40 LineOfSightRouter() = default;
41
44
54 [[nodiscard]] Result<void> addProvider(CoordinateSpace space, const ILineOfSightQuery* provider);
55
61 [[nodiscard]] Result<void> removeProvider(CoordinateSpace space, const ILineOfSightQuery* provider);
62
64 [[nodiscard]] bool hasProvider(CoordinateSpace space) const noexcept;
65
67 [[nodiscard]] std::vector<CoordinateSpace> spaces() const;
68
74 [[nodiscard]] Result<LineOfSightResult> query(const TargetLocation& from,
75 const TargetLocation& to) const override;
76
77private:
79 [[nodiscard]] static std::optional<CoordinateSpace> spaceOf(const TargetLocation& location) noexcept;
80
81 static constexpr std::size_t kSpaceCount = 4;
83 std::array<const ILineOfSightQuery*, kSpaceCount> providers_{};
84};
85
103
104} // namespace eve::sensing
std::string from
#define EVENGINE_API_PLATFORM
Definition Export.h:107
HexCoordinates to
Cell the unit walks towards on this segment.
Definition HexUnits.cpp:64
Move-only, checked operation results for the common layer.
Coordinate-safe targeting protocol shared by sensing and gameplay adapters.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Consumer-owned line-of-sight capability.
Definition Targeting.h:431
Routes each line-of-sight query to the backend that claimed its coordinate space.
LineOfSightRouter & operator=(const LineOfSightRouter &)=delete
LineOfSightRouter()=default
Line of sight router.
LineOfSightRouter(const LineOfSightRouter &)=delete
std::variant< WorldPoint, GridPoint > TargetLocation
Either a world point or a grid point, with the tag retained.
Definition Targeting.h:198
Result< LineOfSightRouter * > ensureLineOfSightRouter()
The process-wide router, registered as the ILineOfSightQuery capability.
CoordinateSpace
Coordinate spaces are not interchangeable, even when dimensions match.
Definition Targeting.h:37