Remove redundant RestBed gui mode

new-script-api
scrawl 7 years ago
parent 9ead331741
commit 32f9c8058a

@ -23,7 +23,6 @@ namespace MWGui
GM_Dialogue, // NPC interaction GM_Dialogue, // NPC interaction
GM_Barter, GM_Barter,
GM_Rest, GM_Rest,
GM_RestBed,
GM_SpellBuying, GM_SpellBuying,
GM_Travel, GM_Travel,
GM_SpellCreation, GM_SpellCreation,

@ -79,6 +79,11 @@ namespace MWGui
mProgressBar.setVisible (false); mProgressBar.setVisible (false);
} }
void WaitDialog::setPtr(const MWWorld::Ptr &ptr)
{
setCanRest(!ptr.isEmpty() || MWBase::Environment::get().getWorld ()->canRest () == 0);
}
bool WaitDialog::exit() bool WaitDialog::exit()
{ {
return (!mProgressBar.isVisible()); //Only exit if not currently waiting return (!mProgressBar.isVisible()); //Only exit if not currently waiting
@ -100,8 +105,6 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->popGuiMode (); MWBase::Environment::get().getWindowManager()->popGuiMode ();
} }
setCanRest(canRest == 0);
onHourSliderChangedPosition(mHourSlider, 0); onHourSliderChangedPosition(mHourSlider, 0);
mHourSlider->setScrollPosition (0); mHourSlider->setScrollPosition (0);
@ -176,7 +179,7 @@ namespace MWGui
void WaitDialog::onCancelButtonClicked(MyGUI::Widget* sender) void WaitDialog::onCancelButtonClicked(MyGUI::Widget* sender)
{ {
exit(); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Rest);
} }
void WaitDialog::onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position) void WaitDialog::onHourSliderChangedPosition(MyGUI::ScrollBar* sender, size_t position)
@ -264,7 +267,6 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.2f); MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.2f);
mProgressBar.setVisible (false); mProgressBar.setVisible (false);
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Rest); MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Rest);
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_RestBed);
mTimeAdvancer.stop(); mTimeAdvancer.stop();
} }

@ -27,14 +27,14 @@ namespace MWGui
public: public:
WaitDialog(); WaitDialog();
void setPtr(const MWWorld::Ptr &ptr);
virtual void onOpen(); virtual void onOpen();
virtual bool exit(); virtual bool exit();
void onFrame(float dt); void onFrame(float dt);
void bedActivated() { setCanRest(true); }
bool getSleeping() { return mTimeAdvancer.isRunning() && mSleeping; } bool getSleeping() { return mTimeAdvancer.isRunning() && mSleeping; }
void wakeUp(); void wakeUp();
void autosave(); void autosave();

@ -398,7 +398,6 @@ namespace MWGui
mWaitDialog = new WaitDialog(); mWaitDialog = new WaitDialog();
mGuiModeStates[GM_Rest] = GuiModeState(mWaitDialog); mGuiModeStates[GM_Rest] = GuiModeState(mWaitDialog);
mGuiModeStates[GM_RestBed] = GuiModeState(mWaitDialog);
mSpellCreationDialog = new SpellCreationDialog(); mSpellCreationDialog = new SpellCreationDialog();
mGuiModeStates[GM_SpellCreation] = GuiModeState(mSpellCreationDialog); mGuiModeStates[GM_SpellCreation] = GuiModeState(mSpellCreationDialog);
@ -662,10 +661,6 @@ namespace MWGui
case GM_Review: case GM_Review:
mCharGen->spawnDialog(mode); mCharGen->spawnDialog(mode);
break; break;
case GM_RestBed:
// FIXME: use GM_Rest and push the 'bed' argument in some other way
mWaitDialog->bedActivated();
break;
default: default:
break; break;
} }
@ -1700,7 +1695,7 @@ namespace MWGui
{ {
return !MyGUI::InputManager::getInstance().isModalAny() return !MyGUI::InputManager::getInstance().isModalAny()
// TODO: remove this, once we have properly serialized the state of open windows // TODO: remove this, once we have properly serialized the state of open windows
&& (!isGuiMode() || (mGuiModes.size() == 1 && (getMode() == GM_MainMenu || getMode() == GM_Rest || getMode() == GM_RestBed))); && (!isGuiMode() || (mGuiModes.size() == 1 && (getMode() == GM_MainMenu || getMode() == GM_Rest)));
} }
void WindowManager::playVideo(const std::string &name, bool allowSkipping) void WindowManager::playVideo(const std::string &name, bool allowSkipping)

@ -57,7 +57,7 @@ namespace MWScript
if (bed.isEmpty() || !MWBase::Environment::get().getMechanicsManager()->sleepInBed(MWMechanics::getPlayer(), if (bed.isEmpty() || !MWBase::Environment::get().getMechanicsManager()->sleepInBed(MWMechanics::getPlayer(),
bed)) bed))
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_RestBed); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Rest, bed);
} }
}; };

Loading…
Cancel
Save