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

Call clear() for every window

This commit is contained in:
scrawl 2017-09-23 22:16:56 +02:00
parent c6c01870ec
commit e7d2a8a4dc
14 changed files with 27 additions and 20 deletions

View file

@ -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;

View file

@ -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");

View file

@ -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(); }

View file

@ -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; }

View file

@ -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);

View file

@ -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;

View file

@ -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(); }

View file

@ -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(); }

View file

@ -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);

View file

@ -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 ();

View file

@ -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);

View file

@ -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();

View file

@ -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) {}
}; };

View file

@ -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();
} }