move ESMStore to MWWorld

This commit is contained in:
greye 2012-10-01 19:17:04 +04:00
parent f0a3ee0ef9
commit 2057f5619e
76 changed files with 354 additions and 403 deletions

View file

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

View file

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

View file

@ -205,7 +205,7 @@ namespace MWClass
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)
{

View file

@ -143,7 +143,7 @@ namespace MWClass
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();
@ -189,7 +189,7 @@ namespace MWClass
{
MWWorld::Ptr newPtr;
const ESMS::ESMStore &store =
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
if (MWWorld::Class::get(ptr).getName(ptr) == store.gameSettings.find("sGold")->getString()) {

View file

@ -277,7 +277,7 @@ namespace MWClass
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
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;

View file

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

View file

@ -3,11 +3,11 @@
#include <stdexcept>
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/esmstore.hpp"
namespace MWDialogue
{
JournalEntry::JournalEntry() {}
@ -16,7 +16,7 @@ namespace MWDialogue
: 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);

View file

@ -3,7 +3,7 @@
#include <string>
namespace ESMS
namespace MWWorld
{
struct ESMStore;
}
@ -20,7 +20,7 @@ namespace MWDialogue
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);

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include "components/esm_store/store.hpp"
#include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
@ -130,10 +130,10 @@ void BirthDialog::updateBirths()
{
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();
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator end = store.birthSigns.list.end();
MWWorld::RecListT<ESM::BirthSign>::MapType::const_iterator it = store.birthSigns.list.begin();
MWWorld::RecListT<ESM::BirthSign>::MapType::const_iterator end = store.birthSigns.list.end();
int index = 0;
// sort by name
@ -170,7 +170,7 @@ void BirthDialog::updateSpells()
const int lineHeight = 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);
std::string texturePath = std::string("textures\\") + birth->mTexture;

View file

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

View file

@ -5,7 +5,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <components/esm_store/store.hpp>
#include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
@ -185,10 +185,10 @@ void PickClassDialog::updateClasses()
{
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();
ESMS::RecListT<ESM::Class>::MapType::const_iterator end = store.classes.list.end();
MWWorld::RecListT<ESM::Class>::MapType::const_iterator it = store.classes.list.begin();
MWWorld::RecListT<ESM::Class>::MapType::const_iterator end = store.classes.list.end();
int index = 0;
for (; it != end; ++it)
{
@ -209,7 +209,7 @@ void PickClassDialog::updateStats()
{
if (mCurrentClassId.empty())
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);
if (!klass)
return;

View file

@ -4,11 +4,10 @@
#include <algorithm>
#include <fstream>
#include <components/esm_store/reclists.hpp>
#include <components/esm_store/store.hpp>
#include <components/compiler/exception.hpp>
#include "../mwworld/esmstore.hpp"
#include "../mwscript/extensions.hpp"
#include "../mwbase/environment.hpp"
@ -93,9 +92,9 @@ namespace MWGui
scanner.listKeywords (mNames);
// 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->second->listIdentifier (mNames);

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <components/esm_store/store.hpp>
#include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
@ -224,10 +224,10 @@ void RaceDialog::updateRaces()
{
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();
ESMS::RecListT<ESM::Race>::MapType::const_iterator end = store.races.list.end();
MWWorld::RecListT<ESM::Race>::MapType::const_iterator it = store.races.list.begin();
MWWorld::RecListT<ESM::Race>::MapType::const_iterator end = store.races.list.end();
int index = 0;
for (; it != end; ++it)
{
@ -258,7 +258,7 @@ void RaceDialog::updateSkills()
const int lineHeight = 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);
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)
@ -296,7 +296,7 @@ void RaceDialog::updateSpellPowers()
const int lineHeight = 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);
std::vector<std::string>::const_iterator it = race->mPowers.mList.begin();

View file

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

View file

@ -5,7 +5,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <components/esm_store/store.hpp>
#include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.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
continue;
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;
float base = stat.getBase();
float modified = stat.getModified();

View file

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

View file

@ -54,7 +54,7 @@ StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
{ 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)
{
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
continue;
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;
float base = stat.getBase();
float modified = stat.getModified();
@ -422,7 +422,7 @@ void StatsWindow::updateSkillArea()
if (!mMiscSkills.empty())
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
const ESM::Race* playerRace = store.races.find (MWBase::Environment::get().getWorld()->getPlayer().getRace());

View file

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

View file

@ -365,7 +365,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
text.erase(0, 1);
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 != "")
{
enchant = store.enchants.search(info.enchant);
@ -571,7 +571,7 @@ void ToolTips::createSkillToolTip(MyGUI::Widget* widget, int skillId)
if (skillId == -1)
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);
assert(skill);
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute);

View file

@ -2,12 +2,12 @@
#include <boost/lexical_cast.hpp>
#include "components/esm_store/store.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwworld/esmstore.hpp"
#undef min
#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)
{
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);
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
@ -259,7 +259,7 @@ void MWSpell::updateWidgets()
{
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);
if (spell)
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->mName);
@ -386,7 +386,10 @@ void MWSpellEffect::setSpellEffect(const SpellEffectParams& params)
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);
assert(magicEffect);

