stop reporting changes originating from physics system back to physics system

actorid
Marc Zinnschlag 14 years ago
parent ec88aee581
commit 9a5a6eac2b

@ -125,6 +125,7 @@ set(GAMEWORLD
mwworld/actiontake.cpp
mwworld/containerutil.cpp
mwworld/player.cpp
mwworld/doingphysics.cpp
)
set(GAMEWORLD_HEADER
mwworld/refdata.hpp
@ -143,6 +144,7 @@ set(GAMEWORLD_HEADER
mwworld/manualref.hpp
mwworld/containerutil.hpp
mwworld/player.hpp
mwworld/doingphysics.hpp
)
source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER})

@ -11,6 +11,7 @@
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
#include "../mwworld/ptr.hpp"
#include "../mwworld/doingphysics.hpp"
#include <components/esm/loadstat.hpp>
#include "player.hpp"
@ -100,6 +101,8 @@ std::pair<std::string, float> MWScene::getFacedHandle (MWWorld::World& world)
void MWScene::doPhysics (float duration, MWWorld::World& world)
{
// stop changes to world from being reported back to the physics system
MWWorld::DoingPhysics scopeGuard;
}

@ -0,0 +1,22 @@
#include "doingphysics.hpp"
namespace MWWorld
{
int DoingPhysics::sCounter = 0;
DoingPhysics::DoingPhysics()
{
++sCounter;
}
DoingPhysics::~DoingPhysics()
{
--sCounter;
}
bool DoingPhysics::isDoingPhysics()
{
return sCounter>0;
}
}

@ -0,0 +1,26 @@
#ifndef GAME_MWWORLD_DOINGPHYSICS_H
#define GAME_MWWORLD_DOINGPHYSICS_H
namespace MWWorld
{
///< Scope guard for blocking physics updates during physics simulation.
class DoingPhysics
{
static int sCounter;
private:
DoingPhysics (const DoingPhysics&);
DoingPhysics& operator= (const DoingPhysics&);
public:
DoingPhysics();
~DoingPhysics();
static bool isDoingPhysics();
};
}
#endif
Loading…
Cancel
Save