clang
This commit is contained in:
parent
9416c9615d
commit
17e3103018
@ -13,8 +13,10 @@ extern bool init;
|
||||
extern bool ReadyForCommands;
|
||||
extern int priority;
|
||||
extern std::vector<CNavArea> areas;
|
||||
std::vector<Vector> findPath(Vector loc, Vector dest, int &id_loc, int &id_dest);
|
||||
bool NavTo(Vector dest, bool navToLocalCenter = true, bool persistent = true, int instructionPriority = 5);
|
||||
std::vector<Vector> findPath(Vector loc, Vector dest, int &id_loc,
|
||||
int &id_dest);
|
||||
bool NavTo(Vector dest, bool navToLocalCenter = true, bool persistent = true,
|
||||
int instructionPriority = 5);
|
||||
void clearInstructions();
|
||||
int findClosestNavSquare(Vector vec);
|
||||
bool Prepare();
|
||||
@ -28,9 +30,10 @@ struct inactivityTracker
|
||||
|
||||
void reset()
|
||||
{
|
||||
//inactives.clear();
|
||||
// inactives.clear();
|
||||
}
|
||||
void addTime(std::pair<int, int> connection, Timer &timer, bool &resetPather)
|
||||
void addTime(std::pair<int, int> connection, Timer &timer,
|
||||
bool &resetPather)
|
||||
{
|
||||
if (inactives.find(connection) == inactives.end())
|
||||
{
|
||||
@ -44,7 +47,8 @@ struct inactivityTracker
|
||||
if (inactives[connection] >= 5000)
|
||||
resetPather = true;
|
||||
}
|
||||
void addTime(std::pair<Vector, Vector> connection, Timer &timer, bool &resetPather)
|
||||
void addTime(std::pair<Vector, Vector> connection, Timer &timer,
|
||||
bool &resetPather)
|
||||
{
|
||||
CNavArea *currnode = nullptr;
|
||||
for (size_t i = 0; i < areas.size(); i++)
|
||||
@ -74,7 +78,8 @@ struct inactivityTracker
|
||||
{
|
||||
if (i.area->m_id == nextnode->m_id)
|
||||
{
|
||||
addTime(std::pair{currnode->m_id, nextnode->m_id}, timer, resetPather);
|
||||
addTime(std::pair{ currnode->m_id, nextnode->m_id }, timer,
|
||||
resetPather);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -85,5 +90,4 @@ struct inactivityTracker
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace nav
|
||||
|
@ -28,7 +28,7 @@ struct MAP : public micropather::Graph
|
||||
// Function to check if a connection is ignored
|
||||
bool IsIgnored(size_t currState, size_t connectionID)
|
||||
{
|
||||
if (inactiveTracker.getTime({currState, connectionID}) >= 5000)
|
||||
if (inactiveTracker.getTime({ currState, connectionID }) >= 5000)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -287,7 +287,7 @@ static std::vector<Vector> crumbs;
|
||||
static bool ensureArrival;
|
||||
// Priority value for current instructions, only higher priority can overwrite
|
||||
// itlocalAreas
|
||||
int priority = 0;
|
||||
int priority = 0;
|
||||
static Vector lastArea = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
// dest = Destination, navToLocalCenter = Should bot travel to local center
|
||||
@ -310,7 +310,7 @@ bool NavTo(Vector dest, bool navToLocalCenter, bool persistent,
|
||||
if (!crumbs.empty())
|
||||
{
|
||||
bool reset = false;
|
||||
inactiveTracker.addTime({lastArea, crumbs.at(0)}, inactivity, reset);
|
||||
inactiveTracker.addTime({ lastArea, crumbs.at(0) }, inactivity, reset);
|
||||
if (reset)
|
||||
TF2MAP->pather->Reset();
|
||||
}
|
||||
@ -385,7 +385,7 @@ void CreateMove()
|
||||
{
|
||||
// Ignore connection
|
||||
bool i3 = false;
|
||||
inactiveTracker.addTime({lastArea, crumbs.at(0)}, inactivity, i3);
|
||||
inactiveTracker.addTime({ lastArea, crumbs.at(0) }, inactivity, i3);
|
||||
if (i3)
|
||||
TF2MAP->pather->Reset();
|
||||
if (ensureArrival)
|
||||
|
Reference in New Issue
Block a user