diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 82147ca43..fa6b4f249 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -5714,7 +5714,7 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app) } else { - std::vector pathlist = zone->pathing->FindRoute(Start, End); + std::deque pathlist = zone->pathing->FindRoute(Start, End); if (pathlist.size() == 0) { diff --git a/zone/entity.cpp b/zone/entity.cpp index c7a980f3d..b2951407b 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2636,7 +2636,7 @@ void EntityList::FindPathsToAllNPCs() while (it != npc_list.end()) { Map::Vertex Node0 = zone->pathing->GetPathNodeCoordinates(0, false); Map::Vertex Dest(it->second->GetX(), it->second->GetY(), it->second->GetZ()); - std::vector Route = zone->pathing->FindRoute(Node0, Dest); + std::deque Route = zone->pathing->FindRoute(Node0, Dest); if (Route.size() == 0) printf("Unable to find a route to %s\n", it->second->GetName()); else diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index 2e8e146aa..f4354e709 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -158,7 +158,7 @@ void Mob::CalculateNewFearpoint() Map::Vertex CurrentPosition(GetX(), GetY(), GetZ()); - std::vector Route = zone->pathing->FindRoute(CurrentPosition, Loc); + std::deque Route = zone->pathing->FindRoute(CurrentPosition, Loc); if(Route.size() > 0) { diff --git a/zone/mob.h b/zone/mob.h index cb7b82948..431b3ac31 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1225,7 +1225,7 @@ protected: Map::Vertex PathingLastPosition; int PathingLoopCount; int PathingLastNodeVisited; - std::vector Route; + std::deque Route; LOSType PathingLOSState; Timer *PathingLOSCheckTimer; Timer *PathingRouteUpdateTimerShort; diff --git a/zone/pathing.cpp b/zone/pathing.cpp index 309d6c0ed..2ddd7d94b 100644 --- a/zone/pathing.cpp +++ b/zone/pathing.cpp @@ -205,15 +205,15 @@ Map::Vertex PathManager::GetPathNodeCoordinates(int NodeNumber, bool BestZ) } -std::vector PathManager::FindRoute(int startID, int endID) +std::deque PathManager::FindRoute(int startID, int endID) { _log(PATHING__DEBUG, "FindRoute from node %i to %i", startID, endID); memset(ClosedListFlag, 0, sizeof(int) * Head.PathNodeCount); - std::vector OpenList, ClosedList; + std::deque OpenList, ClosedList; - std::vectorRoute; + std::dequeRoute; AStarNode AStarEntry, CurrentNode; @@ -235,7 +235,7 @@ std::vector PathManager::FindRoute(int startID, int endID) ClosedListFlag[CurrentNode.PathNodeID] = true; - OpenList.erase(OpenList.begin()); + OpenList.pop_front(); for(int i = 0; i < PATHNODENEIGHBOURS; ++i) { @@ -251,7 +251,7 @@ std::vector PathManager::FindRoute(int startID, int endID) Route.push_back(endID); - std::vector::iterator RouteIterator; + std::deque::iterator RouteIterator; while(CurrentNode.PathNodeID != startID) { @@ -300,7 +300,7 @@ std::vector PathManager::FindRoute(int startID, int endID) bool AlreadyInOpenList = false; - std::vector::iterator OpenListIterator, InsertionPoint = OpenList.end(); + std::deque::iterator OpenListIterator, InsertionPoint = OpenList.end(); for(OpenListIterator = OpenList.begin(); OpenListIterator != OpenList.end(); ++OpenListIterator) { @@ -350,11 +350,11 @@ bool SortPathNodesByDistance(PathNodeSortStruct n1, PathNodeSortStruct n2) return n1.Distance < n2.Distance; } -std::vector PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) +std::deque PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { _log(PATHING__DEBUG, "FindRoute(%8.3f, %8.3f, %8.3f, %8.3f, %8.3f, %8.3f)", Start.x, Start.y, Start.z, End.x, End.y, End.z); - std::vector noderoute; + std::deque noderoute; float CandidateNodeRangeXY = RuleR(Pathing, CandidateNodeRangeXY); @@ -365,7 +365,7 @@ std::vector PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) // int ClosestPathNodeToStart = -1; - std::vector SortedByDistance; + std::deque SortedByDistance; PathNodeSortStruct TempNode; @@ -456,7 +456,7 @@ std::vector PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { int CulledNodes = 0; - std::vector::iterator First, Second; + std::deque::iterator First, Second; while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull)) { @@ -487,7 +487,7 @@ std::vector PathManager::FindRoute(Map::Vertex Start, Map::Vertex End) { int CulledNodes = 0; - std::vector::iterator First, Second; + std::deque::iterator First, Second; while((noderoute.size() >= 2) && (CulledNodes < NodesToAttemptToCull)) { @@ -611,7 +611,7 @@ void PathManager::MeshTest() if(j == i) continue; - std::vector Route = FindRoute(PathNodes[i].id, PathNodes[j].id); + std::deque Route = FindRoute(PathNodes[i].id, PathNodes[j].id); if(Route.size() == 0) { @@ -638,7 +638,7 @@ void PathManager::SimpleMeshTest() for(uint32 j = 1; j < Head.PathNodeCount; ++j) { - std::vector Route = FindRoute(PathNodes[0].id, PathNodes[j].id); + std::deque Route = FindRoute(PathNodes[0].id, PathNodes[j].id); if(Route.size() == 0) { @@ -695,7 +695,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } NodeLoc = zone->pathing->GetPathNodeCoordinates(Route.front()); - Route.erase(Route.begin()); + Route.pop_front(); ++PathingTraversedNodes; @@ -784,7 +784,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & } // We are on the same route, no LOS (or not checking this time, so pop off the node we just reached // - Route.erase(Route.begin()); + Route.pop_front(); ++PathingTraversedNodes; @@ -798,7 +798,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(NextNode == -1) { // -1 indicates a teleport to the next node - Route.erase(Route.begin()); + Route.pop_front(); if(Route.size() == 0) { @@ -814,7 +814,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & mlog(PATHING__DEBUG, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); - Route.erase(Route.begin()); + Route.pop_front(); if(Route.size() == 0) return To; @@ -962,7 +962,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & PathingLastNodeVisited = Route.front(); - Route.erase(Route.begin()); + Route.pop_front(); ++PathingTraversedNodes; @@ -975,7 +975,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & if(NextNode == -1) { // -1 indicates a teleport to the next node - Route.erase(Route.begin()); + Route.pop_front(); if(Route.size() == 0) { @@ -991,7 +991,7 @@ Map::Vertex Mob::UpdatePath(float ToX, float ToY, float ToZ, float Speed, bool & mlog(PATHING__DEBUG, " TELEPORTED to %8.3f, %8.3f, %8.3f\n", NodeLoc.x, NodeLoc.y, NodeLoc.z); - Route.erase(Route.begin()); + Route.pop_front(); if(Route.size() == 0) return To; @@ -1103,7 +1103,7 @@ int PathManager::FindNearestPathNode(Map::Vertex Position) int ClosestPathNodeToStart = -1; - std::vector SortedByDistance; + std::deque SortedByDistance; PathNodeSortStruct TempNode; diff --git a/zone/pathing.h b/zone/pathing.h index 8c131dbc3..8848547b2 100644 --- a/zone/pathing.h +++ b/zone/pathing.h @@ -3,7 +3,7 @@ #include "map.h" -#include +#include class Client; class Mob; @@ -60,8 +60,8 @@ public: static PathManager *LoadPathFile(const char *ZoneName); bool loadPaths(FILE *fp); void PrintPathing(); - std::vector FindRoute(Map::Vertex Start, Map::Vertex End); - std::vector FindRoute(int startID, int endID); + std::deque FindRoute(Map::Vertex Start, Map::Vertex End); + std::deque FindRoute(int startID, int endID); Map::Vertex GetPathNodeCoordinates(int NodeNumber, bool BestZ = true); bool CheckLosFN(Map::Vertex a, Map::Vertex b);