move ESMStore to MWWorld

actorid
greye 12 years ago
parent f0a3ee0ef9
commit 2057f5619e

@ -53,6 +53,7 @@ add_openmw_dir (mwworld
containerstore actiontalk actiontake manualref player cellfunctors containerstore actiontalk actiontake manualref player cellfunctors
cells localscripts customdata weather inventorystore ptr actionopen actionread cells localscripts customdata weather inventorystore ptr actionopen actionread
actionequip timestamp actionalchemy cellstore actionapply actioneat actionequip timestamp actionalchemy cellstore actionapply actioneat
esmstore reclists
) )
add_openmw_dir (mwclass add_openmw_dir (mwclass

@ -31,11 +31,6 @@ namespace ESM
struct Spell; struct Spell;
} }
namespace ESMS
{
struct ESMStore;
}
namespace MWRender namespace MWRender
{ {
class ExternalRendering; class ExternalRendering;
@ -48,6 +43,7 @@ namespace MWWorld
class LocalScripts; class LocalScripts;
class Ptr; class Ptr;
class TimeStamp; class TimeStamp;
class ESMStore;
} }
namespace MWBase namespace MWBase
@ -104,7 +100,7 @@ namespace MWBase
virtual MWWorld::Player& getPlayer() = 0; virtual MWWorld::Player& getPlayer() = 0;
virtual const ESMS::ESMStore& getStore() const = 0; virtual const MWWorld::ESMStore& getStore() const = 0;
virtual ESM::ESMReader& getEsmReader() = 0; virtual ESM::ESMReader& getEsmReader() = 0;

@ -205,7 +205,7 @@ namespace MWClass
std::string text; std::string text;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
if (ref->ref.mTeleport) if (ref->ref.mTeleport)
{ {

@ -143,7 +143,7 @@ namespace MWClass
MWGui::ToolTipInfo info; MWGui::ToolTipInfo info;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
int count = ptr.getRefData().getCount(); int count = ptr.getRefData().getCount();
@ -189,7 +189,7 @@ namespace MWClass
{ {
MWWorld::Ptr newPtr; MWWorld::Ptr newPtr;
const ESMS::ESMStore &store = const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore(); MWBase::Environment::get().getWorld()->getStore();
if (MWWorld::Class::get(ptr).getName(ptr) == store.gameSettings.find("sGold")->getString()) { if (MWWorld::Class::get(ptr).getName(ptr) == store.gameSettings.find("sGold")->getString()) {

@ -277,7 +277,7 @@ namespace MWClass
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount()); info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon; info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string text; std::string text;

@ -7,8 +7,6 @@
#include <components/esm/loaddial.hpp> #include <components/esm/loaddial.hpp>
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/scriptmanager.hpp" #include "../mwbase/scriptmanager.hpp"
@ -19,6 +17,7 @@
#include "../mwworld/refdata.hpp" #include "../mwworld/refdata.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwgui/dialogue.hpp" #include "../mwgui/dialogue.hpp"
@ -84,7 +83,7 @@ namespace
template<typename T> template<typename T>
bool checkLocal (char comp, const std::string& name, T value, const MWWorld::Ptr& actor, bool checkLocal (char comp, const std::string& name, T value, const MWWorld::Ptr& actor,
const ESMS::ESMStore& store) const MWWorld::ESMStore& store)
{ {
std::string scriptName = MWWorld::Class::get (actor).getScript (actor); std::string scriptName = MWWorld::Class::get (actor).getScript (actor);
@ -590,8 +589,8 @@ namespace MWDialogue
mCompilerContext.setExtensions (&extensions); mCompilerContext.setExtensions (&extensions);
mDialogueMap.clear(); mDialogueMap.clear();
mActorKnownTopics.clear(); mActorKnownTopics.clear();
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; MWWorld::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) for(MWWorld::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
{ {
mDialogueMap[toLower(it->first)] = it->second; mDialogueMap[toLower(it->first)] = it->second;
} }
@ -642,9 +641,9 @@ namespace MWDialogue
//greeting //greeting
bool greetingFound = false; bool greetingFound = false;
//ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; //MWWorld::RecListT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; MWWorld::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) for(MWWorld::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
{ {
ESM::Dialogue ndialogue = it->second; ESM::Dialogue ndialogue = it->second;
if(ndialogue.mType == ESM::Dialogue::Greeting) if(ndialogue.mType == ESM::Dialogue::Greeting)
@ -742,8 +741,8 @@ namespace MWDialogue
mChoice = -1; mChoice = -1;
mActorKnownTopics.clear(); mActorKnownTopics.clear();
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list; MWWorld::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++) for(MWWorld::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
{ {
ESM::Dialogue ndialogue = it->second; ESM::Dialogue ndialogue = it->second;
if(ndialogue.mType == ESM::Dialogue::Topic) if(ndialogue.mType == ESM::Dialogue::Topic)

@ -3,11 +3,11 @@
#include <stdexcept> #include <stdexcept>
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/esmstore.hpp"
namespace MWDialogue namespace MWDialogue
{ {
JournalEntry::JournalEntry() {} JournalEntry::JournalEntry() {}
@ -16,7 +16,7 @@ namespace MWDialogue
: mTopic (topic), mInfoId (infoId) : mTopic (topic), mInfoId (infoId)
{} {}
std::string JournalEntry::getText (const ESMS::ESMStore& store) const std::string JournalEntry::getText (const MWWorld::ESMStore& store) const
{ {
const ESM::Dialogue *dialogue = store.dialogs.find (mTopic); const ESM::Dialogue *dialogue = store.dialogs.find (mTopic);

@ -3,7 +3,7 @@
#include <string> #include <string>
namespace ESMS namespace MWWorld
{ {
struct ESMStore; struct ESMStore;
} }
@ -20,7 +20,7 @@ namespace MWDialogue
JournalEntry (const std::string& topic, const std::string& infoId); JournalEntry (const std::string& topic, const std::string& infoId);
std::string getText (const ESMS::ESMStore& store) const; std::string getText (const MWWorld::ESMStore& store) const;
static JournalEntry makeFromQuest (const std::string& topic, int index); static JournalEntry makeFromQuest (const std::string& topic, int index);

@ -1,7 +1,7 @@
#include "journalimp.hpp" #include "journalimp.hpp"
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -1,7 +1,7 @@
#include "quest.hpp" #include "quest.hpp"
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -1,7 +1,7 @@
#include "topic.hpp" #include "topic.hpp"
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
namespace MWDialogue namespace MWDialogue
{ {

@ -3,7 +3,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "components/esm_store/store.hpp" #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -130,10 +130,10 @@ void BirthDialog::updateBirths()
{ {
mBirthList->removeAllItems(); mBirthList->removeAllItems();
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator it = store.birthSigns.list.begin(); MWWorld::RecListT<ESM::BirthSign>::MapType::const_iterator it = store.birthSigns.list.begin();
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator end = store.birthSigns.list.end(); MWWorld::RecListT<ESM::BirthSign>::MapType::const_iterator end = store.birthSigns.list.end();
int index = 0; int index = 0;
// sort by name // sort by name
@ -170,7 +170,7 @@ void BirthDialog::updateSpells()
const int lineHeight = 18; const int lineHeight = 18;
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18); MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18);
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::BirthSign *birth = store.birthSigns.find(mCurrentBirthId); const ESM::BirthSign *birth = store.birthSigns.find(mCurrentBirthId);
std::string texturePath = std::string("textures\\") + birth->mTexture; std::string texturePath = std::string("textures\\") + birth->mTexture;

@ -1,7 +1,7 @@
#ifndef CHARACTER_CREATION_HPP #ifndef CHARACTER_CREATION_HPP
#define CHARACTER_CREATION_HPP #define CHARACTER_CREATION_HPP
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"

@ -5,7 +5,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -185,10 +185,10 @@ void PickClassDialog::updateClasses()
{ {
mClassList->removeAllItems(); mClassList->removeAllItems();
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
ESMS::RecListT<ESM::Class>::MapType::const_iterator it = store.classes.list.begin(); MWWorld::RecListT<ESM::Class>::MapType::const_iterator it = store.classes.list.begin();
ESMS::RecListT<ESM::Class>::MapType::const_iterator end = store.classes.list.end(); MWWorld::RecListT<ESM::Class>::MapType::const_iterator end = store.classes.list.end();
int index = 0; int index = 0;
for (; it != end; ++it) for (; it != end; ++it)
{ {
@ -209,7 +209,7 @@ void PickClassDialog::updateStats()
{ {
if (mCurrentClassId.empty()) if (mCurrentClassId.empty())
return; return;
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Class *klass = store.classes.search(mCurrentClassId); const ESM::Class *klass = store.classes.search(mCurrentClassId);
if (!klass) if (!klass)
return; return;

@ -4,11 +4,10 @@
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
#include <components/esm_store/reclists.hpp>
#include <components/esm_store/store.hpp>
#include <components/compiler/exception.hpp> #include <components/compiler/exception.hpp>
#include "../mwworld/esmstore.hpp"
#include "../mwscript/extensions.hpp" #include "../mwscript/extensions.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -93,9 +92,9 @@ namespace MWGui
scanner.listKeywords (mNames); scanner.listKeywords (mNames);
// identifier // identifier
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
for (ESMS::RecListList::const_iterator iter (store.recLists.begin()); for (MWWorld::RecListList::const_iterator iter (store.recLists.begin());
iter!=store.recLists.end(); ++iter) iter!=store.recLists.end(); ++iter)
{ {
iter->second->listIdentifier (mNames); iter->second->listIdentifier (mNames);

@ -1,7 +1,7 @@
#ifndef MGUI_CONTAINER_H #ifndef MGUI_CONTAINER_H
#define MGUI_CONTAINER_H #define MGUI_CONTAINER_H
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "window_base.hpp" #include "window_base.hpp"
#include "referenceinterface.hpp" #include "referenceinterface.hpp"

@ -6,7 +6,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/dialoguemanager.hpp" #include "../mwbase/dialoguemanager.hpp"

@ -3,7 +3,8 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "widgets.hpp" #include "widgets.hpp"
#include "components/esm_store/store.hpp"
#include "../mwworld/esmstore.hpp"
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>

@ -8,14 +8,12 @@
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/stat.hpp" #include "../mwmechanics/stat.hpp"
#include <components/esm_store/reclists.hpp>
#include <components/esm_store/store.hpp>
namespace MWGui namespace MWGui
{ {

@ -6,7 +6,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -224,10 +224,10 @@ void RaceDialog::updateRaces()
{ {
mRaceList->removeAllItems(); mRaceList->removeAllItems();
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
ESMS::RecListT<ESM::Race>::MapType::const_iterator it = store.races.list.begin(); MWWorld::RecListT<ESM::Race>::MapType::const_iterator it = store.races.list.begin();
ESMS::RecListT<ESM::Race>::MapType::const_iterator end = store.races.list.end(); MWWorld::RecListT<ESM::Race>::MapType::const_iterator end = store.races.list.end();
int index = 0; int index = 0;
for (; it != end; ++it) for (; it != end; ++it)
{ {
@ -258,7 +258,7 @@ void RaceDialog::updateSkills()
const int lineHeight = 18; const int lineHeight = 18;
MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18); MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18);
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(mCurrentRaceId); const ESM::Race *race = store.races.find(mCurrentRaceId);
int count = sizeof(race->mData.mBonus)/sizeof(race->mData.mBonus[0]); // TODO: Find a portable macro for this ARRAYSIZE? int count = sizeof(race->mData.mBonus)/sizeof(race->mData.mBonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
@ -296,7 +296,7 @@ void RaceDialog::updateSpellPowers()
const int lineHeight = 18; const int lineHeight = 18;
MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18); MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18);
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(mCurrentRaceId); const ESM::Race *race = store.races.find(mCurrentRaceId);
std::vector<std::string>::const_iterator it = race->mPowers.mList.begin(); std::vector<std::string>::const_iterator it = race->mPowers.mList.begin();

@ -4,7 +4,7 @@
#include <boost/array.hpp> #include <boost/array.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwrender/characterpreview.hpp" #include "../mwrender/characterpreview.hpp"

@ -5,7 +5,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -281,7 +281,7 @@ void ReviewDialog::addSkills(const SkillList &skills, const std::string &titleId
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
continue; continue;
assert(skillId >= 0 && skillId < ESM::Skill::Length); assert(skillId >= 0 && skillId < ESM::Skill::Length);
const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId]; const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
const MWMechanics::Stat<float> &stat = mSkillValues.find(skillId)->second; const MWMechanics::Stat<float> &stat = mSkillValues.find(skillId)->second;
float base = stat.getBase(); float base = stat.getBase();
float modified = stat.getModified(); float modified = stat.getModified();

@ -4,7 +4,7 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"

@ -54,7 +54,7 @@ StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
{ 0, 0 } { 0, 0 }
}; };
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
for (int i=0; names[i][0]; ++i) for (int i=0; names[i][0]; ++i)
{ {
setText (names[i][0], store.gameSettings.find (names[i][1])->getString()); setText (names[i][0], store.gameSettings.find (names[i][1])->getString());
@ -357,7 +357,7 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
continue; continue;
assert(skillId >= 0 && skillId < ESM::Skill::Length); assert(skillId >= 0 && skillId < ESM::Skill::Length);
const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId]; const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
const MWMechanics::Stat<float> &stat = mSkillValues.find(skillId)->second; const MWMechanics::Stat<float> &stat = mSkillValues.find(skillId)->second;
float base = stat.getBase(); float base = stat.getBase();
float modified = stat.getModified(); float modified = stat.getModified();
@ -422,7 +422,7 @@ void StatsWindow::updateSkillArea()
if (!mMiscSkills.empty()) if (!mMiscSkills.empty())
addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2); addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
// race tooltip // race tooltip
const ESM::Race* playerRace = store.races.find (MWBase::Environment::get().getWorld()->getPlayer().getRace()); const ESM::Race* playerRace = store.races.find (MWBase::Environment::get().getWorld()->getPlayer().getRace());

@ -1,7 +1,7 @@
#ifndef MWGUI_STATS_WINDOW_H #ifndef MWGUI_STATS_WINDOW_H
#define MWGUI_STATS_WINDOW_H #define MWGUI_STATS_WINDOW_H
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <sstream> #include <sstream>
#include <set> #include <set>

@ -365,7 +365,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
text.erase(0, 1); text.erase(0, 1);
const ESM::Enchantment* enchant = 0; const ESM::Enchantment* enchant = 0;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
if (info.enchant != "") if (info.enchant != "")
{ {
enchant = store.enchants.search(info.enchant); enchant = store.enchants.search(info.enchant);
@ -571,7 +571,7 @@ void ToolTips::createSkillToolTip(MyGUI::Widget* widget, int skillId)
if (skillId == -1) if (skillId == -1)
return; return;
const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId]; const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId); const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId);
assert(skill); assert(skill);
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute); const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute);

@ -2,12 +2,12 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "components/esm_store/store.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwworld/esmstore.hpp"
#undef min #undef min
#undef max #undef max
@ -228,7 +228,7 @@ void MWSpell::setSpellId(const std::string &spellId)
void MWSpell::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord, int flags) void MWSpell::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord, int flags)
{ {
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Spell *spell = store.spells.search(mId); const ESM::Spell *spell = store.spells.search(mId);
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found"); MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
@ -259,7 +259,7 @@ void MWSpell::updateWidgets()
{ {
if (mSpellNameWidget && mWindowManager) if (mSpellNameWidget && mWindowManager)
{ {
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Spell *spell = store.spells.search(mId); const ESM::Spell *spell = store.spells.search(mId);
if (spell) if (spell)
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->mName); static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->mName);
@ -386,7 +386,10 @@ void MWSpellEffect::setSpellEffect(const SpellEffectParams& params)
void MWSpellEffect::updateWidgets() void MWSpellEffect::updateWidgets()
{ {
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); if (!mWindowManager)
return;
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::MagicEffect *magicEffect = store.magicEffects.search(mEffectParams.mEffectID); const ESM::MagicEffect *magicEffect = store.magicEffects.search(mEffectParams.mEffectID);
assert(magicEffect); assert(magicEffect);

@ -1,7 +1,7 @@
#ifndef MWGUI_WIDGETS_H #ifndef MWGUI_WIDGETS_H
#define MWGUI_WIDGETS_H #define MWGUI_WIDGETS_H
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <MyGUI.h> #include <MyGUI.h>

@ -9,7 +9,7 @@
#include <components/esm/loadmgef.hpp> #include <components/esm/loadmgef.hpp>
#include <components/esm/loadskil.hpp> #include <components/esm/loadskil.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -7,7 +7,7 @@
#include <components/esm/loadnpc.hpp> #include <components/esm/loadnpc.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
@ -101,7 +101,7 @@ namespace MWMechanics
health.setCurrent (health.getCurrent() + 0.1 * endurance); health.setCurrent (health.getCurrent() + 0.1 * endurance);
stats.setHealth (health); stats.setHealth (health);
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
float fFatigueReturnBase = store.gameSettings.find("fFatigueReturnBase")->getFloat (); float fFatigueReturnBase = store.gameSettings.find("fFatigueReturnBase")->getFloat ();
float fFatigueReturnMult = store.gameSettings.find("fFatigueReturnMult")->getFloat (); float fFatigueReturnMult = store.gameSettings.find("fFatigueReturnMult")->getFloat ();

@ -2,7 +2,7 @@
#include <algorithm> #include <algorithm>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -41,7 +41,7 @@ namespace MWMechanics
float normalised = max==0 ? 1 : std::max (0.0f, static_cast<float> (current)/max); float normalised = max==0 ? 1 : std::max (0.0f, static_cast<float> (current)/max);
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
return store.gameSettings.find ("fFatigueBase")->getFloat() return store.gameSettings.find ("fFatigueBase")->getFloat()
- store.gameSettings.find ("fFatigueMult")->getFloat() * (1-normalised); - store.gameSettings.find ("fFatigueMult")->getFloat() * (1-normalised);

@ -1,7 +1,7 @@
#include "mechanicsmanagerimp.hpp" #include "mechanicsmanagerimp.hpp"
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -132,7 +132,7 @@ namespace MWMechanics
} }
} }
typedef ESMS::IndexListT<ESM::Skill>::MapType ContainerType; typedef MWWorld::IndexListT<ESM::Skill>::MapType ContainerType;
const ContainerType& skills = MWBase::Environment::get().getWorld()->getStore().skills.list; const ContainerType& skills = MWBase::Environment::get().getWorld()->getStore().skills.list;
for (ContainerType::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter) for (ContainerType::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter)

@ -10,7 +10,7 @@
#include <components/esm/loadclas.hpp> #include <components/esm/loadclas.hpp>
#include <components/esm/loadgmst.hpp> #include <components/esm/loadgmst.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -1,7 +1,7 @@
#include "spells.hpp" #include "spells.hpp"
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <components/esm/loadspel.hpp> #include <components/esm/loadspel.hpp>

@ -8,7 +8,7 @@
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "npcstats.hpp" #include "npcstats.hpp"

@ -11,7 +11,7 @@
#include <components/esm/loadstat.hpp> #include <components/esm/loadstat.hpp>
#include <components/esm/loadpgrd.hpp> #include <components/esm/loadpgrd.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone #include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"

@ -11,8 +11,7 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <components/esm_store/reclists.hpp>
namespace MWRender namespace MWRender
{ {
@ -30,8 +29,8 @@ namespace MWRender
Ogre::TexturePtr tex; Ogre::TexturePtr tex;
// get the size of the world // get the size of the world
const ESMS::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells; const MWWorld::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells;
for (ESMS::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it) for (MWWorld::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it)
{ {
if (it->first.first < mMinX) if (it->first.first < mMinX)
mMinX = it->first.first; mMinX = it->first.first;

@ -4,7 +4,7 @@
#include <OgreMaterialManager.h> #include <OgreMaterialManager.h>
#include <OgreHardwarePixelBuffer.h> #include <OgreHardwarePixelBuffer.h>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -4,7 +4,7 @@
#include <OgreEntity.h> #include <OgreEntity.h>
#include <OgreSubEntity.h> #include <OgreSubEntity.h>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -62,7 +62,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
mPartPriorities[init] = 0; mPartPriorities[init] = 0;
} }
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(ref->base->mRace); const ESM::Race *race = store.races.find(ref->base->mRace);
std::string hairID = ref->base->mHair; std::string hairID = ref->base->mHair;
@ -322,7 +322,7 @@ void NpcAnimation::updateParts()
{ ESM::PRT_Tail, { "tail", "" } } { ESM::PRT_Tail, { "tail", "" } }
}; };
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
for(size_t i = 0;i < sizeof(PartTypeList)/sizeof(PartTypeList[0]);i++) for(size_t i = 0;i < sizeof(PartTypeList)/sizeof(PartTypeList[0]);i++)
{ {
if(mPartPriorities[PartTypeList[i].type] < 1) if(mPartPriorities[PartTypeList[i].type] < 1)

@ -18,7 +18,7 @@
#include <extern/shiny/Platforms/Ogre/OgrePlatform.hpp> #include <extern/shiny/Platforms/Ogre/OgrePlatform.hpp>
#include <components/esm/loadstat.hpp> #include <components/esm/loadstat.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone #include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone

@ -4,7 +4,7 @@
#include <OgreTerrainGroup.h> #include <OgreTerrainGroup.h>
#include <OgreHardwarePixelBuffer.h> #include <OgreHardwarePixelBuffer.h>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>

@ -1,7 +1,7 @@
#include "cellextensions.hpp" #include "cellextensions.hpp"
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <components/compiler/extensions.hpp> #include <components/compiler/extensions.hpp>

@ -1,7 +1,7 @@
#include "compilercontext.hpp" #include "compilercontext.hpp"
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <components/compiler/locals.hpp> #include <components/compiler/locals.hpp>

@ -3,8 +3,7 @@
#include <cassert> #include <cassert>
#include <components/esm_store/reclists.hpp> #include "../mwworld/esmstore.hpp"
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/scriptmanager.hpp" #include "../mwbase/scriptmanager.hpp"
@ -13,12 +12,12 @@
namespace MWScript namespace MWScript
{ {
GlobalScripts::GlobalScripts (const ESMS::ESMStore& store) GlobalScripts::GlobalScripts (const MWWorld::ESMStore& store)
: mStore (store) : mStore (store)
{ {
addScript ("Main"); addScript ("Main");
for (ESMS::RecListT<ESM::StartScript>::MapType::const_iterator iter for (MWWorld::RecListT<ESM::StartScript>::MapType::const_iterator iter
(store.startScripts.list.begin()); (store.startScripts.list.begin());
iter != store.startScripts.list.end(); ++iter) iter != store.startScripts.list.end(); ++iter)
addScript (iter->second.mScript); addScript (iter->second.mScript);

@ -6,7 +6,7 @@
#include "locals.hpp" #include "locals.hpp"
namespace ESMS namespace MWWorld
{ {
struct ESMStore; struct ESMStore;
} }
@ -15,12 +15,12 @@ namespace MWScript
{ {
class GlobalScripts class GlobalScripts
{ {
const ESMS::ESMStore& mStore; const MWWorld::ESMStore& mStore;
std::map<std::string, std::pair<bool, Locals> > mScripts; // running, local variables std::map<std::string, std::pair<bool, Locals> > mScripts; // running, local variables
public: public:
GlobalScripts (const ESMS::ESMStore& store); GlobalScripts (const MWWorld::ESMStore& store);
void addScript (const std::string& name); void addScript (const std::string& name);

@ -9,8 +9,7 @@
#include <components/interpreter/runtime.hpp> #include <components/interpreter/runtime.hpp>
#include <components/interpreter/opcodes.hpp> #include <components/interpreter/opcodes.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <components/esm_store/reclists.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
@ -109,8 +108,8 @@ namespace MWScript
// "Will match complete or partial cells, so ShowMap, "Vivec" will show cells Vivec and Vivec, Fred's House as well." // "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 // http://www.uesp.net/wiki/Tes3Mod:ShowMap
const ESMS::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells; const MWWorld::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells;
for (ESMS::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it) for (MWWorld::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it)
{ {
std::string name = it->second->mName; std::string name = it->second->mName;
boost::algorithm::to_lower(name); boost::algorithm::to_lower(name);
@ -126,8 +125,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime) virtual void execute (Interpreter::Runtime& runtime)
{ {
const ESMS::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells; const MWWorld::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells;
for (ESMS::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it) for (MWWorld::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it)
{ {
std::string name = it->second->mName; std::string name = it->second->mName;
if (name != "") if (name != "")

@ -5,7 +5,7 @@
#include <stdexcept> #include <stdexcept>
#include <components/interpreter/types.hpp> #include <components/interpreter/types.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -7,7 +7,7 @@
#include <exception> #include <exception>
#include <components/esm/loadscpt.hpp> #include <components/esm/loadscpt.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <components/compiler/scanner.hpp> #include <components/compiler/scanner.hpp>
#include <components/compiler/context.hpp> #include <components/compiler/context.hpp>
@ -17,7 +17,7 @@
namespace MWScript namespace MWScript
{ {
ScriptManager::ScriptManager (const ESMS::ESMStore& store, bool verbose, ScriptManager::ScriptManager (const MWWorld::ESMStore& store, bool verbose,
Compiler::Context& compilerContext) Compiler::Context& compilerContext)
: mErrorHandler (std::cerr), mStore (store), mVerbose (verbose), : mErrorHandler (std::cerr), mStore (store), mVerbose (verbose),
mCompilerContext (compilerContext), mParser (mErrorHandler, mCompilerContext), mCompilerContext (compilerContext), mParser (mErrorHandler, mCompilerContext),
@ -125,7 +125,7 @@ namespace MWScript
std::pair<int, int> ScriptManager::compileAll() std::pair<int, int> ScriptManager::compileAll()
{ {
typedef ESMS::ScriptListT<ESM::Script>::MapType Container; typedef MWWorld::ScriptListT<ESM::Script>::MapType Container;
const Container& scripts = mStore.scripts.list; const Container& scripts = mStore.scripts.list;

@ -14,7 +14,7 @@
#include "globalscripts.hpp" #include "globalscripts.hpp"
namespace ESMS namespace MWWorld
{ {
struct ESMStore; struct ESMStore;
} }
@ -35,7 +35,7 @@ namespace MWScript
class ScriptManager : public MWBase::ScriptManager class ScriptManager : public MWBase::ScriptManager
{ {
Compiler::StreamErrorHandler mErrorHandler; Compiler::StreamErrorHandler mErrorHandler;
const ESMS::ESMStore& mStore; const MWWorld::ESMStore& mStore;
bool mVerbose; bool mVerbose;
Compiler::Context& mCompilerContext; Compiler::Context& mCompilerContext;
Compiler::FileParser mParser; Compiler::FileParser mParser;
@ -50,7 +50,7 @@ namespace MWScript
public: public:
ScriptManager (const ESMS::ESMStore& store, bool verbose, ScriptManager (const MWWorld::ESMStore& store, bool verbose,
Compiler::Context& compilerContext); Compiler::Context& compilerContext);
virtual void run (const std::string& name, Interpreter::Context& interpreterContext); virtual void run (const std::string& name, Interpreter::Context& interpreterContext);

@ -7,7 +7,7 @@
#include <components/esm/loadnpc.hpp> #include <components/esm/loadnpc.hpp>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <components/compiler/extensions.hpp> #include <components/compiler/extensions.hpp>

@ -3,7 +3,7 @@
#include <OgreMath.h> #include <OgreMath.h>
#include <OgreSceneNode.h> #include <OgreSceneNode.h>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include <components/esm/loadcell.hpp> #include <components/esm/loadcell.hpp>
#include <components/compiler/extensions.hpp> #include <components/compiler/extensions.hpp>

@ -4,7 +4,7 @@
#include <algorithm> #include <algorithm>
#include <map> #include <map>
#include <components/esm_store/store.hpp> #include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"

@ -5,14 +5,13 @@
#include <components/esm/loadskil.hpp> #include <components/esm/loadskil.hpp>
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "esmstore.hpp"
#include "class.hpp" #include "class.hpp"
namespace MWWorld namespace MWWorld

@ -4,15 +4,14 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/class.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "../mwgui/bookwindow.hpp" #include "../mwgui/bookwindow.hpp"
#include "../mwgui/scrollwindow.hpp" #include "../mwgui/scrollwindow.hpp"
#include <components/esm_store/store.hpp> #include "player.hpp"
#include "class.hpp"
#include "esmstore.hpp"
namespace MWWorld namespace MWWorld
{ {

@ -1,11 +1,10 @@
#include "cells.hpp" #include "cells.hpp"
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "class.hpp" #include "class.hpp"
#include "esmstore.hpp"
#include "containerstore.hpp" #include "containerstore.hpp"
MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell) MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell)
@ -85,7 +84,7 @@ MWWorld::Ptr MWWorld::Cells::getPtrAndCache (const std::string& name, Ptr::CellS
return ptr; return ptr;
} }
MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader) MWWorld::Cells::Cells (const MWWorld::ESMStore& store, ESM::ESMReader& reader)
: mStore (store), mReader (reader), : mStore (store), mReader (reader),
mIdCache (20, std::pair<std::string, Ptr::CellStore *> ("", (Ptr::CellStore*)0)), /// \todo make cache size configurable mIdCache (20, std::pair<std::string, Ptr::CellStore *> ("", (Ptr::CellStore*)0)), /// \todo make cache size configurable
mIdCacheIndex (0) mIdCacheIndex (0)
@ -265,7 +264,7 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name)
} }
// Now try the other cells // Now try the other cells
for (ESMS::CellList::IntCells::const_iterator iter = mStore.cells.intCells.begin(); for (MWWorld::CellList::IntCells::const_iterator iter = mStore.cells.intCells.begin();
iter!=mStore.cells.intCells.end(); ++iter) iter!=mStore.cells.intCells.end(); ++iter)
{ {
Ptr::CellStore *cellStore = getCellStore (iter->second); Ptr::CellStore *cellStore = getCellStore (iter->second);
@ -276,7 +275,7 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name)
return ptr; return ptr;
} }
for (ESMS::CellList::ExtCells::const_iterator iter = mStore.cells.extCells.begin(); for (MWWorld::CellList::ExtCells::const_iterator iter = mStore.cells.extCells.begin();
iter!=mStore.cells.extCells.end(); ++iter) iter!=mStore.cells.extCells.end(); ++iter)
{ {
Ptr::CellStore *cellStore = getCellStore (iter->second); Ptr::CellStore *cellStore = getCellStore (iter->second);

@ -11,17 +11,14 @@ namespace ESM
class ESMReader; class ESMReader;
} }
namespace ESM namespace MWWorld
{ {
class ESMStore; class ESMStore;
}
namespace MWWorld
{
/// \brief Cell container /// \brief Cell container
class Cells class Cells
{ {
const ESMS::ESMStore& mStore; const MWWorld::ESMStore& mStore;
ESM::ESMReader& mReader; ESM::ESMReader& mReader;
std::map<std::string, CellStore> mInteriors; std::map<std::string, CellStore> mInteriors;
std::map<std::pair<int, int>, CellStore> mExteriors; std::map<std::pair<int, int>, CellStore> mExteriors;
@ -39,7 +36,7 @@ namespace MWWorld
public: public:
Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader); Cells (const MWWorld::ESMStore& store, ESM::ESMReader& reader);
///< \todo pass the dynamic part of the ESMStore isntead (once it is written) of the whole ///< \todo pass the dynamic part of the ESMStore isntead (once it is written) of the whole
/// world /// world

@ -2,12 +2,11 @@
#include <iostream> #include <iostream>
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "ptr.hpp" #include "ptr.hpp"
#include "esmstore.hpp"
namespace MWWorld namespace MWWorld
{ {
@ -16,7 +15,7 @@ namespace MWWorld
mWaterLevel = cell->mWater; mWaterLevel = cell->mWater;
} }
void CellStore::load (const ESMS::ESMStore &store, ESM::ESMReader &esm) void CellStore::load (const MWWorld::ESMStore &store, ESM::ESMReader &esm)
{ {
if (mState!=State_Loaded) if (mState!=State_Loaded)
{ {
@ -31,7 +30,7 @@ namespace MWWorld
} }
} }
void CellStore::preload (const ESMS::ESMStore &store, ESM::ESMReader &esm) void CellStore::preload (const MWWorld::ESMStore &store, ESM::ESMReader &esm)
{ {
if (mState==State_Unloaded) if (mState==State_Unloaded)
{ {
@ -41,7 +40,7 @@ namespace MWWorld
} }
} }
void CellStore::listRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm) void CellStore::listRefs(const MWWorld::ESMStore &store, ESM::ESMReader &esm)
{ {
assert (cell); assert (cell);
@ -67,7 +66,7 @@ namespace MWWorld
std::sort (mIds.begin(), mIds.end()); std::sort (mIds.begin(), mIds.end());
} }
void CellStore::loadRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm) void CellStore::loadRefs(const MWWorld::ESMStore &store, ESM::ESMReader &esm)
{ {
assert (cell); assert (cell);

@ -8,14 +8,10 @@
#include "refdata.hpp" #include "refdata.hpp"
namespace ESMS
{
struct ESMStore;
}
namespace MWWorld namespace MWWorld
{ {
class Ptr; class Ptr;
class ESMStore;
/// A reference to one object (of any type) in a cell. /// A reference to one object (of any type) in a cell.
/// ///
@ -122,9 +118,9 @@ namespace MWWorld
CellRefList<ESM::Static> statics; CellRefList<ESM::Static> statics;
CellRefList<ESM::Weapon> weapons; CellRefList<ESM::Weapon> weapons;
void load (const ESMS::ESMStore &store, ESM::ESMReader &esm); void load (const MWWorld::ESMStore &store, ESM::ESMReader &esm);
void preload (const ESMS::ESMStore &store, ESM::ESMReader &esm); void preload (const MWWorld::ESMStore &store, ESM::ESMReader &esm);
/// Call functor (ref) for each reference. functor must return a bool. Returning /// Call functor (ref) for each reference. functor must return a bool. Returning
/// false will abort the iteration. /// false will abort the iteration.
@ -183,9 +179,9 @@ namespace MWWorld
} }
/// Run through references and store IDs /// Run through references and store IDs
void listRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm); void listRefs(const MWWorld::ESMStore &store, ESM::ESMReader &esm);
void loadRefs(const ESMS::ESMStore &store, ESM::ESMReader &esm); void loadRefs(const MWWorld::ESMStore &store, ESM::ESMReader &esm);
}; };
} }

@ -145,7 +145,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImpl (const Ptr& ptr
return it; return it;
} }
void MWWorld::ContainerStore::fill (const ESM::InventoryList& items, const ESMS::ESMStore& store) void MWWorld::ContainerStore::fill (const ESM::InventoryList& items, const MWWorld::ESMStore& store)
{ {
for (std::vector<ESM::ContItem>::const_iterator iter (items.mList.begin()); iter!=items.mList.end(); for (std::vector<ESM::ContItem>::const_iterator iter (items.mList.begin()); iter!=items.mList.end();
++iter) ++iter)

@ -83,7 +83,7 @@ namespace MWWorld
public: public:
void fill (const ESM::InventoryList& items, const ESMS::ESMStore& store); void fill (const ESM::InventoryList& items, const MWWorld::ESMStore& store);
///< Insert items into *this. ///< Insert items into *this.
void clear(); void clear();

@ -1,31 +1,21 @@
#include "esmstore.hpp"
#include <set> #include <set>
#include <iostream> #include <iostream>
#include "store.hpp"
using namespace std;
using namespace ESM;
using namespace ESMS;
/* namespace MWWorld
static string toStr(int i)
{ {
char name[5];
*((int*)name) = i;
name[4] = 0;
return std::string(name);
}
*/
void ESMStore::load(ESMReader &esm) void ESMStore::load(ESM::ESMReader &esm)
{ {
set<string> missing; std::set<std::string> missing;
ESM::Dialogue *dialogue = 0; ESM::Dialogue *dialogue = 0;
// Loop through all records // Loop through all records
while(esm.hasMoreRecs()) while(esm.hasMoreRecs())
{ {
NAME n = esm.getRecName(); ESM::NAME n = esm.getRecName();
esm.getRecHeader(); esm.getRecHeader();
// Look up the record type. // Look up the record type.
@ -71,7 +61,8 @@ void ESMStore::load(ESMReader &esm)
if (n.val==ESM::REC_DIAL) if (n.val==ESM::REC_DIAL)
{ {
RecListCaseT<Dialogue>& recList = static_cast<RecListCaseT<Dialogue>& > (*it->second); RecListCaseT<ESM::Dialogue>& recList =
static_cast<RecListCaseT<ESM::Dialogue>& > (*it->second);
ESM::Dialogue* d = recList.search (id); ESM::Dialogue* d = recList.search (id);
@ -84,20 +75,22 @@ void ESMStore::load(ESMReader &esm)
// Insert the reference into the global lookup // Insert the reference into the global lookup
if(!id.empty() && if(!id.empty() &&
(n.val==REC_ACTI || n.val==REC_ALCH || n.val==REC_APPA || n.val==REC_ARMO || (n.val==ESM::REC_ACTI || n.val==ESM::REC_ALCH || n.val==ESM::REC_APPA || n.val==ESM::REC_ARMO ||
n.val==REC_BOOK || n.val==REC_CLOT || n.val==REC_CONT || n.val==REC_CREA || n.val==ESM::REC_BOOK || n.val==ESM::REC_CLOT || n.val==ESM::REC_CONT || n.val==ESM::REC_CREA ||
n.val==REC_DOOR || n.val==REC_INGR || n.val==REC_LEVC || n.val==REC_LEVI || n.val==ESM::REC_DOOR || n.val==ESM::REC_INGR || n.val==ESM::REC_LEVC || n.val==ESM::REC_LEVI ||
n.val==REC_LIGH || n.val==REC_LOCK || n.val==REC_MISC || n.val==REC_NPC_ || n.val==ESM::REC_LIGH || n.val==ESM::REC_LOCK || n.val==ESM::REC_MISC || n.val==ESM::REC_NPC_ ||
n.val==REC_PROB || n.val==REC_REPA || n.val==REC_STAT || n.val==REC_WEAP) n.val==ESM::REC_PROB || n.val==ESM::REC_REPA || n.val==ESM::REC_STAT || n.val==ESM::REC_WEAP)
) )
all[id] = n.val; all[id] = n.val;
} }
} }
for (int i = 0; i < Attribute::Length; ++i) for (int i = 0; i < ESM::Attribute::Length; ++i)
{ {
Attribute::AttributeID id = Attribute::sAttributeIds[i]; typedef ESM::Attribute EsmAttr;
attributes.list.insert(std::make_pair(id, Attribute(id, Attribute::sGmstAttributeIds[i], Attribute::sGmstAttributeDescIds[i])));
EsmAttr::AttributeID id = EsmAttr::sAttributeIds[i];
attributes.list.insert(std::make_pair(id, ESM::Attribute(id, EsmAttr::sGmstAttributeIds[i], EsmAttr::sGmstAttributeDescIds[i])));
} }
/* This information isn't needed on screen. But keep the code around /* This information isn't needed on screen. But keep the code around
@ -113,3 +106,5 @@ void ESMStore::load(ESMReader &esm)
cout << endl; cout << endl;
*/ */
} }
} // end namespace

@ -0,0 +1,145 @@
#ifndef OPENMW_MWWORLD_STORE_H
#define OPENMW_MWWORLD_STORE_H
/*
The ESM storage module.
This is separate from the ESM loader module, located in esm/. It is
also unaware of the cell loading and storage module.
The advantage of this, as with all other modularizations, is that
you can replace the storage method later without touching the
loading code. Cutting down dependencies also help on the general
maintainability.
*/
#include <components/esm/records.hpp>
#include "reclists.hpp"
namespace MWWorld
{
struct ESMStore
{
/* Lists all the list types. Mostly used for quick lookup on
loading. The key is the record name (4 chars) parsed as a 32
bit int. See esm/records.hpp for the complete list.
*/
RecListList recLists;
// Each individual list
RecListT<ESM::Activator> activators;
RecListWithIDT<ESM::Potion> potions;
RecListT<ESM::Apparatus> appas;
RecListT<ESM::Armor> armors;
RecListT<ESM::BodyPart> bodyParts;
RecListWithIDT<ESM::Book> books;
RecListT<ESM::BirthSign> birthSigns;
RecListT<ESM::Class> classes;
RecListT<ESM::Clothing> clothes;
RecListT<ESM::LoadCNTC> contChange;
RecListT<ESM::Container> containers;
RecListWithIDT<ESM::Creature> creatures;
RecListT<ESM::LoadCREC> creaChange;
RecListCaseT<ESM::Dialogue> dialogs;
RecListT<ESM::Door> doors;
RecListT<ESM::Enchantment> enchants;
RecListT<ESM::Faction> factions;
RecListT<ESM::Global> globals;
RecListWithIDT<ESM::Ingredient> ingreds;
RecListT<ESM::CreatureLevList> creatureLists;
RecListT<ESM::ItemLevList> itemLists;
RecListT<ESM::Light> lights;
RecListT<ESM::Tool> lockpicks;
RecListT<ESM::Miscellaneous> miscItems;
RecListWithIDT<ESM::NPC> npcs;
RecListT<ESM::LoadNPCC> npcChange;
RecListT<ESM::Probe> probes;
RecListT<ESM::Race> races;
RecListT<ESM::Region> regions;
RecListT<ESM::Repair> repairs;
RecListT<ESM::SoundGenerator> soundGens;
RecListT<ESM::Sound> sounds;
RecListT<ESM::Spell> spells;
RecListT<ESM::StartScript> startScripts;
RecListT<ESM::Static> statics;
RecListT<ESM::Weapon> weapons;
// Lists that need special rules
CellList cells;
RecListWithIDT<ESM::GameSetting> gameSettings;
LandList lands;
LTexList landTexts;
ScriptListT<ESM::Script> scripts;
IndexListT<ESM::MagicEffect> magicEffects;
IndexListT<ESM::Skill> skills;
//RecListT<ESM::Pathgrid> pathgrids;
PathgridList pathgrids;
// Special entry which is hardcoded and not loaded from an ESM
IndexListT<ESM::Attribute> attributes;
// Lookup of all IDs. Makes looking up references faster. Just
// maps the id name to the record type.
typedef std::map<std::string, int> AllMap;
AllMap all;
// Look up the given ID in 'all'. Returns 0 if not found.
int find(const std::string &id) const
{
AllMap::const_iterator it = all.find(id);
if(it == all.end()) return 0;
return it->second;
}
ESMStore()
{
recLists[ESM::REC_ACTI] = &activators;
recLists[ESM::REC_ALCH] = &potions;
recLists[ESM::REC_APPA] = &appas;
recLists[ESM::REC_ARMO] = &armors;
recLists[ESM::REC_BODY] = &bodyParts;
recLists[ESM::REC_BOOK] = &books;
recLists[ESM::REC_BSGN] = &birthSigns;
recLists[ESM::REC_CELL] = &cells;
recLists[ESM::REC_CLAS] = &classes;
recLists[ESM::REC_CLOT] = &clothes;
recLists[ESM::REC_CNTC] = &contChange;
recLists[ESM::REC_CONT] = &containers;
recLists[ESM::REC_CREA] = &creatures;
recLists[ESM::REC_CREC] = &creaChange;
recLists[ESM::REC_DIAL] = &dialogs;
recLists[ESM::REC_DOOR] = &doors;
recLists[ESM::REC_ENCH] = &enchants;
recLists[ESM::REC_FACT] = &factions;
recLists[ESM::REC_GLOB] = &globals;
recLists[ESM::REC_GMST] = &gameSettings;
recLists[ESM::REC_INGR] = &ingreds;
recLists[ESM::REC_LAND] = &lands;
recLists[ESM::REC_LEVC] = &creatureLists;
recLists[ESM::REC_LEVI] = &itemLists;
recLists[ESM::REC_LIGH] = &lights;
recLists[ESM::REC_LOCK] = &lockpicks;
recLists[ESM::REC_LTEX] = &landTexts;
recLists[ESM::REC_MISC] = &miscItems;
recLists[ESM::REC_NPC_] = &npcs;
recLists[ESM::REC_NPCC] = &npcChange;
recLists[ESM::REC_PGRD] = &pathgrids;
recLists[ESM::REC_PROB] = &probes;
recLists[ESM::REC_RACE] = &races;
recLists[ESM::REC_REGN] = &regions;
recLists[ESM::REC_REPA] = &repairs;
recLists[ESM::REC_SCPT] = &scripts;
recLists[ESM::REC_SNDG] = &soundGens;
recLists[ESM::REC_SOUN] = &sounds;
recLists[ESM::REC_SPEL] = &spells;
recLists[ESM::REC_SSCR] = &startScripts;
recLists[ESM::REC_STAT] = &statics;
recLists[ESM::REC_WEAP] = &weapons;
}
void load(ESM::ESMReader &esm);
};
}
#endif

@ -3,7 +3,7 @@
#include <stdexcept> #include <stdexcept>
#include <components/esm_store/store.hpp> #include "esmstore.hpp"
namespace MWWorld namespace MWWorld
{ {
@ -27,9 +27,9 @@ namespace MWWorld
return iter; return iter;
} }
Globals::Globals (const ESMS::ESMStore& store) Globals::Globals (const MWWorld::ESMStore& store)
{ {
for (ESMS::RecListT<ESM::Global>::MapType::const_iterator iter for (MWWorld::RecListT<ESM::Global>::MapType::const_iterator iter
(store.globals.list.begin()); iter != store.globals.list.end(); ++iter) (store.globals.list.begin()); iter != store.globals.list.end(); ++iter)
{ {
char type = ' '; char type = ' ';

@ -6,13 +6,10 @@
#include <components/interpreter/types.hpp> #include <components/interpreter/types.hpp>
namespace ESMS
{
struct ESMStore;
}
namespace MWWorld namespace MWWorld
{ {
class ESMStore;
class Globals class Globals
{ {
public: public:
@ -36,7 +33,7 @@ namespace MWWorld
public: public:
Globals (const ESMS::ESMStore& store); Globals (const MWWorld::ESMStore& store);
const Data& operator[] (const std::string& name) const; const Data& operator[] (const std::string& name) const;

@ -6,13 +6,12 @@
#include <components/esm/loadench.hpp> #include <components/esm/loadench.hpp>
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "esmstore.hpp"
#include "class.hpp" #include "class.hpp"
void MWWorld::InventoryStore::copySlots (const InventoryStore& store) void MWWorld::InventoryStore::copySlots (const InventoryStore& store)

@ -1,8 +1,6 @@
#include "localscripts.hpp" #include "localscripts.hpp"
#include <components/esm_store/store.hpp> #include "esmstore.hpp"
#include "cellstore.hpp" #include "cellstore.hpp"
namespace namespace
@ -23,7 +21,7 @@ namespace
} }
} }
MWWorld::LocalScripts::LocalScripts (const ESMS::ESMStore& store) : mStore (store) {} MWWorld::LocalScripts::LocalScripts (const MWWorld::ESMStore& store) : mStore (store) {}
void MWWorld::LocalScripts::setIgnore (const Ptr& ptr) void MWWorld::LocalScripts::setIgnore (const Ptr& ptr)
{ {

@ -6,13 +6,9 @@
#include "ptr.hpp" #include "ptr.hpp"
namespace ESMS
{
struct ESMStore;
}
namespace MWWorld namespace MWWorld
{ {
struct ESMStore;
class CellStore; class CellStore;
/// \brief List of active local scripts /// \brief List of active local scripts
@ -21,11 +17,11 @@ namespace MWWorld
std::list<std::pair<std::string, Ptr> > mScripts; std::list<std::pair<std::string, Ptr> > mScripts;
std::list<std::pair<std::string, Ptr> >::iterator mIter; std::list<std::pair<std::string, Ptr> >::iterator mIter;
MWWorld::Ptr mIgnore; MWWorld::Ptr mIgnore;
const ESMS::ESMStore& mStore; const MWWorld::ESMStore& mStore;
public: public:
LocalScripts (const ESMS::ESMStore& store); LocalScripts (const MWWorld::ESMStore& store);
void setIgnore (const Ptr& ptr); void setIgnore (const Ptr& ptr);
///< Mark a single reference for ignoring during iteration over local scripts (will revoke ///< Mark a single reference for ignoring during iteration over local scripts (will revoke

@ -3,8 +3,7 @@
#include <boost/any.hpp> #include <boost/any.hpp>
#include <components/esm_store/store.hpp> #include "esmstore.hpp"
#include "ptr.hpp" #include "ptr.hpp"
#include "cellstore.hpp" #include "cellstore.hpp"
@ -20,7 +19,7 @@ namespace MWWorld
ManualRef& operator= (const ManualRef&); ManualRef& operator= (const ManualRef&);
template<typename T> template<typename T>
bool create (const ESMS::RecListT<T>& list, const std::string& name) bool create (const MWWorld::RecListT<T>& list, const std::string& name)
{ {
if (const T *instance = list.search (name)) if (const T *instance = list.search (name))
{ {
@ -37,7 +36,7 @@ namespace MWWorld
} }
template<typename T> template<typename T>
bool create (const ESMS::RecListWithIDT<T>& list, const std::string& name) bool create (const MWWorld::RecListWithIDT<T>& list, const std::string& name)
{ {
if (const T *instance = list.search (name)) if (const T *instance = list.search (name))
{ {
@ -55,7 +54,7 @@ namespace MWWorld
public: public:
ManualRef (const ESMS::ESMStore& store, const std::string& name) ManualRef (const MWWorld::ESMStore& store, const std::string& name)
{ {
// create // create
if (!create (store.activators, name) && if (!create (store.activators, name) &&

@ -1,7 +1,6 @@
#include "player.hpp" #include "player.hpp"
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -9,6 +8,7 @@
#include "../mwmechanics/movement.hpp" #include "../mwmechanics/movement.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "esmstore.hpp"
#include "class.hpp" #include "class.hpp"
namespace MWWorld namespace MWWorld

@ -1,7 +1,7 @@
#ifndef _GAME_ESM_RECLISTS_H #ifndef OPENMW_MWWORLD_RECLISTS_H
#define _GAME_ESM_RECLISTS_H #define OPENMW_MWWORLD_RECLISTS_H
#include "components/esm/records.hpp" #include <components/esm/records.hpp>
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
@ -10,21 +10,17 @@
#include <cassert> #include <cassert>
#include <stdexcept> #include <stdexcept>
#include <iterator> #include <iterator>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
using namespace boost::algorithm; using namespace boost::algorithm;
namespace ESMS namespace MWWorld
{ {
using namespace ESM;
struct RecList struct RecList
{ {
virtual ~RecList() {} virtual ~RecList() {}
virtual void load(ESMReader &esm, const std::string &id) = 0; virtual void load(ESM::ESMReader &esm, const std::string &id) = 0;
virtual int getSize() = 0; virtual int getSize() = 0;
virtual void listIdentifier (std::vector<std::string>& identifier) const = 0; virtual void listIdentifier (std::vector<std::string>& identifier) const = 0;
@ -51,7 +47,7 @@ namespace ESMS
MapType list; MapType list;
// Load one object of this type // Load one object of this type
void load(ESMReader &esm, const std::string &id) void load(ESM::ESMReader &esm, const std::string &id)
{ {
std::string id2 = toLower (id); std::string id2 = toLower (id);
list[id2].load(esm); list[id2].load(esm);
@ -102,7 +98,7 @@ namespace ESMS
MapType list; MapType list;
// Load one object of this type // Load one object of this type
void load(ESMReader &esm, const std::string &id) void load(ESM::ESMReader &esm, const std::string &id)
{ {
//std::string id2 = toLower (id); //std::string id2 = toLower (id);
@ -170,7 +166,7 @@ namespace ESMS
MapType list; MapType list;
// Load one object of this type // Load one object of this type
void load(ESMReader &esm, const std::string &id) void load(ESM::ESMReader &esm, const std::string &id)
{ {
std::string id2 = toLower (id); std::string id2 = toLower (id);
list[id2].mId = id2; list[id2].mId = id2;
@ -216,7 +212,7 @@ namespace ESMS
virtual ~LTexList() {} virtual ~LTexList() {}
// TODO: For multiple ESM/ESP files we need one list per file. // TODO: For multiple ESM/ESP files we need one list per file.
std::vector<LandTexture> ltex; std::vector<ESM::LandTexture> ltex;
LTexList() LTexList()
{ {
@ -224,7 +220,7 @@ namespace ESMS
ltex.reserve(128); ltex.reserve(128);
} }
const LandTexture* search(size_t index) const const ESM::LandTexture* search(size_t index) const
{ {
assert(index < ltex.size()); assert(index < ltex.size());
return &ltex.at(index); return &ltex.at(index);
@ -235,9 +231,9 @@ namespace ESMS
virtual void listIdentifier (std::vector<std::string>& identifier) const {} virtual void listIdentifier (std::vector<std::string>& identifier) const {}
void load(ESMReader &esm, const std::string &id) void load(ESM::ESMReader &esm, const std::string &id)
{ {
LandTexture lt; ESM::LandTexture lt;
lt.load(esm); lt.load(esm);
lt.mId = id; lt.mId = id;
@ -265,7 +261,7 @@ namespace ESMS
// Map containing all landscapes // Map containing all landscapes
typedef std::pair<int, int> LandCoord; typedef std::pair<int, int> LandCoord;
typedef std::map<LandCoord, Land*> LandMap; typedef std::map<LandCoord, ESM::Land*> LandMap;
LandMap lands; LandMap lands;
int count; int count;
@ -275,7 +271,7 @@ namespace ESMS
virtual void listIdentifier (std::vector<std::string>& identifier) const {} virtual void listIdentifier (std::vector<std::string>& identifier) const {}
// Find land for the given coordinates. Return null if no mData. // Find land for the given coordinates. Return null if no mData.
Land *search(int x, int y) const ESM::Land *search(int x, int y) const
{ {
LandMap::const_iterator itr = lands.find(std::make_pair (x, y)); LandMap::const_iterator itr = lands.find(std::make_pair (x, y));
if ( itr == lands.end() ) if ( itr == lands.end() )
@ -286,13 +282,13 @@ namespace ESMS
return itr->second; return itr->second;
} }
void load(ESMReader &esm, const std::string &id) void load(ESM::ESMReader &esm, const std::string &id)
{ {
count++; count++;
// Create the structure and load it. This actually skips the // Create the structure and load it. This actually skips the
// landscape data and remembers the file position for later. // landscape data and remembers the file position for later.
Land *land = new Land(); ESM::Land *land = new ESM::Land();
land->load(esm); land->load(esm);
// Store the structure // Store the structure
@ -404,7 +400,7 @@ namespace ESMS
return 0; return 0;
} }
void load(ESMReader &esm, const std::string &id) void load(ESM::ESMReader &esm, const std::string &id)
{ {
count++; count++;
@ -458,7 +454,7 @@ namespace ESMS
// do nothing // do nothing
} }
void load(ESMReader &esm, const std::string &id) void load(ESM::ESMReader &esm, const std::string &id)
{ {
count++; count++;
ESM::Pathgrid *grid = new ESM::Pathgrid; ESM::Pathgrid *grid = new ESM::Pathgrid;
@ -473,9 +469,9 @@ namespace ESMS
} }
} }
Pathgrid *find(int cellX, int cellY, const std::string &cellName) const ESM::Pathgrid *find(int cellX, int cellY, const std::string &cellName) const
{ {
Pathgrid *result = search(cellX, cellY, cellName); ESM::Pathgrid *result = search(cellX, cellY, cellName);
if (!result) if (!result)
{ {
throw std::runtime_error("no pathgrid found for cell " + cellName); throw std::runtime_error("no pathgrid found for cell " + cellName);
@ -483,9 +479,9 @@ namespace ESMS
return result; return result;
} }
Pathgrid *search(int cellX, int cellY, const std::string &cellName) const ESM::Pathgrid *search(int cellX, int cellY, const std::string &cellName) const
{ {
Pathgrid *result = NULL; ESM::Pathgrid *result = NULL;
if (cellX == 0 && cellY == 0) // possibly interior if (cellX == 0 && cellY == 0) // possibly interior
{ {
IntGrids::const_iterator it = intGrids.find(cellName); IntGrids::const_iterator it = intGrids.find(cellName);
@ -501,7 +497,7 @@ namespace ESMS
return result; return result;
} }
Pathgrid *search(const ESM::Cell &cell) const ESM::Pathgrid *search(const ESM::Cell &cell) const
{ {
int cellX, cellY; int cellX, cellY;
if (cell.mData.mFlags & ESM::Cell::Interior) if (cell.mData.mFlags & ESM::Cell::Interior)
@ -527,7 +523,7 @@ namespace ESMS
MapType list; MapType list;
// Load one object of this type // Load one object of this type
void load(ESMReader &esm, const std::string &id) void load(ESM::ESMReader &esm, const std::string &id)
{ {
X ref; X ref;
ref.load (esm); ref.load (esm);
@ -579,7 +575,7 @@ namespace ESMS
MapType list; MapType list;
void load(ESMReader &esm) void load(ESM::ESMReader &esm)
{ {
X ref; X ref;
ref.load (esm); ref.load (esm);
@ -620,10 +616,5 @@ namespace ESMS
return object; return object;
} }
}; };
/* We need special lists for:
Path grids
*/
} }
#endif #endif

@ -1,6 +1,5 @@
#include "scene.hpp" #include "scene.hpp"
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" /// FIXME #include "../mwbase/world.hpp" /// FIXME
@ -10,6 +9,7 @@
#include "player.hpp" #include "player.hpp"
#include "localscripts.hpp" #include "localscripts.hpp"
#include "esmstore.hpp"
#include "cellfunctors.hpp" #include "cellfunctors.hpp"

@ -5,8 +5,6 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
@ -14,6 +12,7 @@
#include "../mwrender/renderingmanager.hpp" #include "../mwrender/renderingmanager.hpp"
#include "player.hpp" #include "player.hpp"
#include "esmstore.hpp"
using namespace Ogre; using namespace Ogre;
using namespace MWWorld; using namespace MWWorld;

@ -20,7 +20,7 @@ using namespace Ogre;
namespace namespace
{ {
template<typename T> template<typename T>
void listCellScripts (const ESMS::ESMStore& store, void listCellScripts (const MWWorld::ESMStore& store,
MWWorld::CellRefList<T>& cellRefList, MWWorld::LocalScripts& localScripts, MWWorld::CellRefList<T>& cellRefList, MWWorld::LocalScripts& localScripts,
MWWorld::Ptr::CellStore *cell) MWWorld::Ptr::CellStore *cell)
{ {
@ -228,12 +228,12 @@ namespace MWWorld
return cell; return cell;
// didn't work -> now check for regions // didn't work -> now check for regions
std::string cellName2 = ESMS::RecListT<ESM::Region>::toLower (cellName); std::string cellName2 = MWWorld::RecListT<ESM::Region>::toLower (cellName);
for (ESMS::RecListT<ESM::Region>::MapType::const_iterator iter (mStore.regions.list.begin()); for (MWWorld::RecListT<ESM::Region>::MapType::const_iterator iter (mStore.regions.list.begin());
iter!=mStore.regions.list.end(); ++iter) iter!=mStore.regions.list.end(); ++iter)
{ {
if (ESMS::RecListT<ESM::Region>::toLower (iter->second.mName)==cellName2) if (MWWorld::RecListT<ESM::Region>::toLower (iter->second.mName)==cellName2)
{ {
if (const ESM::Cell *cell = mStore.cells.searchExtByRegion (iter->first)) if (const ESM::Cell *cell = mStore.cells.searchExtByRegion (iter->first))
return cell; return cell;
@ -260,7 +260,7 @@ namespace MWWorld
return *mPlayer; return *mPlayer;
} }
const ESMS::ESMStore& World::getStore() const const MWWorld::ESMStore& World::getStore() const
{ {
return mStore; return mStore;
} }

@ -1,12 +1,11 @@
#ifndef GAME_MWWORLD_WORLDIMP_H #ifndef GAME_MWWORLD_WORLDIMP_H
#define GAME_MWWORLD_WORLDIMP_H #define GAME_MWWORLD_WORLDIMP_H
#include <components/esm_store/store.hpp>
#include "../mwrender/debugging.hpp" #include "../mwrender/debugging.hpp"
#include "ptr.hpp" #include "ptr.hpp"
#include "scene.hpp" #include "scene.hpp"
#include "esmstore.hpp"
#include "physicssystem.hpp" #include "physicssystem.hpp"
#include "cells.hpp" #include "cells.hpp"
#include "localscripts.hpp" #include "localscripts.hpp"
@ -56,7 +55,7 @@ namespace MWWorld
MWWorld::Scene *mWorldScene; MWWorld::Scene *mWorldScene;
MWWorld::Player *mPlayer; MWWorld::Player *mPlayer;
ESM::ESMReader mEsm; ESM::ESMReader mEsm;
ESMS::ESMStore mStore; MWWorld::ESMStore mStore;
LocalScripts mLocalScripts; LocalScripts mLocalScripts;
MWWorld::Globals *mGlobalVariables; MWWorld::Globals *mGlobalVariables;
MWWorld::PhysicsSystem *mPhysics; MWWorld::PhysicsSystem *mPhysics;
@ -124,7 +123,7 @@ namespace MWWorld
virtual Player& getPlayer(); virtual Player& getPlayer();
virtual const ESMS::ESMStore& getStore() const; virtual const MWWorld::ESMStore& getStore() const;
virtual ESM::ESMReader& getEsmReader(); virtual ESM::ESMReader& getEsmReader();

@ -34,10 +34,6 @@ add_component_dir (file_finder
file_finder filename_less search file_finder filename_less search
) )
add_component_dir (esm_store
reclists store
)
add_component_dir (esm add_component_dir (esm
attr defs esmcommon esmreader esmwriter loadacti loadalch loadappa loadarmo loadbody loadbook loadbsgn loadcell attr defs esmcommon esmreader esmwriter loadacti loadalch loadappa loadarmo loadbody loadbook loadbsgn loadcell
loadclas loadclot loadcont loadcrea loadcrec loaddial loaddoor loadench loadfact loadglob loadgmst loadclas loadclot loadcont loadcrea loadcrec loaddial loaddoor loadench loadfact loadglob loadgmst

@ -1,146 +0,0 @@
#ifndef _GAME_ESM_STORE_H
#define _GAME_ESM_STORE_H
/*
The ESM storage module.
This is separate from the ESM loader module, located in esm/. It is
also unaware of the cell loading and storage module.
The advantage of this, as with all other modularizations, is that
you can replace the storage method later without touching the
loading code. Cutting down dependencies also help on the general
maintainability.
*/
#include "components/esm/records.hpp"
#include "reclists.hpp"
namespace ESMS
{
using namespace ESM;
struct ESMStore
{
/* Lists all the list types. Mostly used for quick lookup on
loading. The key is the record name (4 chars) parsed as a 32
bit int. See esm/records.hpp for the complete list.
*/
RecListList recLists;
// Each individual list
RecListT<Activator> activators;
RecListWithIDT<Potion> potions;
RecListT<Apparatus> appas;
RecListT<Armor> armors;
RecListT<BodyPart> bodyParts;
RecListWithIDT<Book> books;
RecListT<BirthSign> birthSigns;
RecListT<Class> classes;
RecListT<Clothing> clothes;
RecListT<LoadCNTC> contChange;
RecListT<Container> containers;
RecListWithIDT<Creature> creatures;
RecListT<LoadCREC> creaChange;
RecListCaseT<Dialogue> dialogs;
RecListT<Door> doors;
RecListT<Enchantment> enchants;
RecListT<Faction> factions;
RecListT<Global> globals;
RecListWithIDT<Ingredient> ingreds;
RecListT<CreatureLevList> creatureLists;
RecListT<ItemLevList> itemLists;
RecListT<Light> lights;
RecListT<Tool> lockpicks;
RecListT<Miscellaneous> miscItems;
RecListWithIDT<NPC> npcs;
RecListT<LoadNPCC> npcChange;
RecListT<Probe> probes;
RecListT<Race> races;
RecListT<Region> regions;
RecListT<Repair> repairs;
RecListT<SoundGenerator> soundGens;
RecListT<Sound> sounds;
RecListT<Spell> spells;
RecListT<StartScript> startScripts;
RecListT<Static> statics;
RecListT<Weapon> weapons;
// Lists that need special rules
CellList cells;
RecListWithIDT<GameSetting> gameSettings;
LandList lands;
LTexList landTexts;
ScriptListT<Script> scripts;
IndexListT<MagicEffect> magicEffects;
IndexListT<Skill> skills;
//RecListT<Pathgrid> pathgrids;
PathgridList pathgrids;
// Special entry which is hardcoded and not loaded from an ESM
IndexListT<Attribute> attributes;
// Lookup of all IDs. Makes looking up references faster. Just
// maps the id name to the record type.
typedef std::map<std::string, int> AllMap;
AllMap all;
// Look up the given ID in 'all'. Returns 0 if not found.
int find(const std::string &id) const
{
AllMap::const_iterator it = all.find(id);
if(it == all.end()) return 0;
return it->second;
}
ESMStore()
{
recLists[REC_ACTI] = &activators;
recLists[REC_ALCH] = &potions;
recLists[REC_APPA] = &appas;
recLists[REC_ARMO] = &armors;
recLists[REC_BODY] = &bodyParts;
recLists[REC_BOOK] = &books;
recLists[REC_BSGN] = &birthSigns;
recLists[REC_CELL] = &cells;
recLists[REC_CLAS] = &classes;
recLists[REC_CLOT] = &clothes;
recLists[REC_CNTC] = &contChange;
recLists[REC_CONT] = &containers;
recLists[REC_CREA] = &creatures;
recLists[REC_CREC] = &creaChange;
recLists[REC_DIAL] = &dialogs;
recLists[REC_DOOR] = &doors;
recLists[REC_ENCH] = &enchants;
recLists[REC_FACT] = &factions;
recLists[REC_GLOB] = &globals;
recLists[REC_GMST] = &gameSettings;
recLists[REC_INGR] = &ingreds;
recLists[REC_LAND] = &lands;
recLists[REC_LEVC] = &creatureLists;
recLists[REC_LEVI] = &itemLists;
recLists[REC_LIGH] = &lights;
recLists[REC_LOCK] = &lockpicks;
recLists[REC_LTEX] = &landTexts;
recLists[REC_MISC] = &miscItems;
recLists[REC_NPC_] = &npcs;
recLists[REC_NPCC] = &npcChange;
recLists[REC_PGRD] = &pathgrids;
recLists[REC_PROB] = &probes;
recLists[REC_RACE] = &races;
recLists[REC_REGN] = &regions;
recLists[REC_REPA] = &repairs;
recLists[REC_SCPT] = &scripts;
recLists[REC_SNDG] = &soundGens;
recLists[REC_SOUN] = &sounds;
recLists[REC_SPEL] = &spells;
recLists[REC_SSCR] = &startScripts;
recLists[REC_STAT] = &statics;
recLists[REC_WEAP] = &weapons;
}
void load(ESMReader &esm);
};
}
#endif
Loading…
Cancel
Save