From 11567663a736c096b63437b03a29922bc2bf6757 Mon Sep 17 00:00:00 2001 From: greye Date: Mon, 5 Nov 2012 22:34:08 +0400 Subject: [PATCH] applying new interface vol.4, inconsistent --- apps/openmw/mwscript/cellextensions.cpp | 2 +- apps/openmw/mwscript/compilercontext.cpp | 43 +++++++++++---------- apps/openmw/mwscript/guiextensions.cpp | 30 ++++++++++---- apps/openmw/mwscript/interpretercontext.cpp | 12 +++--- apps/openmw/mwscript/statsextensions.cpp | 4 +- apps/openmw/mwworld/store.hpp | 8 ++-- 6 files changed, 58 insertions(+), 41 deletions(-) diff --git a/apps/openmw/mwscript/cellextensions.cpp b/apps/openmw/mwscript/cellextensions.cpp index e2608e7c3..a4a738ca7 100644 --- a/apps/openmw/mwscript/cellextensions.cpp +++ b/apps/openmw/mwscript/cellextensions.cpp @@ -109,7 +109,7 @@ namespace MWScript if (!(cell->mData.mFlags & ESM::Cell::Interior) && current.empty()) { const ESM::Region *region = - MWBase::Environment::get().getWorld()->getStore().regions.find (cell->mRegion); + MWBase::Environment::get().getWorld()->getStore().get().find (cell->mRegion); current = region->mName; } diff --git a/apps/openmw/mwscript/compilercontext.cpp b/apps/openmw/mwscript/compilercontext.cpp index 8756fb633..d568cab21 100644 --- a/apps/openmw/mwscript/compilercontext.cpp +++ b/apps/openmw/mwscript/compilercontext.cpp @@ -42,26 +42,29 @@ namespace MWScript bool CompilerContext::isId (const std::string& name) const { + const MWWorld::ESMStore &store = + MWBase::Environment::get().getWorld()->getStore(); + return - MWBase::Environment::get().getWorld()->getStore().activators.search (name) || - MWBase::Environment::get().getWorld()->getStore().potions.search (name) || - MWBase::Environment::get().getWorld()->getStore().appas.search (name) || - MWBase::Environment::get().getWorld()->getStore().armors.search (name) || - MWBase::Environment::get().getWorld()->getStore().books.search (name) || - MWBase::Environment::get().getWorld()->getStore().clothes.search (name) || - MWBase::Environment::get().getWorld()->getStore().containers.search (name) || - MWBase::Environment::get().getWorld()->getStore().creatures.search (name) || - MWBase::Environment::get().getWorld()->getStore().doors.search (name) || - MWBase::Environment::get().getWorld()->getStore().ingreds.search (name) || - MWBase::Environment::get().getWorld()->getStore().creatureLists.search (name) || - MWBase::Environment::get().getWorld()->getStore().itemLists.search (name) || - MWBase::Environment::get().getWorld()->getStore().lights.search (name) || - MWBase::Environment::get().getWorld()->getStore().lockpicks.search (name) || - MWBase::Environment::get().getWorld()->getStore().miscItems.search (name) || - MWBase::Environment::get().getWorld()->getStore().npcs.search (name) || - MWBase::Environment::get().getWorld()->getStore().probes.search (name) || - MWBase::Environment::get().getWorld()->getStore().repairs.search (name) || - MWBase::Environment::get().getWorld()->getStore().statics.search (name) || - MWBase::Environment::get().getWorld()->getStore().weapons.search (name); + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name) || + store.get().search (name); } } diff --git a/apps/openmw/mwscript/guiextensions.cpp b/apps/openmw/mwscript/guiextensions.cpp index 1eaac5d5f..72c2db164 100644 --- a/apps/openmw/mwscript/guiextensions.cpp +++ b/apps/openmw/mwscript/guiextensions.cpp @@ -108,13 +108,20 @@ namespace MWScript // "Will match complete or partial cells, so ShowMap, "Vivec" will show cells Vivec and Vivec, Fred's House as well." // http://www.uesp.net/wiki/Tes3Mod:ShowMap - const MWWorld::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells; - for (MWWorld::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it) + const MWWorld::Store &cells = + MWBase::Environment::get().getWorld()->getStore().get(); + + MWWorld::Store::iterator it = cells.extBegin(); + for (; it != cells.extEnd(); ++it) { - std::string name = it->second->mName; + std::string name = it->mName; boost::algorithm::to_lower(name); if (name.find(cell) != std::string::npos) - MWBase::Environment::get().getWindowManager()->addVisitedLocation (it->second->mName, it->first.first, it->first.second); + MWBase::Environment::get().getWindowManager()->addVisitedLocation ( + it->mName, + it->getGridX(), + it->getGridY() + ); } } }; @@ -125,12 +132,19 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - const MWWorld::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells; - for (MWWorld::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it) + const MWWorld::Store &cells = + MWBase::Environment::get().getWorld ()->getStore().get(); + + MWWorld::Store::iterator it = cells.extBegin(); + for (; it != cells.extEnd(); ++it) { - std::string name = it->second->mName; + std::string name = it->mName; if (name != "") - MWBase::Environment::get().getWindowManager()->addVisitedLocation (name, it->first.first, it->first.second); + MWBase::Environment::get().getWindowManager()->addVisitedLocation ( + name, + it->getGridX(), + it->getGridY() + ); } } }; diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index d5159eb7d..577ad008f 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -278,7 +278,7 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 's'); ptr.getRefData().setLocals ( - *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); + *MWBase::Environment::get().getWorld()->getStore().get().find (scriptId)); return ptr.getRefData().getLocals().mShorts[index]; } @@ -291,7 +291,7 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 'l'); ptr.getRefData().setLocals ( - *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); + *MWBase::Environment::get().getWorld()->getStore().get().find (scriptId)); return ptr.getRefData().getLocals().mLongs[index]; } @@ -304,7 +304,7 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 'f'); ptr.getRefData().setLocals ( - *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); + *MWBase::Environment::get().getWorld()->getStore().get().find (scriptId)); return ptr.getRefData().getLocals().mFloats[index]; } @@ -317,7 +317,7 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 's'); ptr.getRefData().setLocals ( - *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); + *MWBase::Environment::get().getWorld()->getStore().get().find (scriptId)); ptr.getRefData().getLocals().mShorts[index] = value; } @@ -330,7 +330,7 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 'l'); ptr.getRefData().setLocals ( - *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); + *MWBase::Environment::get().getWorld()->getStore().get().find (scriptId)); ptr.getRefData().getLocals().mLongs[index] = value; } @@ -343,7 +343,7 @@ namespace MWScript int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 'f'); ptr.getRefData().setLocals ( - *MWBase::Environment::get().getWorld()->getStore().scripts.find (scriptId)); + *MWBase::Environment::get().getWorld()->getStore().get().find (scriptId)); ptr.getRefData().getLocals().mFloats[index] = value; } diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 8edad37ee..0c4c6d144 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -328,7 +328,7 @@ namespace MWScript assert (ref); const ESM::Class& class_ = - *MWBase::Environment::get().getWorld()->getStore().classes.find (ref->mBase->mClass); + *MWBase::Environment::get().getWorld()->getStore().get().find (ref->mBase->mClass); float level = 0; float progress = std::modf (stats.getSkill (mIndex).getBase(), &level); @@ -390,7 +390,7 @@ namespace MWScript runtime.pop(); // make sure a spell with this ID actually exists. - MWBase::Environment::get().getWorld()->getStore().spells.find (id); + MWBase::Environment::get().getWorld()->getStore().get().find (id); MWWorld::Class::get (ptr).getCreatureStats (ptr).getSpells().add (id); } diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index 8f88a16a7..af1fae9a7 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -473,19 +473,19 @@ namespace MWWorld } } - iterator interiorsBegin() const { + iterator intBegin() const { return iterator(mSharedInt.begin()); } - iterator interiorsEnd() const { + iterator intEnd() const { return iterator(mSharedInt.end()); } - iterator exteriorsBegin() const { + iterator extBegin() const { return iterator(mSharedExt.begin()); } - iterator exteriorsEnd() const { + iterator extEnd() const { return iterator(mSharedExt.end()); }