with mutable, without World and ESMStore interface change

pull/3225/head
myrix 3 years ago
parent 9c7835e27f
commit 88fc038ceb

@ -87,11 +87,6 @@ namespace MWWorld
typedef std::vector<std::pair<MWWorld::Ptr,MWMechanics::Movement> > PtrMovementList;
}
namespace MWDialogue
{
template <typename string_t, typename value_t> class KeywordSearch;
}
namespace MWBase
{
/// \brief Interface for the World (implemented in MWWorld)
@ -155,7 +150,6 @@ namespace MWBase
virtual MWWorld::ConstPtr getPlayerConstPtr() const = 0;
virtual const MWWorld::ESMStore& getStore() const = 0;
virtual const MWDialogue::KeywordSearch<std::string, int>& getDialogIdKeywordSearch() = 0;
virtual std::vector<ESM::ESMReader>& getEsmReader() = 0;

@ -48,7 +48,7 @@ namespace MWDialogue
void tokenizeKeywords(const std::string & text, std::vector<Token> & tokens)
{
const auto& keywordSearch =
MWBase::Environment::get().getWorld()->getDialogIdKeywordSearch();
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().getDialogIdKeywordSearch();
std::vector<KeywordSearch<std::string, int /*unused*/>::Match> matches;
keywordSearch.highlightKeywords(text.begin(), text.end(), matches);

@ -284,9 +284,6 @@ namespace MWWorld
/// Actors with the same ID share spells, abilities, etc.
/// @return The shared spell list to use for this actor and whether or not it has already been initialized.
std::pair<std::shared_ptr<MWMechanics::SpellList>, bool> getSpellList(const std::string& id) const;
const MWDialogue::KeywordSearch<std::string, int>& getDialogIdKeywordSearch() {
return mDialogs.getDialogIdKeywordSearch(); }
};
template <>

@ -1072,7 +1072,7 @@ namespace MWWorld
return true;
}
const MWDialogue::KeywordSearch<std::string, int>& Store<ESM::Dialogue>::getDialogIdKeywordSearch()
const MWDialogue::KeywordSearch<std::string, int>& Store<ESM::Dialogue>::getDialogIdKeywordSearch() const
{
if (mKeywordSearchModFlag)
{

@ -452,8 +452,8 @@ namespace MWWorld
/// @warning ESM::Dialogue Store currently implements a sorted order for unknown reasons.
std::vector<ESM::Dialogue*> mShared;
bool mKeywordSearchModFlag;
MWDialogue::KeywordSearch<std::string, int /*unused*/> mKeywordSearch;
mutable bool mKeywordSearchModFlag;
mutable MWDialogue::KeywordSearch<std::string, int /*unused*/> mKeywordSearch;
public:
Store();
@ -474,7 +474,7 @@ namespace MWWorld
RecordId load(ESM::ESMReader &esm) override;
const MWDialogue::KeywordSearch<std::string, int>& getDialogIdKeywordSearch();
const MWDialogue::KeywordSearch<std::string, int>& getDialogIdKeywordSearch() const;
};
} //end namespace

@ -236,9 +236,6 @@ namespace MWWorld
const MWWorld::ESMStore& getStore() const override;
const MWDialogue::KeywordSearch<std::string, int>& getDialogIdKeywordSearch() override {
return mStore.getDialogIdKeywordSearch(); }
std::vector<ESM::ESMReader>& getEsmReader() override;
LocalScripts& getLocalScripts() override;

Loading…
Cancel
Save