mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-03 11:45:59 +00:00
CSplinePathExtra: Collapse RemoveWaypoint loop into find_if()
This commit is contained in:
parent
487f2ae176
commit
8c06309364
@ -64,16 +64,15 @@ void CSplinePathExtra::AddWaypoints()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSplinePathExtra::RemoveWaypoint(CWaypointExtra *pWaypoint)
|
void CSplinePathExtra::RemoveWaypoint(const CWaypointExtra *pWaypoint)
|
||||||
{
|
{
|
||||||
for (auto it = mWaypoints.begin(); it != mWaypoints.end(); ++it)
|
const auto iter = std::find_if(mWaypoints.cbegin(), mWaypoints.cend(),
|
||||||
{
|
[pWaypoint](const auto* entry) { return entry == pWaypoint; });
|
||||||
if (*it == pWaypoint)
|
|
||||||
{
|
if (iter == mWaypoints.cend())
|
||||||
mWaypoints.erase(it);
|
return;
|
||||||
break;
|
|
||||||
}
|
mWaypoints.erase(iter);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSplinePathExtra::ClearWaypoints()
|
void CSplinePathExtra::ClearWaypoints()
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
|
|
||||||
void FindAttachedWaypoints(std::set<CWaypointExtra*>& rChecked, CWaypointExtra* pWaypoint);
|
void FindAttachedWaypoints(std::set<CWaypointExtra*>& rChecked, CWaypointExtra* pWaypoint);
|
||||||
void AddWaypoints();
|
void AddWaypoints();
|
||||||
void RemoveWaypoint(CWaypointExtra* pWaypoint);
|
void RemoveWaypoint(const CWaypointExtra* pWaypoint);
|
||||||
void ClearWaypoints();
|
void ClearWaypoints();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user