mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 00:26:39 +00:00 
			
		
		
		
	Issue #107: removed redundant getStore function from window manager
This commit is contained in:
		
							parent
							
								
									f37d3cd3c9
								
							
						
					
					
						commit
						484cce12a8
					
				
					 13 changed files with 54 additions and 35 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,8 @@
 | 
			
		|||
 | 
			
		||||
#include "journalimp.hpp"
 | 
			
		||||
 | 
			
		||||
#include <components/esm_store/store.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../mwbase/environment.hpp"
 | 
			
		||||
#include "../mwbase/world.hpp"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,11 +1,16 @@
 | 
			
		|||
#include "birth.hpp"
 | 
			
		||||
#include "window_manager.hpp"
 | 
			
		||||
#include "widgets.hpp"
 | 
			
		||||
#include "components/esm_store/store.hpp"
 | 
			
		||||
 | 
			
		||||
#include <boost/algorithm/string.hpp>
 | 
			
		||||
#include <boost/lexical_cast.hpp>
 | 
			
		||||
 | 
			
		||||
#include "components/esm_store/store.hpp"
 | 
			
		||||
 | 
			
		||||
#include "../mwbase/environment.hpp"
 | 
			
		||||
#include "../mwbase/world.hpp"
 | 
			
		||||
 | 
			
		||||
#include "window_manager.hpp"
 | 
			
		||||
#include "widgets.hpp"
 | 
			
		||||
 | 
			
		||||
using namespace MWGui;
 | 
			
		||||
using namespace Widgets;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -114,7 +119,7 @@ void BirthDialog::updateBirths()
 | 
			
		|||
{
 | 
			
		||||
    mBirthList->removeAllItems();
 | 
			
		||||
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager.getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
 | 
			
		||||
    ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator it = store.birthSigns.list.begin();
 | 
			
		||||
    ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator end = store.birthSigns.list.end();
 | 
			
		||||
| 
						 | 
				
			
			@ -144,7 +149,7 @@ void BirthDialog::updateSpells()
 | 
			
		|||
    const int lineHeight = 18;
 | 
			
		||||
    MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18);
 | 
			
		||||
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager.getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
    const ESM::BirthSign *birth = store.birthSigns.find(mCurrentBirthId);
 | 
			
		||||
 | 
			
		||||
    std::string texturePath = std::string("textures\\") + birth->texture;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,9 @@
 | 
			
		|||
 | 
			
		||||
#include <components/esm_store/store.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../mwbase/environment.hpp"
 | 
			
		||||
#include "../mwbase/world.hpp"
 | 
			
		||||
 | 
			
		||||
#include "window_manager.hpp"
 | 
			
		||||
