Call clear() for every window

pull/303/head
scrawl 7 years ago
parent c6c01870ec
commit e7d2a8a4dc

@ -24,6 +24,7 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& npc); void setPtr(const MWWorld::Ptr& npc);
void onFrame (float dt); void onFrame (float dt);
void clear() { resetReference(); }
private: private:
ItemView* mItemView; ItemView* mItemView;

@ -47,6 +47,7 @@ namespace MWGui
void setFont(const std::string &fntName); void setFont(const std::string &fntName);
void onResChange(int width, int height); void onResChange(int width, int height);
void clear() { resetReference(); }
// Print a message to the console, in specified color. // Print a message to the console, in specified color.
void print(const std::string &msg, const std::string& color = "#FFFFFF"); void print(const std::string &msg, const std::string& color = "#FFFFFF");

@ -35,6 +35,7 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& container); void setPtr(const MWWorld::Ptr& container);
virtual void onClose(); virtual void onClose();
void clear() { resetReference(); }
void onFrame(float dt) { checkReferenceAvailable(); } void onFrame(float dt) { checkReferenceAvailable(); }

@ -118,6 +118,7 @@ namespace MWGui
void goodbye(); void goodbye();
void onFrame(float dt); void onFrame(float dt);
void clear() { resetReference(); }
// make sure to call these before setKeywords() // make sure to call these before setKeywords()
void setServices(int services) { mServices = services; } void setServices(int services) { mServices = services; }

@ -22,6 +22,7 @@ namespace MWGui
virtual void onOpen(); virtual void onOpen();
void onFrame(float dt) { checkReferenceAvailable(); } void onFrame(float dt) { checkReferenceAvailable(); }
void clear() { resetReference(); }
void setSoulGem (const MWWorld::Ptr& gem); void setSoulGem (const MWWorld::Ptr& gem);
void setItem (const MWWorld::Ptr& item); void setItem (const MWWorld::Ptr& item);

@ -60,6 +60,8 @@ namespace MWGui
void setEnemy(const MWWorld::Ptr& enemy); void setEnemy(const MWWorld::Ptr& enemy);
void resetEnemy(); void resetEnemy();
void clear() { resetEnemy(); }
private: private:
MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth, *mDrowning; MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth, *mDrowning;
MyGUI::Widget* mHealthFrame; MyGUI::Widget* mHealthFrame;

@ -29,6 +29,7 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& actor, int startOffset); void setPtr(const MWWorld::Ptr& actor, int startOffset);
void onFrame(float dt) { checkReferenceAvailable(); } void onFrame(float dt) { checkReferenceAvailable(); }
void clear() { resetReference(); }
void onResChange(int, int) { center(); } void onResChange(int, int) { center(); }

@ -151,6 +151,7 @@ namespace MWGui
SpellCreationDialog(); SpellCreationDialog();
virtual void onOpen(); virtual void onOpen();
void clear() { resetReference(); }
void onFrame(float dt) { checkReferenceAvailable(); } void onFrame(float dt) { checkReferenceAvailable(); }

@ -30,6 +30,7 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& actor); void setPtr(const MWWorld::Ptr& actor);
void onFrame(float dt); void onFrame(float dt);
void clear() { resetReference(); }
void borrowItem (int index, size_t count); void borrowItem (int index, size_t count);
void returnItem (int index, size_t count); void returnItem (int index, size_t count);

@ -20,6 +20,8 @@ namespace MWGui
void onFrame(float dt); void onFrame(float dt);
void clear() { resetReference(); }
protected: protected:
virtual void onReferenceUnavailable (); virtual void onReferenceUnavailable ();

@ -262,6 +262,11 @@ namespace MWGui
} }
} }
void WaitDialog::clear()
{
mProgressBar.setVisible(false);
}
void WaitDialog::stopWaiting () void WaitDialog::stopWaiting ()
{ {
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.2f); MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.2f);

@ -34,6 +34,7 @@ namespace MWGui
virtual bool exit(); virtual bool exit();
void onFrame(float dt); void onFrame(float dt);
void clear();
bool getSleeping() { return mTimeAdvancer.isRunning() && mSleeping; } bool getSleeping() { return mTimeAdvancer.isRunning() && mSleeping; }
void wakeUp(); void wakeUp();

@ -45,6 +45,9 @@ namespace MWGui
void center(); void center();
/// Clear any state specific to the running game
virtual void clear() {}
/// Called when GUI viewport changes size /// Called when GUI viewport changes size
virtual void onResChange(int width, int height) {} virtual void onResChange(int width, int height) {}
}; };

@ -514,10 +514,6 @@ namespace MWGui
void WindowManager::setNewGame(bool newgame) void WindowManager::setNewGame(bool newgame)
{ {
// This method will always be called after loading a savegame or starting a new game
// Reset enemy, it could be a dangling pointer from a previous game
mHud->resetEnemy();
if (newgame) if (newgame)
{ {
disallowAll(); disallowAll();
@ -1596,36 +1592,26 @@ namespace MWGui
void WindowManager::clear() void WindowManager::clear()
{ {
for (WindowBase* window : mWindows)
window->clear();
if (mLocalMapRender) if (mLocalMapRender)
mLocalMapRender->clear(); mLocalMapRender->clear();
mMap->clear();
mQuickKeysMenu->clear();
mMessageBoxManager->clear(); mMessageBoxManager->clear();
mTrainingWindow->resetReference();
mDialogueWindow->resetReference();
mTradeWindow->resetReference();
mSpellBuyingWindow->resetReference();
mSpellCreationDialog->resetReference();
mEnchantingDialog->resetReference();
mContainerWindow->resetReference();
mCompanionWindow->resetReference();
mConsole->resetReference();
mToolTips->setFocusObject(MWWorld::ConstPtr()); mToolTips->setFocusObject(MWWorld::ConstPtr());
mInventoryWindow->clear();
mSelectedSpell.clear(); mSelectedSpell.clear();
mCustomMarkers.clear(); mCustomMarkers.clear();
mForceHidden = GW_None; mForceHidden = GW_None;
setWerewolfOverlay(false); setWerewolfOverlay(false);
mGuiModes.clear(); while (!mGuiModes.empty())
popGuiMode();
MWBase::Environment::get().getInputManager()->changeInputMode(false); MWBase::Environment::get().getInputManager()->changeInputMode(false);
updateVisible(); updateVisible();
} }

Loading…
Cancel
Save