Skip to content

Commit

Permalink
fixed removing blockable waypoint flag
Browse files Browse the repository at this point in the history
  • Loading branch information
plastovicka committed May 7, 2020
1 parent 3bd0494 commit 63d82a5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
13 changes: 13 additions & 0 deletions 0.83/Omnibot/Common/PathPlannerWaypoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,19 @@ void PathPlannerWaypoint::BuildBlockableList()
LOG("Found " << iNumBlockablePaths << " blockable paths");
}

void PathPlannerWaypoint::ClearBlockable(Waypoint *_waypoint)
{
if (!_waypoint->IsAnyFlagOn(m_BlockableMask))
{
ConnectionList::iterator bIt = m_BlockableList.begin();
for (; bIt != m_BlockableList.end(); ++bIt)
{
if (bIt->first == _waypoint || bIt->second->m_Connection == _waypoint)
bIt->second->ClearFlag(F_LNK_CLOSED);
}
}
}

//void PathPlannerWaypoint::BuildVisTable()
//{
// m_VisTable.clear();
Expand Down
1 change: 1 addition & 0 deletions 0.83/Omnibot/Common/PathPlannerWaypoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class PathPlannerWaypoint : public PathPlannerBase

//void BuildVisTable();
void BuildBlockableList();
void ClearBlockable(Waypoint* _waypoint);

const char *GetPlannerName() const { return "Waypoint Path Planner"; } ;
int GetPlannerType() const { return NAVID_WP; };
Expand Down
13 changes: 2 additions & 11 deletions 0.83/Omnibot/Common/PathPlannerWaypointCmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1517,21 +1517,12 @@ void PathPlannerWaypoint::cmdWaypointAddFlag_Helper(const StringVector &_args, W
EngineFuncs::ConsoleMessage(va("%s Flag removed from waypoint.", _args[iToken].c_str()));

//open connections if blockable flag is removed
if((it->second & m_BlockableMask)!=0 && !_waypoint->IsAnyFlagOn(m_BlockableMask))
{
ConnectionList::iterator bIt = m_BlockableList.begin();
for( ; bIt != m_BlockableList.end(); ++bIt)
{
if(bIt->first == _waypoint || bIt->second->m_Connection == _waypoint)
bIt->second->ClearFlag(F_LNK_CLOSED);
}
}
if ((it->second & m_BlockableMask) != 0) ClearBlockable(_waypoint);
}

// Team flags have a somewhat special case.
// If no team flags are enable, make sure the teamonly flag is disable as well.
if(!_waypoint->IsFlagOn(F_NAV_TEAM1) && !_waypoint->IsFlagOn(F_NAV_TEAM2) &&
!_waypoint->IsFlagOn(F_NAV_TEAM3) && !_waypoint->IsFlagOn(F_NAV_TEAM4))
if(!_waypoint->IsAnyFlagOn(F_NAV_TEAM_ALL))
{
if(_waypoint->IsFlagOn(F_NAV_TEAMONLY))
{
Expand Down
3 changes: 3 additions & 0 deletions 0.83/Omnibot/Common/PathPlannerWaypointScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ static int GM_CDECL gmfSetWaypointFlag(gmThread *a_thread)
if(enable)
(*cIt)->AddFlag(flag);
else
{
(*cIt)->RemoveFlag(flag);
if(flag & PathPlannerWaypoint::m_BlockableMask) pWp->ClearBlockable(*cIt);
}

if(!(*cIt)->IsAnyFlagOn(F_NAV_TEAM_ALL))
{
Expand Down

0 comments on commit 63d82a5

Please sign in to comment.