From e628b23da6c57a29fb433af942622038629b3b45 Mon Sep 17 00:00:00 2001 From: greye Date: Mon, 5 Nov 2012 21:45:18 +0400 Subject: [PATCH] applying new interface vol.3, inconsistent --- apps/openmw/mwdialogue/dialoguemanagerimp.cpp | 49 +++++++++++-------- apps/openmw/mwdialogue/journalentry.cpp | 3 +- apps/openmw/mwdialogue/quest.cpp | 9 ++-- apps/openmw/mwsound/soundmanagerimp.cpp | 9 ++-- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 99aab62c4..059c1ce88 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -589,10 +589,14 @@ namespace MWDialogue mCompilerContext.setExtensions (&extensions); mDialogueMap.clear(); mActorKnownTopics.clear(); - MWWorld::RecListCaseT::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; - for(MWWorld::RecListCaseT::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) + + const MWWorld::Store &dialogs = + MWBase::Environment::get().getWorld()->getStore().get(); + + MWWorld::Store::iterator it = dialogs.begin(); + for (; it != dialogs.end(); ++it) { - mDialogueMap[toLower(it->first)] = it->second; + mDialogueMap[toLower(it->mId)] = *it; } } @@ -641,16 +645,17 @@ namespace MWDialogue //greeting bool greetingFound = false; - //MWWorld::RecListT::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; - MWWorld::RecListCaseT::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; - for(MWWorld::RecListCaseT::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) + const MWWorld::Store &dialogs = + MWBase::Environment::get().getWorld()->getStore().get(); + + MWWorld::Store::iterator it = dialogs.begin(); + for (; it != dialogs.end(); ++it) { - ESM::Dialogue ndialogue = it->second; - if(ndialogue.mType == ESM::Dialogue::Greeting) + if(it->mType == ESM::Dialogue::Greeting) { if (greetingFound) break; - for (std::vector::const_iterator iter (it->second.mInfo.begin()); - iter!=it->second.mInfo.end(); ++iter) + for (std::vector::const_iterator iter (it->mInfo.begin()); + iter!=it->mInfo.end(); ++iter) { if (isMatching (actor, *iter) && functionFilter(mActor,*iter,true)) { @@ -664,7 +669,7 @@ namespace MWDialogue win->addText(iter->mResponse); executeScript(iter->mResultScript); greetingFound = true; - mLastTopic = it->first; + mLastTopic = it->mId; mLastDialogue = *iter; break; } @@ -741,22 +746,26 @@ namespace MWDialogue mChoice = -1; mActorKnownTopics.clear(); MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); - MWWorld::RecListCaseT::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; - for(MWWorld::RecListCaseT::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) + + const MWWorld::Store &dialogs = + MWBase::Environment::get().getWorld()->getStore().get(); + + + MWWordl::Store::iterator it = dialogs.begin(); + for (; it != dialogs.end(); ++it) { - ESM::Dialogue ndialogue = it->second; - if(ndialogue.mType == ESM::Dialogue::Topic) + if(it->mType == ESM::Dialogue::Topic) { - for (std::vector::const_iterator iter (it->second.mInfo.begin()); - iter!=it->second.mInfo.end(); ++iter) + for (std::vector::const_iterator iter (it->mInfo.begin()); + iter!=it->mInfo.end(); ++iter) { if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true)) { - mActorKnownTopics.push_back(toLower(it->first)); + mActorKnownTopics.push_back(toLower(it->mId)); //does the player know the topic? - if(mKnownTopics.find(toLower(it->first)) != mKnownTopics.end()) + if(mKnownTopics.find(toLower(it->mId)) != mKnownTopics.end()) { - keywordList.push_back(it->first); + keywordList.push_back(it->mId); break; } } diff --git a/apps/openmw/mwdialogue/journalentry.cpp b/apps/openmw/mwdialogue/journalentry.cpp index fb982d34f..df9129b4d 100644 --- a/apps/openmw/mwdialogue/journalentry.cpp +++ b/apps/openmw/mwdialogue/journalentry.cpp @@ -35,7 +35,8 @@ namespace MWDialogue std::string JournalEntry::idFromIndex (const std::string& topic, int index) { - const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (topic); + const ESM::Dialogue *dialogue = + MWBase::Environment::get().getWorld()->getStore().get().find (topic); for (std::vector::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) diff --git a/apps/openmw/mwdialogue/quest.cpp b/apps/openmw/mwdialogue/quest.cpp index 09feab8f9..5e2739be1 100644 --- a/apps/openmw/mwdialogue/quest.cpp +++ b/apps/openmw/mwdialogue/quest.cpp @@ -18,7 +18,8 @@ namespace MWDialogue const std::string Quest::getName() const { - const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic); + const ESM::Dialogue *dialogue = + MWBase::Environment::get().getWorld()->getStore().get().find (mTopic); for (std::vector::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) @@ -35,7 +36,8 @@ namespace MWDialogue void Quest::setIndex (int index) { - const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic); + const ESM::Dialogue *dialogue = + MWBase::Environment::get().getWorld()->getStore().get().find (mTopic); for (std::vector::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) @@ -63,7 +65,8 @@ namespace MWDialogue { int index = -1; - const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (entry.mTopic); + const ESM::Dialogue *dialogue = + MWBase::Environment::get().getWorld()->getStore().get().find (entry.mTopic); for (std::vector::const_iterator iter (dialogue->mInfo.begin()); iter!=dialogue->mInfo.end(); ++iter) diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 25a373aea..8c4798c9d 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -116,9 +116,8 @@ namespace MWSound std::string SoundManager::lookup(const std::string &soundId, float &volume, float &min, float &max) { - const ESM::Sound *snd = MWBase::Environment::get().getWorld()->getStore().sounds.search(soundId); - if(snd == NULL) - throw std::runtime_error(std::string("Failed to lookup sound ")+soundId); + const ESM::Sound *snd = + MWBase::Environment::get().getWorld()->getStore().get().find(soundId); volume *= pow(10.0, (snd->mData.mVolume/255.0*3348.0 - 3348.0) / 2000.0); @@ -424,7 +423,9 @@ namespace MWSound total = 0; } - const ESM::Region *regn = MWBase::Environment::get().getWorld()->getStore().regions.search(regionName); + const ESM::Region *regn = + MWBase::Environment::get().getWorld()->getStore().get().search(regionName); + if (regn == NULL) return;