mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-15 22:21:00 +00:00
Replace movement() with eraseMovementIf()
This commit is contained in:
parent
5a6dbf8714
commit
00b1cd8c08
@ -207,8 +207,7 @@ namespace
|
||||
osg::Vec3f takeMovement(MWPhysics::PtrHolder& actor, float startTime, float endTime) const
|
||||
{
|
||||
osg::Vec3f movement = osg::Vec3f();
|
||||
auto it = actor.movement().begin();
|
||||
std::erase_if(actor.movement(), [&](MWPhysics::Movement& v) {
|
||||
actor.eraseMovementIf([&](MWPhysics::Movement& v) {
|
||||
if (v.mJump)
|
||||
return false;
|
||||
float start = std::max(v.mSimulationTimeStart, startTime);
|
||||
@ -225,7 +224,7 @@ namespace
|
||||
std::optional<osg::Vec3f> takeInertia(MWPhysics::PtrHolder& actor, float startTime) const
|
||||
{
|
||||
std::optional<osg::Vec3f> inertia = std::nullopt;
|
||||
std::erase_if(actor.movement(), [&](MWPhysics::Movement& v) {
|
||||
actor.eraseMovementIf([&](MWPhysics::Movement& v) {
|
||||
if (v.mJump && v.mSimulationTimeStart >= startTime)
|
||||
{
|
||||
inertia = v.mVelocity;
|
||||
|
@ -47,7 +47,7 @@ namespace MWPhysics
|
||||
mMovement.push_back(Movement{ velocity, simulationTimeStart, simulationTimeStop, jump });
|
||||
}
|
||||
|
||||
std::list<Movement>& movement() { return mMovement; }
|
||||
void eraseMovementIf(const auto& predicate) { std::erase_if(mMovement, predicate); }
|
||||
|
||||
void setSimulationPosition(const osg::Vec3f& position) { mSimulationPosition = position; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user