Clear movement queue when changing to a new cell (Fixes #1802)

This commit is contained in:
scrawl 2014-08-13 16:23:34 +02:00
parent d649c19790
commit 09f27d142a
3 changed files with 15 additions and 0 deletions

View file

@ -784,6 +784,13 @@ namespace MWWorld
mMovementQueue.push_back(std::make_pair(ptr, movement)); mMovementQueue.push_back(std::make_pair(ptr, movement));
} }
void PhysicsSystem::clearQueuedMovement()
{
mMovementQueue.clear();
mCollisions.clear();
mStandingCollisions.clear();
}
const PtrVelocityList& PhysicsSystem::applyQueuedMovement(float dt) const PtrVelocityList& PhysicsSystem::applyQueuedMovement(float dt)
{ {
// Collision events are only tracked for a single frame, so reset first // Collision events are only tracked for a single frame, so reset first

View file

@ -85,8 +85,12 @@ namespace MWWorld
/// be overwritten. Valid until the next call to applyQueuedMovement. /// be overwritten. Valid until the next call to applyQueuedMovement.
void queueObjectMovement(const Ptr &ptr, const Ogre::Vector3 &velocity); void queueObjectMovement(const Ptr &ptr, const Ogre::Vector3 &velocity);
/// Apply all queued movements, then clear the list.
const PtrVelocityList& applyQueuedMovement(float dt); const PtrVelocityList& applyQueuedMovement(float dt);
/// Clear the queued movements list without applying.
void clearQueuedMovement();
/// Return true if \a actor has been standing on \a object in this frame /// Return true if \a actor has been standing on \a object in this frame
/// This will trigger whenever the object is directly below the actor. /// This will trigger whenever the object is directly below the actor.
/// It doesn't matter if the actor is stationary or moving. /// It doesn't matter if the actor is stationary or moving.

View file

@ -840,6 +840,8 @@ namespace MWWorld
void World::changeToInteriorCell (const std::string& cellName, const ESM::Position& position) void World::changeToInteriorCell (const std::string& cellName, const ESM::Position& position)
{ {
mPhysics->clearQueuedMovement();
if (mCurrentWorldSpace != cellName) if (mCurrentWorldSpace != cellName)
{ {
// changed worldspace // changed worldspace
@ -855,6 +857,8 @@ namespace MWWorld
void World::changeToExteriorCell (const ESM::Position& position) void World::changeToExteriorCell (const ESM::Position& position)
{ {
mPhysics->clearQueuedMovement();
if (mCurrentWorldSpace != "sys::default") // FIXME if (mCurrentWorldSpace != "sys::default") // FIXME
{ {
// changed worldspace // changed worldspace