diff --git a/0.83/Omnibot/Common/PathPlannerWaypoint.cpp b/0.83/Omnibot/Common/PathPlannerWaypoint.cpp index 3e8529d89..696ec26d4 100644 --- a/0.83/Omnibot/Common/PathPlannerWaypoint.cpp +++ b/0.83/Omnibot/Common/PathPlannerWaypoint.cpp @@ -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(); diff --git a/0.83/Omnibot/Common/PathPlannerWaypoint.h b/0.83/Omnibot/Common/PathPlannerWaypoint.h index 80b8d139c..54724e08b 100644 --- a/0.83/Omnibot/Common/PathPlannerWaypoint.h +++ b/0.83/Omnibot/Common/PathPlannerWaypoint.h @@ -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; }; diff --git a/0.83/Omnibot/Common/PathPlannerWaypointCmds.cpp b/0.83/Omnibot/Common/PathPlannerWaypointCmds.cpp index b7dbbd093..19b0aba6d 100644 --- a/0.83/Omnibot/Common/PathPlannerWaypointCmds.cpp +++ b/0.83/Omnibot/Common/PathPlannerWaypointCmds.cpp @@ -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)) { diff --git a/0.83/Omnibot/Common/PathPlannerWaypointScript.cpp b/0.83/Omnibot/Common/PathPlannerWaypointScript.cpp index 6176bc0ab..c7b041884 100644 --- a/0.83/Omnibot/Common/PathPlannerWaypointScript.cpp +++ b/0.83/Omnibot/Common/PathPlannerWaypointScript.cpp @@ -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)) {