View file

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

View file

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

View file

@ -7,7 +7,7 @@
#include <components/esm/loadnpc.hpp>
#include <components/esm_store/store.hpp>
#include "../mwworld/esmstore.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/inventorystore.hpp"
@ -101,7 +101,7 @@ namespace MWMechanics
health.setCurrent (health.getCurrent() + 0.1 * endurance);
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 fFatigueReturnMult = store.gameSettings.find("fFatigueReturnMult")->getFloat ();

View file

@ -2,7 +2,7 @@
#include <algorithm>
#include <components/esm_store/store.hpp>
#include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.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);
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
return store.gameSettings.find ("fFatigueBase")->getFloat()
- store.gameSettings.find ("fFatigueMult")->getFloat() * (1-normalised);

View file

@ -1,7 +1,7 @@
#include "mechanicsmanagerimp.hpp"
#include <components/esm_store/store.hpp>
#include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.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;
for (ContainerType::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter)

View file

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

View file

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

View file

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

View file

@ -11,7 +11,7 @@
#include <components/esm/loadstat.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/environment.hpp"

View file

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

View file

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

View file

@ -4,7 +4,7 @@
#include <OgreEntity.h>
#include <OgreSubEntity.h>
#include <components/esm_store/store.hpp>
#include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
@ -62,7 +62,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
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);
std::string hairID = ref->base->mHair;
@ -322,7 +322,7 @@ void NpcAnimation::updateParts()
{ 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++)
{
if(mPartPriorities[PartTypeList[i].type] < 1)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -9,8 +9,7 @@
#include <components/interpreter/runtime.hpp>
#include <components/interpreter/opcodes.hpp>
#include <components/esm_store/store.hpp>
#include <components/esm_store/reclists.hpp>
#include "../mwworld/esmstore.hpp"
#include "../mwbase/environment.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."
// http://www.uesp.net/wiki/Tes3Mod:ShowMap
const ESMS::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells;
for (ESMS::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it)
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)
{
std::string name = it->second->mName;
boost::algorithm::to_lower(name);
@ -126,8 +125,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
const ESMS::CellList::ExtCells& extCells = MWBase::Environment::get().getWorld ()->getStore ().cells.extCells;
for (ESMS::CellList::ExtCells::const_iterator it = extCells.begin(); it != extCells.end(); ++it)
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)
{
std::string name = it->second->mName;
if (name != "")

View file

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

View file

@ -7,7 +7,7 @@
#include <exception>
#include <components/esm/loadscpt.hpp>
#include <components/esm_store/store.hpp>
#include "../mwworld/esmstore.hpp"
#include <components/compiler/scanner.hpp>
#include <components/compiler/context.hpp>
@ -17,7 +17,7 @@
namespace MWScript
{
ScriptManager::ScriptManager (const ESMS::ESMStore& store, bool verbose,
ScriptManager::ScriptManager (const MWWorld::ESMStore& store, bool verbose,
Compiler::Context& compilerContext)
: mErrorHandler (std::cerr), mStore (store), mVerbose (verbose),
mCompilerContext (compilerContext), mParser (mErrorHandler, mCompilerContext),
@ -125,7 +125,7 @@ namespace MWScript
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;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,11 +1,10 @@
#include "cells.hpp"
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "class.hpp"
#include "esmstore.hpp"
#include "containerstore.hpp"
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;
}
MWWorld::Cells::Cells (const ESMS::ESMStore& store, ESM::ESMReader& reader)
MWWorld::Cells::Cells (const MWWorld::ESMStore& store, ESM::ESMReader& reader)
: mStore (store), mReader (reader),
mIdCache (20, std::pair<std::string, Ptr::CellStore *> ("", (Ptr::CellStore*)0)), /// \todo make cache size configurable
mIdCacheIndex (0)
@ -265,7 +264,7 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name)
}
// 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)
{
Ptr::CellStore *cellStore = getCellStore (iter->second);
@ -276,7 +275,7 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name)
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)
{
Ptr::CellStore *cellStore = getCellStore (iter->second);

View file

@ -11,17 +11,14 @@ namespace ESM
class ESMReader;
}
namespace ESM
{
class ESMStore;
}
namespace MWWorld
{
class ESMStore;
/// \brief Cell container
class Cells
{
const ESMS::ESMStore& mStore;
const MWWorld::ESMStore& mStore;
ESM::ESMReader& mReader;
std::map<std::string, CellStore> mInteriors;
std::map<std::pair<int, int>, CellStore> mExteriors;
@ -39,7 +36,7 @@ namespace MWWorld
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
/// world

View file

@ -2,12 +2,11 @@
#include <iostream>
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "ptr.hpp"
#include "esmstore.hpp"
namespace MWWorld
{
@ -16,7 +15,7 @@ namespace MWWorld
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)
{
@ -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)
{
@ -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);
@ -67,7 +66,7 @@ namespace MWWorld
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);

View file

@ -8,14 +8,10 @@
#include "refdata.hpp"
namespace ESMS
{
struct ESMStore;
}
namespace MWWorld
{
class Ptr;
class ESMStore;
/// A reference to one object (of any type) in a cell.
///
@ -122,9 +118,9 @@ namespace MWWorld
CellRefList<ESM::Static> statics;
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
/// false will abort the iteration.
@ -183,9 +179,9 @@ namespace MWWorld
}
/// 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);
};
}

