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_Barter,
GM_Rest,
GM_RestBed,
GM_SpellBuying,
GM_Travel,
GM_SpellCreation,

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

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

@ -398,7 +398,6 @@ namespace MWGui
mWaitDialog = new WaitDialog();
mGuiModeStates[GM_Rest] = GuiModeState(mWaitDialog);
mGuiModeStates[GM_RestBed] = GuiModeState(mWaitDialog);
mSpellCreationDialog = new SpellCreationDialog();
mGuiModeStates[GM_SpellCreation] = GuiModeState(mSpellCreationDialog);
@ -662,10 +661,6 @@ namespace MWGui
case GM_Review:
mCharGen->spawnDialog(mode);
break;
case GM_RestBed:
// FIXME: use GM_Rest and push the 'bed' argument in some other way
mWaitDialog->bedActivated();
break;
default:
break;
}
@ -1700,7 +1695,7 @@ namespace MWGui
{
return !MyGUI::InputManager::getInstance().isModalAny()
// 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)

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

Loading…
Cancel
Save