From 6110a0ee3b8e36728207dc4bc3416ee7de698cbe Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 8 Aug 2013 18:30:47 -0700 Subject: [PATCH] Don't allow resting as a werewolf --- apps/openmw/mwgui/waitdialog.cpp | 6 +++++- apps/openmw/mwworld/worldimp.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/waitdialog.cpp b/apps/openmw/mwgui/waitdialog.cpp index e159a826ec..359f26dee1 100644 --- a/apps/openmw/mwgui/waitdialog.cpp +++ b/apps/openmw/mwgui/waitdialog.cpp @@ -223,10 +223,14 @@ namespace MWGui bool full = (stats.getFatigue().getCurrent() >= stats.getFatigue().getModified()) && (stats.getHealth().getCurrent() >= stats.getHealth().getModified()) && (stats.getMagicka().getCurrent() >= stats.getMagicka().getModified()); + MWMechanics::NpcStats& npcstats = MWWorld::Class::get(player).getNpcStats(player); + bool werewolf = npcstats.isWerewolf(); mUntilHealedButton->setVisible(canRest && !full); mWaitButton->setCaptionWithReplacing (canRest ? "#{sRest}" : "#{sWait}"); - mRestText->setCaptionWithReplacing (canRest ? "#{sRestMenu3}" : "#{sRestIllegal}"); + mRestText->setCaptionWithReplacing (canRest ? "#{sRestMenu3}" + : (werewolf ? "#{sWerewolfRestMessage}" + : "#{sRestIllegal}")); mSleeping = canRest; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 3b76beb433..e0e7e1093a 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1645,13 +1645,15 @@ namespace MWWorld { Ptr::CellStore *currentCell = mWorldScene->getCurrentCell(); - RefData &refdata = mPlayer->getPlayer().getRefData(); + Ptr player = mPlayer->getPlayer(); + RefData &refdata = player.getRefData(); Ogre::Vector3 playerPos(refdata.getPosition().pos); const OEngine::Physic::PhysicActor *physactor = mPhysEngine->getCharacter(refdata.getHandle()); if((!physactor->getOnGround()&&physactor->getCollisionMode()) || isUnderwater(currentCell, playerPos)) return 2; - if((currentCell->mCell->mData.mFlags&ESM::Cell::NoSleep)) + if((currentCell->mCell->mData.mFlags&ESM::Cell::NoSleep) || + Class::get(player).getNpcStats(player).isWerewolf()) return 1; return 0;