1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00

Reset bounty and crime immediately when going to jail (Fixes #1892)

This commit is contained in:
scrawl 2014-09-09 00:00:55 +02:00
parent 628600a0a5
commit 457b96a8af
3 changed files with 15 additions and 9 deletions

View File

@ -871,7 +871,6 @@ namespace MWScript
{
MWBase::World* world = MWBase::Environment::get().getWorld();
world->goToJail();
MWBase::Environment::get().getWorld()->getPlayer().recordCrimeId();
}
};

View File

@ -149,7 +149,7 @@ namespace MWWorld
mActivationDistanceOverride (activationDistanceOverride),
mFallback(fallbackMap), mTeleportEnabled(true), mLevitationEnabled(true),
mGodMode(false), mContentFiles (contentFiles),
mGoToJail(false),
mGoToJail(false), mDaysInPrison(0),
mStartCell (startCell), mStartupScript(startupScript)
{
mPhysics = new PhysicsSystem(renderer);
@ -2810,8 +2810,19 @@ namespace MWWorld
{
if (!mGoToJail)
{
// Save for next update, since 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;
MWWorld::Ptr player = getPlayerPtr();
int bounty = player.getClass().getNpcStats(player).getBounty();
player.getClass().getNpcStats(player).setBounty(0);
mPlayer->recordCrimeId();
confiscateStolenItems(player);
int iDaysinPrisonMod = getStore().get<ESM::GameSetting>().find("iDaysinPrisonMod")->getInt();
mDaysInPrison = std::max(1, bounty / iDaysinPrisonMod);
return;
}
else
@ -2822,13 +2833,8 @@ namespace MWWorld
MWWorld::Ptr player = getPlayerPtr();
teleportToClosestMarker(player, "prisonmarker");
int bounty = player.getClass().getNpcStats(player).getBounty();
player.getClass().getNpcStats(player).setBounty(0);
confiscateStolenItems(player);
int iDaysinPrisonMod = getStore().get<ESM::GameSetting>().find("iDaysinPrisonMod")->getInt();
int days = std::max(1, bounty / iDaysinPrisonMod);
int days = mDaysInPrison;
advanceTime(days * 24);
for (int i=0; i<days*24; ++i)
MWBase::Environment::get().getMechanicsManager ()->rest (true);

View File

@ -143,6 +143,7 @@ namespace MWWorld
bool mTeleportEnabled;
bool mLevitationEnabled;
bool mGoToJail;
int mDaysInPrison;
float feetToGameUnits(float feet);