View file

@ -145,7 +145,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImpl (const Ptr& ptr
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();
++iter)

View file

@ -83,7 +83,7 @@ namespace MWWorld
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.
void clear();

View file

@ -1,31 +1,21 @@
#include "esmstore.hpp"
#include <set>
#include <iostream>
#include "store.hpp"
using namespace std;
using namespace ESM;
using namespace ESMS;
/*
static string toStr(int i)
namespace MWWorld
{
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;
// Loop through all records
while(esm.hasMoreRecs())
{
NAME n = esm.getRecName();
ESM::NAME n = esm.getRecName();
esm.getRecHeader();
// Look up the record type.
@ -71,7 +61,8 @@ void ESMStore::load(ESMReader &esm)
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);
@ -84,20 +75,22 @@ void ESMStore::load(ESMReader &esm)
// Insert the reference into the global lookup
if(!id.empty() &&
(n.val==REC_ACTI || n.val==REC_ALCH || n.val==REC_APPA || n.val==REC_ARMO ||
n.val==REC_BOOK || n.val==REC_CLOT || n.val==REC_CONT || n.val==REC_CREA ||
n.val==REC_DOOR || n.val==REC_INGR || n.val==REC_LEVC || n.val==REC_LEVI ||
n.val==REC_LIGH || n.val==REC_LOCK || n.val==REC_MISC || n.val==REC_NPC_ ||
n.val==REC_PROB || n.val==REC_REPA || n.val==REC_STAT || n.val==REC_WEAP)
(n.val==ESM::REC_ACTI || n.val==ESM::REC_ALCH || n.val==ESM::REC_APPA || n.val==ESM::REC_ARMO ||
n.val==ESM::REC_BOOK || n.val==ESM::REC_CLOT || n.val==ESM::REC_CONT || n.val==ESM::REC_CREA ||
n.val==ESM::REC_DOOR || n.val==ESM::REC_INGR || n.val==ESM::REC_LEVC || n.val==ESM::REC_LEVI ||
n.val==ESM::REC_LIGH || n.val==ESM::REC_LOCK || n.val==ESM::REC_MISC || n.val==ESM::REC_NPC_ ||
n.val==ESM::REC_PROB || n.val==ESM::REC_REPA || n.val==ESM::REC_STAT || n.val==ESM::REC_WEAP)
)
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];
attributes.list.insert(std::make_pair(id, Attribute(id, Attribute::sGmstAttributeIds[i], Attribute::sGmstAttributeDescIds[i])));
typedef ESM::Attribute EsmAttr;
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
@ -113,3 +106,5 @@ void ESMStore::load(ESMReader &esm)
cout << endl;
*/
}
} // end namespace

