Fix regression of sleep interruption chance

openmw-36
scrawl 10 years ago
parent 97c35da441
commit 58a2ad663c

@ -155,8 +155,9 @@ namespace MWGui
if (!region->mSleepList.empty()) if (!region->mSleepList.empty())
{ {
// figure out if player will be woken while sleeping // figure out if player will be woken while sleeping
int x = OEngine::Misc::Rng::rollDice(hoursToWait);
float fSleepRandMod = world->getStore().get<ESM::GameSetting>().find("fSleepRandMod")->getFloat(); float fSleepRandMod = world->getStore().get<ESM::GameSetting>().find("fSleepRandMod")->getFloat();
if (OEngine::Misc::Rng::rollProbability() > fSleepRandMod) if (x > fSleepRandMod * hoursToWait)
{ {
float fSleepRestMod = world->getStore().get<ESM::GameSetting>().find("fSleepRestMod")->getFloat(); float fSleepRestMod = world->getStore().get<ESM::GameSetting>().find("fSleepRestMod")->getFloat();
mInterruptAt = hoursToWait - int(fSleepRestMod * hoursToWait); mInterruptAt = hoursToWait - int(fSleepRestMod * hoursToWait);

Loading…
Cancel
Save