mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-02 22:45:33 +00:00
applying new interface vol.9, inconsistent
This commit is contained in:
parent
932a9dc6f9
commit
ff8da265ed
12 changed files with 48 additions and 44 deletions
|
@ -26,7 +26,7 @@ namespace MWScript
|
|||
void GlobalScripts::addScript (const std::string& name)
|
||||
{
|
||||
if (mScripts.find (name)==mScripts.end())
|
||||
if (const ESM::Script *script = mStore.scripts.find (name))
|
||||
if (const ESM::Script *script = mStore.get<ESM::Script>().find (name))
|
||||
{
|
||||
Locals locals;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace MWScript
|
|||
|
||||
bool Success = true;
|
||||
|
||||
if (const ESM::Script *script = mStore.scripts.find (name))
|
||||
if (const ESM::Script *script = mStore.get<ESM::Script>().find (name))
|
||||
{
|
||||
if (mVerbose)
|
||||
std::cout << "compiling script: " << name << std::endl;
|
||||
|
@ -125,15 +125,14 @@ namespace MWScript
|
|||
|
||||
std::pair<int, int> ScriptManager::compileAll()
|
||||
{
|
||||
typedef MWWorld::ScriptListT<ESM::Script>::MapType Container;
|
||||
|
||||
const Container& scripts = mStore.scripts.list;
|
||||
|
||||
int count = 0;
|
||||
int success = 0;
|
||||
|
||||
for (Container::const_iterator iter (scripts.begin()); iter!=scripts.end(); ++iter, ++count)
|
||||
if (compile (iter->first))
|
||||
const MWWorld::Store<ESM::Script>& scripts = mStore.get<ESM::Script>();
|
||||
MWWorld::Store<ESM::Script>::iterator it = scripts.begin();
|
||||
|
||||
for (; it != scripts.end(); ++iter, ++count)
|
||||
if (compile (it->mId))
|
||||
++success;
|
||||
|
||||
return std::make_pair (count, success);
|
||||
|
@ -170,7 +169,7 @@ namespace MWScript
|
|||
int ScriptManager::getLocalIndex (const std::string& scriptId, const std::string& variable,
|
||||
char type)
|
||||
{
|
||||
const ESM::Script *script = mStore.scripts.find (scriptId);
|
||||
const ESM::Script *script = mStore.get<ESM::Script>().find (scriptId);
|
||||
|
||||
int offset = 0;
|
||||
int size = 0;
|
||||
|
|
|
@ -42,8 +42,11 @@ namespace MWWorld
|
|||
&& !npcStats.hasBeenUsed (ref->mBase->mId))
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC> *playerRef = player.get<ESM::NPC>();
|
||||
const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find (
|
||||
playerRef->mBase->mClass);
|
||||
|
||||
const ESM::Class *class_ =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find (
|
||||
playerRef->mBase->mClass
|
||||
);
|
||||
|
||||
npcStats.increaseSkill (ref->mBase->mData.mSkillID, *class_, true);
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y)
|
|||
|
||||
if (result==mExteriors.end())
|
||||
{
|
||||
const ESM::Cell *cell = mStore.cells.searchExt (x, y);
|
||||
const ESM::Cell *cell = mStore.get<ESM::Cell>().search(x, y);
|
||||
|
||||
if (!cell)
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getInterior (const std::string& name)
|
|||
|
||||
if (result==mInteriors.end())
|
||||
{
|
||||
const ESM::Cell *cell = mStore.cells.findInt (name);
|
||||
const ESM::Cell *cell = mStore.get<ESM::Cell>().find(name);
|
||||
|
||||
result = mInteriors.insert (std::make_pair (name, Ptr::CellStore (cell))).first;
|
||||
}
|
||||
|
@ -264,10 +264,12 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name)
|
|||
}
|
||||
|
||||
// Now try the other cells
|
||||
for (MWWorld::CellList::IntCells::const_iterator iter = mStore.cells.intCells.begin();
|
||||
iter!=mStore.cells.intCells.end(); ++iter)
|
||||
const MWWorld::Store<ESM::Cell> &cells = mStore.get<ESM::Cell>();
|
||||
MWWorld::Store<ESM::Cell>::iterator iter;
|
||||
|
||||
for (iter = cells.intBegin(); iter != cells.intEnd(); ++iter)
|
||||
{
|
||||
Ptr::CellStore *cellStore = getCellStore (iter->second);
|
||||
Ptr::CellStore *cellStore = getCellStore (*iter);
|
||||
|
||||
Ptr ptr = getPtrAndCache (name, *cellStore);
|
||||
|
||||
|
@ -275,10 +277,9 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
for (MWWorld::CellList::ExtCells::const_iterator iter = mStore.cells.extCells.begin();
|
||||
iter!=mStore.cells.extCells.end(); ++iter)
|
||||
for (iter = cells.extBegin(); iter != cells.extEnd(); ++it)
|
||||
{
|
||||
Ptr::CellStore *cellStore = getCellStore (iter->second);
|
||||
Ptr::CellStore *cellStore = getCellStore (*iter);
|
||||
|
||||
Ptr ptr = getPtrAndCache (name, *cellStore);
|
||||
|
||||
|
|
|
@ -74,9 +74,12 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr)
|
|||
{
|
||||
int type = getType(ptr);
|
||||
|
||||
const MWWorld::ESMStore &esmStore =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
// gold needs special handling: when it is inserted into a container, the base object automatically becomes Gold_001
|
||||
// this ensures that gold piles of different sizes stack with each other (also, several scripts rely on Gold_001 for detecting player gold)
|
||||
if (MWWorld::Class::get(ptr).getName(ptr) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
|
||||
if (MWWorld::Class::get(ptr).getName(ptr) == esmStore.get<ESM::GameSetting>().find("sGold")->getString())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *gold =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
@ -87,7 +90,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr)
|
|||
|| compare_string_ci(gold->mRef.mRefID, "gold_025")
|
||||
|| compare_string_ci(gold->mRef.mRefID, "gold_100"))
|
||||
{
|
||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), "Gold_001");
|
||||
MWWorld::ManualRef ref(esmStore, "Gold_001");
|
||||
|
||||
int count = (ptr.getRefData().getCount() == 1) ? gold->mBase->mData.mValue : ptr.getRefData().getCount();
|
||||
ref.getPtr().getRefData().setCount(count);
|
||||
|
|
|
@ -230,7 +230,7 @@ const MWMechanics::MagicEffects& MWWorld::InventoryStore::getMagicEffects()
|
|||
if (!enchantmentId.empty())
|
||||
{
|
||||
const ESM::Enchantment& enchantment =
|
||||
*MWBase::Environment::get().getWorld()->getStore().enchants.find (enchantmentId);
|
||||
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find (enchantmentId);
|
||||
|
||||
if (enchantment.mData.mType==ESM::Enchantment::ConstantEffect)
|
||||
mMagicEffects.add (enchantment.mEffects);
|
||||
|
|
|
@ -61,7 +61,7 @@ std::pair<std::string, MWWorld::Ptr> MWWorld::LocalScripts::getNext()
|
|||
|
||||
void MWWorld::LocalScripts::add (const std::string& scriptName, const Ptr& ptr)
|
||||
{
|
||||
if (const ESM::Script *script = mStore.scripts.find (scriptName))
|
||||
if (const ESM::Script *script = mStore.get<ESM::Script>().find (scriptName))
|
||||
{
|
||||
ptr.getRefData().setLocals (*script);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace MWWorld
|
|||
playerPos[0] = playerPos[1] = playerPos[2] = 0;
|
||||
|
||||
/// \todo Do not make a copy of classes defined in esm/p records.
|
||||
mClass = new ESM::Class (*world.getStore().classes.find (player->mClass));
|
||||
mClass = new ESM::Class (*world.getStore().get<ESM::Class>().find (player->mClass));
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace MWWorld
|
|||
if ((*iter)->mCell->isExterior())
|
||||
{
|
||||
ESM::Land* land =
|
||||
MWBase::Environment::get().getWorld()->getStore().lands.search(
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
|
||||
(*iter)->mCell->getGridX(),
|
||||
(*iter)->mCell->getGridY()
|
||||
);
|
||||
|
@ -118,7 +118,7 @@ namespace MWWorld
|
|||
if (cell->mCell->isExterior())
|
||||
{
|
||||
ESM::Land* land =
|
||||
MWBase::Environment::get().getWorld()->getStore().lands.search(
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
|
||||
cell->mCell->getGridX(),
|
||||
cell->mCell->getGridY()
|
||||
);
|
||||
|
|
|
@ -490,7 +490,7 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
/// \todo implement appropriate index
|
||||
const ESM::Cell *searchExteriorByName(const std::string &id) const {
|
||||
const ESM::Cell *searchExtByName(const std::string &id) const {
|
||||
std::vector<ESM::Cell *>::const_iterator it = mSharedExt.begin();
|
||||
for (; it != mSharedExt.end(); ++it) {
|
||||
if (StringUtils::ciEqual((*it)->mName, id)) {
|
||||
|
@ -501,7 +501,7 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
/// \todo implement appropriate index
|
||||
const ESM::Cell *searchExteriorByRegion(const std::string &id) const {
|
||||
const ESM::Cell *searchExtByRegion(const std::string &id) const {
|
||||
std::vector<ESM::Cell *>::const_iterator it = mSharedExt.begin();
|
||||
for (; it != mSharedExt.end(); ++it) {
|
||||
if (StringUtils::ciEqual((*it)->mRegion, id)) {
|
||||
|
|
|
@ -511,7 +511,8 @@ void WeatherManager::update(float duration)
|
|||
else
|
||||
{
|
||||
// get weather probabilities for the current region
|
||||
const ESM::Region *region = MWBase::Environment::get().getWorld()->getStore().regions.search (regionstr);
|
||||
const ESM::Region *region =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().search (regionstr);
|
||||
|
||||
if (region != 0)
|
||||
{
|
||||
|
|
|
@ -186,7 +186,7 @@ namespace MWWorld
|
|||
mEsm.open (masterPath.string());
|
||||
mStore.load (mEsm);
|
||||
|
||||
mPlayer = new MWWorld::Player (mStore.npcs.find ("player"), *this);
|
||||
mPlayer = new MWWorld::Player (mStore.get<ESM::NPC>().find ("player"), *this);
|
||||
mRendering->attachCameraTo(mPlayer->getPlayer());
|
||||
|
||||
std::string playerCollisionFile = "meshes\\base_anim.nif"; //This is used to make a collision shape for our player
|
||||
|
@ -224,21 +224,19 @@ namespace MWWorld
|
|||
const ESM::Cell *World::getExterior (const std::string& cellName) const
|
||||
{
|
||||
// first try named cells
|
||||
if (const ESM::Cell *cell = mStore.cells.searchExtByName (cellName))
|
||||
const ESM::Cell *cell = mStore.get<ESM::Cell>().searchExtByName (cellName);
|
||||
if (cell != 0) {
|
||||
return cell;
|
||||
}
|
||||
|
||||
// didn't work -> now check for regions
|
||||
std::string cellName2 = MWWorld::RecListT<ESM::Region>::toLower (cellName);
|
||||
|
||||
for (MWWorld::RecListT<ESM::Region>::MapType::const_iterator iter (mStore.regions.list.begin());
|
||||
iter!=mStore.regions.list.end(); ++iter)
|
||||
const MWWorld::Store<ESM::Region> ®ions = mStore.get<ESM::Region>();
|
||||
MWWorld::Store<ESM::Region>::iterator it = regions.begin();
|
||||
for (; it != regions.end(); ++it)
|
||||
{
|
||||
if (MWWorld::RecListT<ESM::Region>::toLower (iter->second.mName)==cellName2)
|
||||
if (MWWorld::StringUtils::ciEqual(cellName, it->mName))
|
||||
{
|
||||
if (const ESM::Cell *cell = mStore.cells.searchExtByRegion (iter->first))
|
||||
return cell;
|
||||
|
||||
break;
|
||||
return mStore.get<ESM::Cell>().searchExtByRegion(it->mId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -536,7 +534,7 @@ namespace MWWorld
|
|||
std::pair<std::string, float> result = mPhysics->getFacedHandle (*this);
|
||||
|
||||
if (result.first.empty() ||
|
||||
result.second>getStore().gameSettings.find ("iMaxActivateDist")->getInt())
|
||||
result.second>getStore().get<ESM::GameSetting>().find ("iMaxActivateDist")->getInt())
|
||||
return "";
|
||||
|
||||
return result.first;
|
||||
|
@ -1103,13 +1101,12 @@ namespace MWWorld
|
|||
// door leads to exterior, use cell name (if any), otherwise translated region name
|
||||
int x,y;
|
||||
positionToIndex (ref.mRef.mDoorDest.pos[0], ref.mRef.mDoorDest.pos[1], x, y);
|
||||
const ESM::Cell* cell = mStore.cells.findExt(x,y);
|
||||
const ESM::Cell* cell = mStore.get<ESM::Cell>().find(x,y);
|
||||
if (cell->mName != "")
|
||||
dest = cell->mName;
|
||||
else
|
||||
{
|
||||
const ESM::Region* region = mStore.regions.search(cell->mRegion);
|
||||
dest = region->mName;
|
||||
dest = mStore.get<ESM::Region>().find(cell->mRegion)->mName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue