Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpPathfinder_Common.h
Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | public: | ||||
GridUpdateInformation m_AIPathfinderDirtinessInformation; | GridUpdateInformation m_AIPathfinderDirtinessInformation; | ||||
bool m_TerrainDirty; | bool m_TerrainDirty; | ||||
std::vector<VertexPathfinder> m_VertexPathfinders; | std::vector<VertexPathfinder> m_VertexPathfinders; | ||||
std::unique_ptr<HierarchicalPathfinder> m_PathfinderHier; | std::unique_ptr<HierarchicalPathfinder> m_PathfinderHier; | ||||
std::unique_ptr<LongPathfinder> m_LongPathfinder; | std::unique_ptr<LongPathfinder> m_LongPathfinder; | ||||
// One per live asynchronous path computing task. | // One per live asynchronous path computing task. | ||||
std::vector<Future<void>> m_Futures; | struct FutureFunction | ||||
{ | |||||
void operator()() const | |||||
{ | |||||
PROFILE2("Async pathfinding"); | |||||
self.m_ShortPathRequests.Compute(self, vertexFinder); | |||||
self.m_LongPathRequests.Compute(self, *self.m_LongPathfinder); | |||||
} | |||||
CCmpPathfinder& self; | |||||
VertexPathfinder& vertexFinder; | |||||
}; | |||||
std::vector<Future<FutureFunction>> m_Futures; | |||||
jprahman: As above, feels a little awkward to template on the callback type, instead of the result type. | |||||
template<typename T> | template<typename T> | ||||
class PathRequests { | class PathRequests { | ||||
public: | public: | ||||
std::vector<T> m_Requests; | std::vector<T> m_Requests; | ||||
std::vector<PathResult> m_Results; | std::vector<PathResult> m_Results; | ||||
// This is the array index of the next path to compute. | // This is the array index of the next path to compute. | ||||
std::atomic<size_t> m_NextPathToCompute = 0; | std::atomic<size_t> m_NextPathToCompute = 0; | ||||
▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
As above, feels a little awkward to template on the callback type, instead of the result type.