1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:53:51 +00:00

Merge pull request #2386 from Capostrophic/waiting

Exit waiting at the correct time when the player is in air
This commit is contained in:
Andrei Kortunov 2019-05-15 08:44:47 +04:00 committed by GitHub
commit 6bf5960b96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 21 deletions

View file

@ -80,18 +80,18 @@ namespace MWGui
mTimeAdvancer.eventInterrupted += MyGUI::newDelegate(this, &WaitDialog::onWaitingInterrupted); mTimeAdvancer.eventInterrupted += MyGUI::newDelegate(this, &WaitDialog::onWaitingInterrupted);
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &WaitDialog::onWaitingFinished); mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &WaitDialog::onWaitingFinished);
} }
void WaitDialog::onReferenceUnavailable ()
{
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Rest);
resetReference();
}
void WaitDialog::setPtr(const MWWorld::Ptr &ptr) void WaitDialog::setPtr(const MWWorld::Ptr &ptr)
{ {
mPtr = ptr; setCanRest(!ptr.isEmpty() || MWBase::Environment::get().getWorld ()->canRest () == MWBase::World::Rest_Allowed);
setCanRest(!mPtr.isEmpty() || MWBase::Environment::get().getWorld ()->canRest () == MWBase::World::Rest_Allowed);
if (ptr.isEmpty() && MWBase::Environment::get().getWorld ()->canRest() == MWBase::World::Rest_PlayerIsInAir)
{
// Resting in air is not allowed unless you're using a bed
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage1}");
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Rest);
}
if (mUntilHealedButton->getVisible()) if (mUntilHealedButton->getVisible())
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mUntilHealedButton); MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mUntilHealedButton);
else else
@ -107,7 +107,6 @@ namespace MWGui
{ {
mSleeping = false; mSleeping = false;
mTimeAdvancer.stop(); mTimeAdvancer.stop();
resetReference();
} }
void WaitDialog::onOpen() void WaitDialog::onOpen()
@ -141,12 +140,6 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage1}"); MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage1}");
MWBase::Environment::get().getWindowManager()->popGuiMode (); MWBase::Environment::get().getWindowManager()->popGuiMode ();
} }
else if (mPtr.isEmpty() && canRest == MWBase::World::Rest_PlayerIsInAir)
{
// Resting in air is not allowed either, unless you're using a bed
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage1}");
MWBase::Environment::get().getWindowManager()->popGuiMode ();
}
onHourSliderChangedPosition(mHourSlider, 0); onHourSliderChangedPosition(mHourSlider, 0);
mHourSlider->setScrollPosition (0); mHourSlider->setScrollPosition (0);
@ -303,8 +296,6 @@ namespace MWGui
void WaitDialog::onFrame(float dt) void WaitDialog::onFrame(float dt)
{ {
checkReferenceAvailable();
mTimeAdvancer.onFrame(dt); mTimeAdvancer.onFrame(dt);
if (mFadeTimeRemaining <= 0) if (mFadeTimeRemaining <= 0)

View file

@ -4,7 +4,6 @@
#include "timeadvancer.hpp" #include "timeadvancer.hpp"
#include "windowbase.hpp" #include "windowbase.hpp"
#include "referenceinterface.hpp"
namespace MWGui namespace MWGui
{ {
@ -23,7 +22,7 @@ namespace MWGui
MyGUI::TextBox* mProgressText; MyGUI::TextBox* mProgressText;
}; };
class WaitDialog : public WindowBase, public ReferenceInterface class WaitDialog : public WindowBase
{ {
public: public:
WaitDialog(); WaitDialog();
@ -64,8 +63,6 @@ namespace MWGui
WaitDialogProgressBar mProgressBar; WaitDialogProgressBar mProgressBar;
virtual void onReferenceUnavailable();
void onUntilHealedButtonClicked(MyGUI::Widget* sender); void onUntilHealedButtonClicked(MyGUI::Widget* sender);
void onWaitButtonClicked(MyGUI::Widget* sender); void onWaitButtonClicked(MyGUI::Widget* sender);
void onCancelButtonClicked(MyGUI::Widget* sender); void onCancelButtonClicked(MyGUI::Widget* sender);