Index: source/simulation2/components/CCmpPathfinder.cpp =================================================================== --- source/simulation2/components/CCmpPathfinder.cpp +++ source/simulation2/components/CCmpPathfinder.cpp @@ -113,7 +113,7 @@ struct SerializeLongRequest { template - void operator()(S& serialize, const char* UNUSED(name), AsyncLongPathRequest& value) + void operator()(S& serialize, const char* UNUSED(name), LongPathRequest& value) { serialize.NumberU32_Unbounded("ticket", value.ticket); serialize.NumberFixed_Unbounded("x0", value.x0); @@ -127,7 +127,7 @@ struct SerializeShortRequest { template - void operator()(S& serialize, const char* UNUSED(name), AsyncShortPathRequest& value) + void operator()(S& serialize, const char* UNUSED(name), ShortPathRequest& value) { serialize.NumberU32_Unbounded("ticket", value.ticket); serialize.NumberFixed_Unbounded("x0", value.x0); @@ -145,8 +145,8 @@ template void CCmpPathfinder::SerializeCommon(S& serialize) { - SerializeVector()(serialize, "long requests", m_AsyncLongPathRequests); - SerializeVector()(serialize, "short requests", m_AsyncShortPathRequests); + SerializeVector()(serialize, "long requests", m_LongPathRequests); + SerializeVector()(serialize, "short requests", m_ShortPathRequests); serialize.NumberU32_Unbounded("next ticket", m_NextAsyncTicket); serialize.NumberU16_Unbounded("same turn moves count", m_SameTurnMovesCount); serialize.NumberU16_Unbounded("map size", m_MapSize); @@ -711,19 +711,19 @@ u32 CCmpPathfinder::ComputePathAsync(entity_pos_t x0, entity_pos_t z0, const PathGoal& goal, pass_class_t passClass, entity_id_t notify) { - AsyncLongPathRequest req = { m_NextAsyncTicket++, x0, z0, goal, passClass, notify }; - m_AsyncLongPathRequests.push_back(req); + LongPathRequest req = { m_NextAsyncTicket++, x0, z0, goal, passClass, notify }; + m_LongPathRequests.push_back(req); return req.ticket; } u32 CCmpPathfinder::ComputeShortPathAsync(entity_pos_t x0, entity_pos_t z0, entity_pos_t clearance, entity_pos_t range, const PathGoal& goal, pass_class_t passClass, bool avoidMovingUnits, entity_id_t group, entity_id_t notify) { - AsyncShortPathRequest req = { m_NextAsyncTicket++, x0, z0, clearance, range, goal, passClass, avoidMovingUnits, group, notify }; - m_AsyncShortPathRequests.push_back(req); + ShortPathRequest req = { m_NextAsyncTicket++, x0, z0, clearance, range, goal, passClass, avoidMovingUnits, group, notify }; + m_ShortPathRequests.push_back(req); return req.ticket; } -WaypointPath CCmpPathfinder::ComputeShortPath(const AsyncShortPathRequest& request) const +WaypointPath CCmpPathfinder::ComputeShortPath(const ShortPathRequest& request) const { return m_VertexPathfinder->ComputeShortPath(request, CmpPtr(GetSystemEntity())); } @@ -734,11 +734,11 @@ { PROFILE2("Finish Async Requests"); // Save the request queue in case it gets modified while iterating - std::vector longRequests; - m_AsyncLongPathRequests.swap(longRequests); + std::vector longRequests; + m_LongPathRequests.swap(longRequests); - std::vector shortRequests; - m_AsyncShortPathRequests.swap(shortRequests); + std::vector shortRequests; + m_ShortPathRequests.swap(shortRequests); // TODO: we should only compute one path per entity per turn @@ -749,12 +749,12 @@ ProcessShortRequests(shortRequests); } -void CCmpPathfinder::ProcessLongRequests(const std::vector& longRequests) +void CCmpPathfinder::ProcessLongRequests(const std::vector& longRequests) { PROFILE2("Process Long Requests"); for (size_t i = 0; i < longRequests.size(); ++i) { - const AsyncLongPathRequest& req = longRequests[i]; + const LongPathRequest& req = longRequests[i]; WaypointPath path; ComputePath(req.x0, req.z0, req.goal, req.passClass, path); CMessagePathResult msg(req.ticket, path); @@ -762,12 +762,12 @@ } } -void CCmpPathfinder::ProcessShortRequests(const std::vector& shortRequests) +void CCmpPathfinder::ProcessShortRequests(const std::vector& shortRequests) { PROFILE2("Process Short Requests"); for (size_t i = 0; i < shortRequests.size(); ++i) { - const AsyncShortPathRequest& req = shortRequests[i]; + const ShortPathRequest& req = shortRequests[i]; WaypointPath path = m_VertexPathfinder->ComputeShortPath(req, CmpPtr(GetSystemEntity())); CMessagePathResult msg(req.ticket, path); GetSimContext().GetComponentManager().PostMessage(req.notify, msg); @@ -776,7 +776,7 @@ void CCmpPathfinder::ProcessSameTurnMoves() { - if (!m_AsyncLongPathRequests.empty()) + if (!m_LongPathRequests.empty()) { // Figure out how many moves we can do this time i32 moveCount = m_MaxSameTurnMoves - m_SameTurnMovesCount; @@ -785,17 +785,17 @@ return; // Copy the long request elements we are going to process into a new array - std::vector longRequests; - if ((i32)m_AsyncLongPathRequests.size() <= moveCount) + std::vector longRequests; + if ((i32)m_LongPathRequests.size() <= moveCount) { - m_AsyncLongPathRequests.swap(longRequests); + m_LongPathRequests.swap(longRequests); moveCount = (i32)longRequests.size(); } else { longRequests.resize(moveCount); - copy(m_AsyncLongPathRequests.begin(), m_AsyncLongPathRequests.begin() + moveCount, longRequests.begin()); - m_AsyncLongPathRequests.erase(m_AsyncLongPathRequests.begin(), m_AsyncLongPathRequests.begin() + moveCount); + copy(m_LongPathRequests.begin(), m_LongPathRequests.begin() + moveCount, longRequests.begin()); + m_LongPathRequests.erase(m_LongPathRequests.begin(), m_LongPathRequests.begin() + moveCount); } ProcessLongRequests(longRequests); @@ -803,7 +803,7 @@ m_SameTurnMovesCount = (u16)(m_SameTurnMovesCount + moveCount); } - if (!m_AsyncShortPathRequests.empty()) + if (!m_ShortPathRequests.empty()) { // Figure out how many moves we can do now i32 moveCount = m_MaxSameTurnMoves - m_SameTurnMovesCount; @@ -812,17 +812,17 @@ return; // Copy the short request elements we are going to process into a new array - std::vector shortRequests; - if ((i32)m_AsyncShortPathRequests.size() <= moveCount) + std::vector shortRequests; + if ((i32)m_ShortPathRequests.size() <= moveCount) { - m_AsyncShortPathRequests.swap(shortRequests); + m_ShortPathRequests.swap(shortRequests); moveCount = (i32)shortRequests.size(); } else { shortRequests.resize(moveCount); - copy(m_AsyncShortPathRequests.begin(), m_AsyncShortPathRequests.begin() + moveCount, shortRequests.begin()); - m_AsyncShortPathRequests.erase(m_AsyncShortPathRequests.begin(), m_AsyncShortPathRequests.begin() + moveCount); + copy(m_ShortPathRequests.begin(), m_ShortPathRequests.begin() + moveCount, shortRequests.begin()); + m_ShortPathRequests.erase(m_ShortPathRequests.begin(), m_ShortPathRequests.begin() + moveCount); } ProcessShortRequests(shortRequests); Index: source/simulation2/components/CCmpPathfinder_Common.h =================================================================== --- source/simulation2/components/CCmpPathfinder_Common.h +++ source/simulation2/components/CCmpPathfinder_Common.h @@ -79,8 +79,8 @@ // Dynamic state: - std::vector m_AsyncLongPathRequests; - std::vector m_AsyncShortPathRequests; + std::vector m_LongPathRequests; + std::vector m_ShortPathRequests; u32 m_NextAsyncTicket; // unique IDs for asynchronous path requests u16 m_SameTurnMovesCount; // current number of same turn moves we have processed this turn @@ -172,7 +172,7 @@ virtual u32 ComputePathAsync(entity_pos_t x0, entity_pos_t z0, const PathGoal& goal, pass_class_t passClass, entity_id_t notify); - virtual WaypointPath ComputeShortPath(const AsyncShortPathRequest& request) const; + virtual WaypointPath ComputeShortPath(const ShortPathRequest& request) const; virtual u32 ComputeShortPathAsync(entity_pos_t x0, entity_pos_t z0, entity_pos_t clearance, entity_pos_t range, const PathGoal& goal, pass_class_t passClass, bool avoidMovingUnits, entity_id_t controller, entity_id_t notify); @@ -196,9 +196,9 @@ virtual void FinishAsyncRequests(); - void ProcessLongRequests(const std::vector& longRequests); + void ProcessLongRequests(const std::vector& longRequests); - void ProcessShortRequests(const std::vector& shortRequests); + void ProcessShortRequests(const std::vector& shortRequests); virtual void ProcessSameTurnMoves(); Index: source/simulation2/components/ICmpPathfinder.h =================================================================== --- source/simulation2/components/ICmpPathfinder.h +++ source/simulation2/components/ICmpPathfinder.h @@ -114,7 +114,7 @@ * a unit of clearance 'clearance' will be able to follow the path with no collisions. * The path is restricted to a box of radius 'range' from the starting point. */ - virtual WaypointPath ComputeShortPath(const AsyncShortPathRequest& request) const = 0; + virtual WaypointPath ComputeShortPath(const ShortPathRequest& request) const = 0; /** * Asynchronous version of ComputeShortPath (using ControlGroupObstructionFilter). Index: source/simulation2/helpers/Pathfinding.h =================================================================== --- source/simulation2/helpers/Pathfinding.h +++ source/simulation2/helpers/Pathfinding.h @@ -29,7 +29,7 @@ typedef u16 pass_class_t; -struct AsyncLongPathRequest +struct LongPathRequest { u32 ticket; entity_pos_t x0; @@ -39,7 +39,7 @@ entity_id_t notify; }; -struct AsyncShortPathRequest +struct ShortPathRequest { u32 ticket; entity_pos_t x0; Index: source/simulation2/helpers/VertexPathfinder.h =================================================================== --- source/simulation2/helpers/VertexPathfinder.h +++ source/simulation2/helpers/VertexPathfinder.h @@ -81,7 +81,7 @@ * The path is restricted to a box of radius 'range' from the starting point. * Defined in CCmpPathfinder_Vertex.cpp */ - WaypointPath ComputeShortPath(const AsyncShortPathRequest& request, CmpPtr cmpObstructionManager) const; + WaypointPath ComputeShortPath(const ShortPathRequest& request, CmpPtr cmpObstructionManager) const; void SetDebugOverlay(bool enabled) { m_DebugOverlay = enabled; } void RenderSubmit(SceneCollector& collector); Index: source/simulation2/helpers/VertexPathfinder.cpp =================================================================== --- source/simulation2/helpers/VertexPathfinder.cpp +++ source/simulation2/helpers/VertexPathfinder.cpp @@ -510,7 +510,7 @@ } }; -WaypointPath VertexPathfinder::ComputeShortPath(const AsyncShortPathRequest& request, CmpPtr cmpObstructionManager) const +WaypointPath VertexPathfinder::ComputeShortPath(const ShortPathRequest& request, CmpPtr cmpObstructionManager) const { PROFILE2("ComputeShortPath");