View file

@ -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

View file

@ -3,7 +3,7 @@
#include <stdexcept>
#include <components/esm_store/store.hpp>
#include "esmstore.hpp"
namespace MWWorld
{
@ -27,9 +27,9 @@ namespace MWWorld
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)
{
char type = ' ';

View file

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

View file

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

View file

@ -1,8 +1,6 @@
#include "localscripts.hpp"
#include <components/esm_store/store.hpp>
#include "esmstore.hpp"
#include "cellstore.hpp"
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)
{

View file

@ -6,13 +6,9 @@
#include "ptr.hpp"
namespace ESMS
{
struct ESMStore;
}
namespace MWWorld
{
struct ESMStore;
class CellStore;
/// \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> >::iterator mIter;
MWWorld::Ptr mIgnore;
const ESMS::ESMStore& mStore;
const MWWorld::ESMStore& mStore;
public:
LocalScripts (const ESMS::ESMStore& store);
LocalScripts (const MWWorld::ESMStore& store);
void setIgnore (const Ptr& ptr);
///< Mark a single reference for ignoring during iteration over local scripts (will revoke

View file

@ -3,8 +3,7 @@
#include <boost/any.hpp>
#include <components/esm_store/store.hpp>
#include "esmstore.hpp"
#include "ptr.hpp"
#include "cellstore.hpp"
@ -20,7 +19,7 @@ namespace MWWorld
ManualRef& operator= (const ManualRef&);
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))
{
@ -37,7 +36,7 @@ namespace MWWorld
}
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))
{
@ -55,7 +54,7 @@ namespace MWWorld
public:
ManualRef (const ESMS::ESMStore& store, const std::string& name)
ManualRef (const MWWorld::ESMStore& store, const std::string& name)
{
// create
if (!create (store.activators, name) &&

View file

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

View file

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

View file

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

View file

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

View file

@ -20,7 +20,7 @@ using namespace Ogre;
namespace
{
template<typename T>
void listCellScripts (const ESMS::ESMStore& store,
void listCellScripts (const MWWorld::ESMStore& store,
MWWorld::CellRefList<T>& cellRefList, MWWorld::LocalScripts& localScripts,
MWWorld::Ptr::CellStore *cell)
{
@ -228,12 +228,12 @@ namespace MWWorld
return cell;
// 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)
{
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))
return cell;
@ -260,7 +260,7 @@ namespace MWWorld
return *mPlayer;
}
const ESMS::ESMStore& World::getStore() const
const MWWorld::ESMStore& World::getStore() const
{
return mStore;
}

View file

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

View file

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

View file

@ -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