#include "tooltips.hpp"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -57,8 +60,7 @@ void GenerateClassResultDialog::setClassId(const std::string &classId)
 | 
			
		|||
{
 | 
			
		||||
    mCurrentClassId = classId;
 | 
			
		||||
    mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds");
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager.getStore();
 | 
			
		||||
    mClassName->setCaption(store.classes.find(mCurrentClassId)->name);
 | 
			
		||||
    mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().classes.find(mCurrentClassId)->name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// widget controls
 | 
			
		||||
| 
						 | 
				
			
			@ -193,7 +195,7 @@ void PickClassDialog::updateClasses()
 | 
			
		|||
{
 | 
			
		||||
    mClassList->removeAllItems();
 | 
			
		||||
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager.getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
 | 
			
		||||
    ESMS::RecListT<ESM::Class>::MapType::const_iterator it = store.classes.list.begin();
 | 
			
		||||
    ESMS::RecListT<ESM::Class>::MapType::const_iterator end = store.classes.list.end();
 | 
			
		||||
| 
						 | 
				
			
			@ -217,7 +219,7 @@ void PickClassDialog::updateStats()
 | 
			
		|||
{
 | 
			
		||||
    if (mCurrentClassId.empty())
 | 
			
		||||
        return;
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager.getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
    const ESM::Class *klass = store.classes.search(mCurrentClassId);
 | 
			
		||||
    if (!klass)
 | 
			
		||||
        return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,9 @@
 | 
			
		|||
 | 
			
		||||
#include <components/esm_store/store.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../mwbase/environment.hpp"
 | 
			
		||||
#include "../mwbase/world.hpp"
 | 
			
		||||
 | 
			
		||||
#include "window_manager.hpp"
 | 
			
		||||
#include "widgets.hpp"
 | 
			
		||||
#include "tooltips.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -209,7 +212,7 @@ void RaceDialog::updateRaces()
 | 
			
		|||
{
 | 
			
		||||
    mRaceList->removeAllItems();
 | 
			
		||||
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager.getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
 | 
			
		||||
    ESMS::RecListT<ESM::Race>::MapType::const_iterator it = store.races.list.begin();
 | 
			
		||||
    ESMS::RecListT<ESM::Race>::MapType::const_iterator end = store.races.list.end();
 | 
			
		||||
| 
						 | 
				
			
			@ -243,7 +246,7 @@ void RaceDialog::updateSkills()
 | 
			
		|||
    const int lineHeight = 18;
 | 
			
		||||
    MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18);
 | 
			
		||||
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager.getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
    const ESM::Race *race = store.races.find(mCurrentRaceId);
 | 
			
		||||
    int count = sizeof(race->data.bonus)/sizeof(race->data.bonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
 | 
			
		||||
    for (int i = 0; i < count; ++i)
 | 
			
		||||
| 
						 | 
				
			
			@ -281,7 +284,7 @@ void RaceDialog::updateSpellPowers()
 | 
			
		|||
    const int lineHeight = 18;
 | 
			
		||||
    MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18);
 | 
			
		||||
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager.getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
    const ESM::Race *race = store.races.find(mCurrentRaceId);
 | 
			
		||||
 | 
			
		||||
    std::vector<std::string>::const_iterator it = race->powers.list.begin();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,9 @@
 | 
			
		|||
 | 
			
		||||
#include <components/esm_store/store.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../mwbase/environment.hpp"
 | 
			
		||||
#include "../mwbase/world.hpp"
 | 
			
		||||
 | 
			
		||||
#include "window_manager.hpp"
 | 
			
		||||
#include "widgets.hpp"
 | 
			
		||||
#include "tooltips.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -138,7 +141,7 @@ void ReviewDialog::setPlayerName(const std::string &name)
 | 
			
		|||
void ReviewDialog::setRace(const std::string &raceId)
 | 
			
		||||
{
 | 
			
		||||
    mRaceId = raceId;
 | 
			
		||||
    const ESM::Race *race = mWindowManager.getStore().races.search(mRaceId);
 | 
			
		||||
    const ESM::Race *race = MWBase::Environment::get().getWorld()->getStore().races.search(mRaceId);
 | 
			
		||||
    if (race)
 | 
			
		||||
    {
 | 
			
		||||
        ToolTips::createRaceToolTip(mRaceWidget, race);
 | 
			
		||||
| 
						 | 
				
			
			@ -156,7 +159,7 @@ void ReviewDialog::setClass(const ESM::Class& class_)
 | 
			
		|||
void ReviewDialog::setBirthSign(const std::string& signId)
 | 
			
		||||
{
 | 
			
		||||
    mBirthSignId = signId;
 | 
			
		||||
    const ESM::BirthSign *sign = mWindowManager.getStore().birthSigns.search(mBirthSignId);
 | 
			
		||||
    const ESM::BirthSign *sign = MWBase::Environment::get().getWorld()->getStore().birthSigns.search(mBirthSignId);
 | 
			
		||||
    if (sign)
 | 
			
		||||
    {
 | 
			
		||||
        mBirthSignWidget->setCaption(sign->name);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,7 +57,7 @@ StatsWindow::StatsWindow (WindowManager& parWindowManager)
 | 
			
		|||
        { 0, 0 }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager.getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
    for (int i=0; names[i][0]; ++i)
 | 
			
		||||
    {
 | 
			
		||||
        setText (names[i][0], store.gameSettings.find (names[i][1])->str);
 | 
			
		||||
| 
						 | 
				
			
			@ -383,12 +383,12 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
 | 
			
		|||
        float modified = stat.getModified();
 | 
			
		||||
        int progressPercent = (modified - float(static_cast<int>(modified))) * 100;
 | 
			
		||||
 | 
			
		||||
        const ESM::Skill* skill = mWindowManager.getStore().skills.search(skillId);
 | 
			
		||||
        const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId);
 | 
			
		||||
        assert(skill);
 | 
			
		||||
 | 
			
		||||
        std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
 | 
			
		||||
 | 
			
		||||
        const ESM::Attribute* attr = mWindowManager.getStore().attributes.search(skill->data.attribute);
 | 
			
		||||
        const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->data.attribute);
 | 
			
		||||
        assert(attr);
 | 
			
		||||
 | 
			
		||||
        std::string state = "normal";
 | 
			
		||||
| 
						 | 
				
			
			@ -443,7 +443,7 @@ void StatsWindow::updateSkillArea()
 | 
			
		|||
    if (!mMiscSkills.empty())
 | 
			
		||||
        addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);
 | 
			
		||||
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager.getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
 | 
			
		||||
    // race tooltip
 | 
			
		||||
    const ESM::Race* playerRace =  store.races.find (MWBase::Environment::get().getWorld()->getPlayer().getRace());
 | 
			
		||||
| 
						 | 
				
			
			@ -485,8 +485,8 @@ void StatsWindow::updateSkillArea()
 | 
			
		|||
                text += std::string("\n\n#DDC79E#{sNextRank} ") + faction->ranks[it->second+1];
 | 
			
		||||
 | 
			
		||||
                ESM::RankData rankData = faction->data.rankData[it->second+1];
 | 
			
		||||
                const ESM::Attribute* attr1 = mWindowManager.getStore().attributes.search(faction->data.attribute1);
 | 
			
		||||
                const ESM::Attribute* attr2 = mWindowManager.getStore().attributes.search(faction->data.attribute2);
 | 
			
		||||
                const ESM::Attribute* attr1 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute1);
 | 
			
		||||
                const ESM::Attribute* attr2 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute2);
 | 
			
		||||
                assert(attr1 && attr2);
 | 
			
		||||
 | 
			
		||||
                text += "\n#BF9959#{" + attr1->name + "}: " + boost::lexical_cast<std::string>(rankData.attribute1)
 | 
			
		||||
| 
						 | 
				
			
			@ -496,7 +496,7 @@ void StatsWindow::updateSkillArea()
 | 
			
		|||
                text += "\n#BF9959";
 | 
			
		||||
                for (int i=0; i<6; ++i)
 | 
			
		||||
                {
 | 
			
		||||
                    const ESM::Skill* skill = mWindowManager.getStore().skills.search(faction->data.skillID[i]);
 | 
			
		||||
                    const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(faction->data.skillID[i]);
 | 
			
		||||
                    assert(skill);
 | 
			
		||||
                    text += "#{"+ESM::Skill::sSkillNameIds[faction->data.skillID[i]]+"}";
 | 
			
		||||
                    if (i<5)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,14 @@
 | 
			
		|||
#include "widgets.hpp"
 | 
			
		||||
#include "window_manager.hpp"
 | 
			
		||||
#include "components/esm_store/store.hpp"
 | 
			
		||||
 | 
			
		||||
#include <boost/lexical_cast.hpp>
 | 
			
		||||
 | 
			
		||||
#include "components/esm_store/store.hpp"
 | 
			
		||||
 | 
			
		||||
#include "../mwbase/environment.hpp"
 | 
			
		||||
#include "../mwbase/world.hpp"
 | 
			
		||||
 | 
			
		||||
#include "window_manager.hpp"
 | 
			
		||||
 | 
			
		||||
#undef min
 | 
			
		||||
#undef max
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -190,7 +195,7 @@ void MWAttribute::initialiseOverride()
 | 
			
		|||
 | 
			
		||||
    assignWidget(mAttributeNameWidget, "StatName");
 | 
			
		||||
    assignWidget(mAttributeValueWidget, "StatValue");
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    MyGUI::ButtonPtr button;
 | 
			
		||||
    assignWidget(button, "StatNameButton");
 | 
			
		||||
    if (button)
 | 
			
		||||
| 
						 | 
				
			
			@ -224,7 +229,7 @@ void MWSpell::setSpellId(const std::string &spellId)
 | 
			
		|||
 | 
			
		||||
void MWSpell::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord, int flags)
 | 
			
		||||
{
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager->getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
    const ESM::Spell *spell = store.spells.search(mId);
 | 
			
		||||
    MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -255,7 +260,7 @@ void MWSpell::updateWidgets()
 | 
			
		|||
{
 | 
			
		||||
    if (mSpellNameWidget && mWindowManager)
 | 
			
		||||
    {
 | 
			
		||||
        const ESMS::ESMStore &store = mWindowManager->getStore();
 | 
			
		||||
        const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
        const ESM::Spell *spell = store.spells.search(mId);
 | 
			
		||||
        if (spell)
 | 
			
		||||
            static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->name);
 | 
			
		||||
| 
						 | 
				
			
			@ -384,7 +389,7 @@ void MWSpellEffect::updateWidgets()
 | 
			
		|||
    if (!mWindowManager)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    const ESMS::ESMStore &store = mWindowManager->getStore();
 | 
			
		||||
    const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
    const ESM::MagicEffect *magicEffect = store.magicEffects.search(mEffectParams.mEffectID);
 | 
			
		||||
    if (!magicEffect)
 | 
			
		||||
        return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -497,11 +497,6 @@ void WindowManager::onFrame (float frameDuration)
 | 
			
		|||
    mConsole->checkReferenceAvailable();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const ESMS::ESMStore& WindowManager::getStore() const
 | 
			
		||||
{
 | 
			
		||||
    return MWBase::Environment::get().getWorld()->getStore();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
 | 
			
		||||
{
 | 
			
		||||
    if (!(cell->cell->data.flags & ESM::Cell::Interior))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,8 +13,8 @@
 | 
			
		|||
#include <vector>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
#include <components/esm_store/store.hpp>
 | 
			
		||||
#include <components/settings/settings.hpp>
 | 
			
		||||
#include <components/esm/loadclas.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../mwmechanics/stat.hpp"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -201,8 +201,6 @@ namespace MWGui
 | 
			
		|||
     */
 | 
			
		||||
    const std::string &getGameSettingString(const std::string &id, const std::string &default_);
 | 
			
		||||
 | 
			
		||||
    const ESMS::ESMStore& getStore() const;
 | 
			
		||||
 | 
			
		||||
    void processChangedSettings(const Settings::CategorySettingVector& changed);
 | 
			
		||||
 | 
			
		||||
    void executeInConsole (const std::string& path);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,8 @@
 | 
			
		|||
#include <OgreMaterialManager.h>
 | 
			
		||||
#include <OgreHardwarePixelBuffer.h>
 | 
			
		||||
 | 
			
		||||
#include <components/esm_store/store.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../mwbase/environment.hpp"
 | 
			
		||||
#include "../mwbase/world.hpp"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,7 @@
 | 
			
		|||
#include <extern/shiny/Platforms/Ogre/OgrePlatform.hpp>
 | 
			
		||||
 | 
			
		||||
#include <components/esm/loadstat.hpp>
 | 
			
		||||
#include <components/esm_store/store.hpp>
 | 
			
		||||
#include <components/settings/settings.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,6 +5,7 @@
 | 
			
		|||
#include <stdexcept>
 | 
			
		||||
 | 
			
		||||
#include <components/interpreter/types.hpp>
 | 
			
		||||
#include <components/esm_store/store.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../mwbase/environment.hpp"
 | 
			
		||||
#include "../mwbase/world.hpp"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,7 @@
 | 
			
		|||
#include "scene.hpp"
 | 
			
		||||
 | 
			
		||||
#include <components/esm_store/store.hpp>
 | 
			
		||||
 | 
			
		||||
#include "../mwbase/environment.hpp"
 | 
			
		||||
#include "../mwbase/world.hpp" /// FIXME
 | 
			
		||||
#include "../mwbase/soundmanager.hpp"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue