From da01ec4f52c2f31984b2d362d326c15288f9f93c Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 30 Jul 2013 22:07:27 +0200 Subject: [PATCH] Only show the "Rest until healed" button when stats are not full --- apps/openmw/mwgui/waitdialog.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/waitdialog.cpp b/apps/openmw/mwgui/waitdialog.cpp index 97c869b07..63419d4dd 100644 --- a/apps/openmw/mwgui/waitdialog.cpp +++ b/apps/openmw/mwgui/waitdialog.cpp @@ -216,7 +216,13 @@ namespace MWGui void WaitDialog::setCanRest (bool canRest) { - mUntilHealedButton->setVisible(canRest); + MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); + MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player); + bool full = (stats.getFatigue().getCurrent() >= stats.getFatigue().getModified()) + && (stats.getHealth().getCurrent() >= stats.getHealth().getModified()) + && (stats.getMagicka().getCurrent() >= stats.getMagicka().getModified()); + + mUntilHealedButton->setVisible(canRest && !full); mWaitButton->setCaptionWithReplacing (canRest ? "#{sRest}" : "#{sWait}"); mRestText->setCaptionWithReplacing (canRest ? "#{sRestMenu3}" : "#{sRestIllegal}");