diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index 40805c77e..461604b76 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -50,7 +50,7 @@ void GenerateClassResultDialog::setClassId(const std::string &classId) { mCurrentClassId = classId; mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds"); - mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().classes.find(mCurrentClassId)->mName); + mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().get().find(mCurrentClassId)->mName); } // widget controls @@ -187,18 +187,16 @@ void PickClassDialog::updateClasses() const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); - MWWorld::RecListT::MapType::const_iterator it = store.classes.list.begin(); - MWWorld::RecListT::MapType::const_iterator end = store.classes.list.end(); int index = 0; - for (; it != end; ++it) + MWWorld::Store::iterator it = store.get().begin(); + for (; it != store.get().end(); ++it) { - const ESM::Class &klass = it->second; - bool playable = (klass.mData.mIsPlayable != 0); + bool playable = (it->mData.mIsPlayable != 0); if (!playable) // Only display playable classes continue; - const std::string &id = it->first; - mClassList->addItem(klass.mName, id); + const std::string &id = it->mId; + mClassList->addItem(it->mName, id); if (boost::iequals(id, mCurrentClassId)) mClassList->setIndexSelected(index); ++index; @@ -210,7 +208,7 @@ void PickClassDialog::updateStats() if (mCurrentClassId.empty()) return; const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); - const ESM::Class *klass = store.classes.search(mCurrentClassId); + const ESM::Class *klass = store.get().search(mCurrentClassId); if (!klass) return; diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index ff94e5151..db286a7fc 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -127,10 +127,13 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender) if (isInventory()) { + const MWWorld::Store &gmst = + MWWorld::Environment::get().getWorld()->getStore()->get(); + // the player is trying to sell an item, check if the merchant accepts it // also, don't allow selling gold (let's be better than Morrowind at this, can we?) if (!MWBase::Environment::get().getWindowManager()->getTradeWindow()->npcAcceptsItem(object) || - MWWorld::Class::get(object).getName(object) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString()) + MWWorld::Class::get(object).getName(object) == gmst.find("sGold")->getString()) { // user notification "i don't buy this item" MWBase::Environment::get().getWindowManager()-> diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 66cc6b21a..9b4075f57 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -341,7 +341,9 @@ void HUD::onResChange(int width, int height) void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent) { - const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId); + const ESM::Spell* spell = + MWBase::Environment::get().getWorld()->getStore().get().find(spellId); + std::string spellName = spell->mName; if (spellName != mSpellName && mSpellVisible) { @@ -361,7 +363,9 @@ void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent) mSpellBox->setUserString("Spell", spellId); // use the icon of the first effect - const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->mEffects.mList.front().mEffectID); + const ESM::MagicEffect* effect = + MWBase::Environment::get().getWorld()->getStore().get().find(spell->mEffects.mList.front().mEffectID); + std::string icon = effect->mIcon; int slashPos = icon.find("\\"); icon.insert(slashPos+1, "b_"); diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp index afb4bb621..399ff74a3 100644 --- a/apps/openmw/mwgui/levelupdialog.cpp +++ b/apps/openmw/mwgui/levelupdialog.cpp @@ -123,11 +123,14 @@ namespace MWGui const ESM::Class& playerClass = MWBase::Environment::get().getWorld ()->getPlayer ().getClass (); // retrieve the ID to this class std::string classId; - std::map list = MWBase::Environment::get().getWorld()->getStore ().classes.list; - for (std::map::iterator it = list.begin(); it != list.end(); ++it) + const MWWorld::Store &classes = + MWBase::Environment::get().getWorld()->getStore().get(); + + MWWorld::Store::iterator it = classes.begin(); + for (; it != classes.end(); ++it) { - if (playerClass.mName == it->second.mName) - classId = it->first; + if (playerClass.mName == it->mName) + classId = it->mId; } mClassImage->setImageTexture ("textures\\levelup\\" + classId + ".dds"); diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index 6c45d2b3d..32b7f934b 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -28,8 +28,11 @@ namespace bool sortMagicEffects (short id1, short id2) { - return MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find(ESM::MagicEffect::effectIdToString (id1))->getString() - < MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find(ESM::MagicEffect::effectIdToString (id2))->getString(); + const MWWorld::Store &gmst = + MWBase::Environment::get().getWorld()->getStore().get(); + + return gmst.find(ESM::MagicEffect::effectIdToString (id1))->getString() + < gmst.find(ESM::MagicEffect::effectIdToString (id2))->getString(); } } @@ -105,7 +108,8 @@ namespace MWGui void EditEffectDialog::editEffect (ESM::ENAMstruct effect) { - const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(effect.mEffectID); + const ESM::MagicEffect* magicEffect = + MWBase::Environment::get().getWorld()->getStore().get().find(effect.mEffectID); setMagicEffect(magicEffect); @@ -358,16 +362,23 @@ namespace MWGui { float y = 0; + const MWWorld::ESMStore &store = + MWBase::Environment::get().getWorld()->getStore(); + for (std::vector::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it) { float x = 0.5 * it->mMagnMin + it->mMagnMax; - const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(it->mEffectID); + const ESM::MagicEffect* effect = + store.get().find(it->mEffectID); + x *= 0.1 * effect->mData.mBaseCost; x *= 1 + it->mDuration; x += 0.05 * std::max(1, it->mArea) * effect->mData.mBaseCost; - float fEffectCostMult = MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fEffectCostMult")->getFloat(); + float fEffectCostMult = + store.get().find("fEffectCostMult")->getFloat(); + y += x * fEffectCostMult; y = std::max(1.f,y); @@ -384,7 +395,8 @@ namespace MWGui mMagickaCost->setCaption(boost::lexical_cast(int(y))); - float fSpellMakingValueMult = MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fSpellMakingValueMult")->getFloat(); + float fSpellMakingValueMult = + store.get().find("fSpellMakingValueMult")->getFloat(); /// \todo mercantile int price = int(y) * fSpellMakingValueMult; @@ -422,7 +434,8 @@ namespace MWGui for (MWMechanics::Spells::TIterator it = spells.begin(); it != spells.end(); ++it) { - const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it); + const ESM::Spell* spell = + MWBase::Environment::get().getWorld()->getStore().get().find(*it); // only normal spells count if (spell->mData.mType != ESM::Spell::ST_Spell) @@ -442,14 +455,14 @@ namespace MWGui for (std::vector::const_iterator it = knownEffects.begin(); it != knownEffects.end(); ++it) { - mAvailableEffectsList->addItem(MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find( + mAvailableEffectsList->addItem(MWBase::Environment::get().getWorld ()->getStore ().get().find( ESM::MagicEffect::effectIdToString (*it))->getString()); } mAvailableEffectsList->adjustSize (); for (std::vector::const_iterator it = knownEffects.begin(); it != knownEffects.end(); ++it) { - std::string name = MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find( + std::string name = MWBase::Environment::get().getWorld ()->getStore ().get().find( ESM::MagicEffect::effectIdToString (*it))->getString(); MyGUI::Widget* w = mAvailableEffectsList->getItemWidget(name); w->setUserData(*it); @@ -515,7 +528,8 @@ namespace MWGui } } - const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(effectId); + const ESM::MagicEffect* effect = + MWBase::Environment::get().getWorld()->getStore().get().find(effectId); mAddEffectDialog.newEffect (effect);