forked from teamnwah/openmw-tes3coop
Only show the "Rest until healed" button when stats are not full
This commit is contained in:
parent
472a381263
commit
da01ec4f52
1 changed files with 7 additions and 1 deletions
|
@ -216,7 +216,13 @@ namespace MWGui
|
||||||
|
|
||||||
void WaitDialog::setCanRest (bool canRest)
|
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}");
|
mWaitButton->setCaptionWithReplacing (canRest ? "#{sRest}" : "#{sWait}");
|
||||||
mRestText->setCaptionWithReplacing (canRest ? "#{sRestMenu3}" : "#{sRestIllegal}");
|
mRestText->setCaptionWithReplacing (canRest ? "#{sRestMenu3}" : "#{sRestIllegal}");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue