Keep jailing state for one frame after leaving jail (bug #3788)

pull/540/head
Andrei Kortunov 6 years ago
parent 9dfd775bf2
commit 4003fa1296

@ -19,6 +19,7 @@
Bug #3486: [Mod] NPC Commands does not work Bug #3486: [Mod] NPC Commands does not work
Bug #3591: Angled hit distance too low Bug #3591: Angled hit distance too low
Bug #3629: DB assassin attack never triggers creature spawning Bug #3629: DB assassin attack never triggers creature spawning
Bug #3788: GetPCInJail and GetPCTraveling do not work as in vanilla
Bug #3876: Landscape texture painting is misaligned Bug #3876: Landscape texture painting is misaligned
Bug #3897: Have Goodbye give all choices the effects of Goodbye Bug #3897: Have Goodbye give all choices the effects of Goodbye
Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters

@ -154,7 +154,7 @@ namespace MWWorld
mActivationDistanceOverride (activationDistanceOverride), mStartupScript(startupScript), mActivationDistanceOverride (activationDistanceOverride), mStartupScript(startupScript),
mStartCell (startCell), mDistanceToFacedObject(-1), mTeleportEnabled(true), mStartCell (startCell), mDistanceToFacedObject(-1), mTeleportEnabled(true),
mLevitationEnabled(true), mGoToJail(false), mDaysInPrison(0), mLevitationEnabled(true), mGoToJail(false), mDaysInPrison(0),
mPlayerTraveling(false), mSpellPreloadTimer(0.f) mPlayerTraveling(false), mPlayerInJail(false), mSpellPreloadTimer(0.f)
{ {
mPhysics.reset(new MWPhysics::PhysicsSystem(resourceSystem, rootNode)); mPhysics.reset(new MWPhysics::PhysicsSystem(resourceSystem, rootNode));
mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, &mFallback, resourcePath)); mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, &mFallback, resourcePath));
@ -313,6 +313,7 @@ namespace MWWorld
mTeleportEnabled = true; mTeleportEnabled = true;
mLevitationEnabled = true; mLevitationEnabled = true;
mPlayerTraveling = false; mPlayerTraveling = false;
mPlayerInJail = false;
fillGlobalVariables(); fillGlobalVariables();
} }
@ -1641,11 +1642,17 @@ namespace MWWorld
void World::update (float duration, bool paused) void World::update (float duration, bool paused)
{ {
if (mGoToJail && !paused)
goToJail();
// Reset "traveling" flag - there was a frame to detect traveling. // Reset "traveling" flag - there was a frame to detect traveling.
mPlayerTraveling = false; mPlayerTraveling = false;
if (mGoToJail && !paused) // The same thing for "in jail" flag: reset it if:
goToJail(); // 1. Player was in jail
// 2. Jailing window was closed
if (mPlayerInJail && !mGoToJail && !MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Jail))
mPlayerInJail = false;
updateWeather(duration, paused); updateWeather(duration, paused);
@ -3286,6 +3293,7 @@ namespace MWWorld
{ {
// Reset bounty and forget the crime now, but don't change cell yet (the player should be able to read the dialog text first) // Reset bounty and forget the crime now, but don't change cell yet (the player should be able to read the dialog text first)
mGoToJail = true; mGoToJail = true;
mPlayerInJail = true;
MWWorld::Ptr player = getPlayerPtr(); MWWorld::Ptr player = getPlayerPtr();
@ -3311,10 +3319,7 @@ namespace MWWorld
bool World::isPlayerInJail() const bool World::isPlayerInJail() const
{ {
if (mGoToJail) return mPlayerInJail;
return true;
return MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Jail);
} }
void World::setPlayerTraveling(bool traveling) void World::setPlayerTraveling(bool traveling)

@ -169,6 +169,7 @@ namespace MWWorld
bool mGoToJail; bool mGoToJail;
int mDaysInPrison; int mDaysInPrison;
bool mPlayerTraveling; bool mPlayerTraveling;
bool mPlayerInJail;
float mSpellPreloadTimer; float mSpellPreloadTimer;
@ -673,8 +674,8 @@ namespace MWWorld
bool isPlayerInJail() const override; bool isPlayerInJail() const override;
void setPlayerTraveling(bool traveling); void setPlayerTraveling(bool traveling) override;
bool isPlayerTraveling() const; bool isPlayerTraveling() const override;
/// Return terrain height at \a worldPos position. /// Return terrain height at \a worldPos position.
float getTerrainHeightAt(const osg::Vec3f& worldPos) const override; float getTerrainHeightAt(const osg::Vec3f& worldPos) const override;

Loading…
Cancel
Save