Stub out CellStore::get<T> accessors in preparation of reference movement between cells

openmw-38
scrawl 9 years ago
parent 4a9b37aa53
commit 0975f60d59

@ -130,6 +130,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
return MWWorld::Ptr(&cell.get<ESM::Activator>().insert(*ref), &cell);
return MWWorld::Ptr();
//return MWWorld::Ptr(&cell.get<ESM::Activator>().insert(*ref), &cell);
}
}

@ -147,8 +147,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Apparatus>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Apparatus>().insert(*ref), &cell);
}
bool Apparatus::canSell (const MWWorld::Ptr& item, int npcServices) const

@ -381,8 +381,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Armor>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Armor>().insert(*ref), &cell);
}
int Armor::getEnchantmentPoints (const MWWorld::Ptr& ptr) const

@ -186,8 +186,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Book>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Book>().insert(*ref), &cell);
}
int Book::getEnchantmentPoints (const MWWorld::Ptr& ptr) const

@ -275,8 +275,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Clothing>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Clothing>().insert(*ref), &cell);
}
int Clothing::getEnchantmentPoints (const MWWorld::Ptr& ptr) const

@ -292,8 +292,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Container>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Container>().insert(*ref), &cell);
}
void Container::readAdditionalState (const MWWorld::Ptr& ptr, const ESM::ObjectState& state) const

@ -599,8 +599,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Creature>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Creature>().insert(*ref), &cell);
}
bool Creature::isBipedal(const MWWorld::Ptr &ptr) const

@ -309,8 +309,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Door>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Door>().insert(*ref), &cell);
}
void Door::ensureCustomData(const MWWorld::Ptr &ptr) const

@ -184,8 +184,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Ingredient>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Ingredient>().insert(*ref), &cell);
}
bool Ingredient::canSell (const MWWorld::Ptr& item, int npcServices) const

@ -216,8 +216,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Light>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Light>().insert(*ref), &cell);
}
bool Light::canSell (const MWWorld::Ptr& item, int npcServices) const

@ -165,8 +165,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Lockpick> *ref =
ptr.get<ESM::Lockpick>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Lockpick>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Lockpick>().insert(*ref), &cell);
}
bool Lockpick::canSell (const MWWorld::Ptr& item, int npcServices) const

@ -194,6 +194,7 @@ namespace MWClass
{
MWWorld::Ptr newPtr;
/*
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
@ -223,6 +224,7 @@ namespace MWClass
ptr.get<ESM::Miscellaneous>();
newPtr = MWWorld::Ptr(&cell.get<ESM::Miscellaneous>().insert(*ref), &cell);
}
*/
return newPtr;
}

@ -1129,8 +1129,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::NPC>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::NPC>().insert(*ref), &cell);
}
int Npc::getSkill(const MWWorld::Ptr& ptr, int skill) const

@ -177,8 +177,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Potion>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Potion>().insert(*ref), &cell);
}
bool Potion::canSell (const MWWorld::Ptr& item, int npcServices) const

@ -164,8 +164,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Probe>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Probe>().insert(*ref), &cell);
}
bool Probe::canSell (const MWWorld::Ptr& item, int npcServices) const

@ -159,8 +159,9 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Repair>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Repair>().insert(*ref), &cell);
}
boost::shared_ptr<MWWorld::Action> Repair::use (const MWWorld::Ptr& ptr) const

@ -59,7 +59,8 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Static> *ref =
ptr.get<ESM::Static>();
return MWWorld::Ptr();
return MWWorld::Ptr(&cell.get<ESM::Static>().insert(*ref), &cell);
//return MWWorld::Ptr(&cell.get<ESM::Static>().insert(*ref), &cell);
}
}

@ -417,7 +417,8 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return MWWorld::Ptr(&cell.get<ESM::Weapon>().insert(*ref), &cell);
return MWWorld::Ptr();
//return MWWorld::Ptr(&cell.get<ESM::Weapon>().insert(*ref), &cell);
}
int Weapon::getEnchantmentPoints (const MWWorld::Ptr& ptr) const

@ -44,6 +44,7 @@ namespace MWMechanics
return MWWorld::Ptr(); // check interior cells only
// Check all the doors in this cell
/*
MWWorld::CellRefList<ESM::Door>& doors = cell->get<ESM::Door>();
MWWorld::CellRefList<ESM::Door>::List& refList = doors.mList;
MWWorld::CellRefList<ESM::Door>::List::iterator it = refList.begin();
@ -66,6 +67,7 @@ namespace MWMechanics
return MWWorld::Ptr(&ref, actor.getCell()); // found, stop searching
}
}
*/
return MWWorld::Ptr(); // none found
}

@ -73,6 +73,7 @@ namespace MWWorld
MWWorld::TimeStamp mLastRespawn;
// List of refs owned by this cell
CellRefList<ESM::Activator> mActivators;
CellRefList<ESM::Potion> mPotions;
CellRefList<ESM::Apparatus> mAppas;
@ -179,6 +180,8 @@ namespace MWWorld
forEachImp (functor, mNpcs);
}
/// \todo add const version of forEach
bool isExterior() const;
Ptr searchInContainer (const std::string& id);
@ -198,16 +201,6 @@ namespace MWWorld
void respawn ();
///< Check mLastRespawn and respawn references if necessary. This is a no-op if the cell is not loaded.
template <class T>
CellRefList<T>& get() {
throw std::runtime_error ("Storage for type " + std::string(typeid(T).name())+ " does not exist in cells");
}
template <class T>
const CellRefList<T>& getReadOnly() {
throw std::runtime_error ("Read Only CellRefList access not available for type " + std::string(typeid(T).name()) );
}
bool isPointConnected(const int start, const int end) const;
std::list<ESM::Pathgrid::Point> aStarSearch(const int start, const int end) const;
@ -241,152 +234,6 @@ namespace MWWorld
MWMechanics::PathgridGraph mPathgridGraph;
};
template<>
inline CellRefList<ESM::Activator>& CellStore::get<ESM::Activator>()
{
mHasState = true;
return mActivators;
}
template<>
inline CellRefList<ESM::Potion>& CellStore::get<ESM::Potion>()
{
mHasState = true;
return mPotions;
}
template<>
inline CellRefList<ESM::Apparatus>& CellStore::get<ESM::Apparatus>()
{
mHasState = true;
return mAppas;
}
template<>
inline CellRefList<ESM::Armor>& CellStore::get<ESM::Armor>()
{
mHasState = true;
return mArmors;
}
template<>
inline CellRefList<ESM::Book>& CellStore::get<ESM::Book>()
{
mHasState = true;
return mBooks;
}
template<>
inline CellRefList<ESM::Clothing>& CellStore::get<ESM::Clothing>()
{
mHasState = true;
return mClothes;
}
template<>
inline CellRefList<ESM::Container>& CellStore::get<ESM::Container>()
{
mHasState = true;
return mContainers;
}
template<>
inline CellRefList<ESM::Creature>& CellStore::get<ESM::Creature>()
{
mHasState = true;
return mCreatures;
}
template<>
inline CellRefList<ESM::Door>& CellStore::get<ESM::Door>()
{
mHasState = true;
return mDoors;
}
template<>
inline CellRefList<ESM::Ingredient>& CellStore::get<ESM::Ingredient>()
{
mHasState = true;
return mIngreds;
}
template<>
inline CellRefList<ESM::CreatureLevList>& CellStore::get<ESM::CreatureLevList>()
{
mHasState = true;
return mCreatureLists;
}
template<>
inline CellRefList<ESM::ItemLevList>& CellStore::get<ESM::ItemLevList>()
{
mHasState = true;
return mItemLists;
}
template<>
inline CellRefList<ESM::Light>& CellStore::get<ESM::Light>()
{
mHasState = true;
return mLights;
}
template<>
inline CellRefList<ESM::Lockpick>& CellStore::get<ESM::Lockpick>()
{
mHasState = true;
return mLockpicks;
}
template<>
inline CellRefList<ESM::Miscellaneous>& CellStore::get<ESM::Miscellaneous>()
{
mHasState = true;
return mMiscItems;
}
template<>
inline CellRefList<ESM::NPC>& CellStore::get<ESM::NPC>()
{
mHasState = true;
return mNpcs;
}
template<>
inline CellRefList<ESM::Probe>& CellStore::get<ESM::Probe>()
{
mHasState = true;
return mProbes;
}
template<>
inline CellRefList<ESM::Repair>& CellStore::get<ESM::Repair>()
{
mHasState = true;
return mRepairs;
}
template<>
inline CellRefList<ESM::Static>& CellStore::get<ESM::Static>()
{
mHasState = true;
return mStatics;
}
template<>
inline CellRefList<ESM::Weapon>& CellStore::get<ESM::Weapon>()
{
mHasState = true;
return mWeapons;
}
template<>
inline const CellRefList<ESM::Door>& CellStore::getReadOnly<ESM::Door>()
{
return mDoors;
}
bool operator== (const CellStore& left, const CellStore& right);
bool operator!= (const CellStore& left, const CellStore& right);
}

@ -116,6 +116,7 @@ void MWWorld::LocalScripts::add (const std::string& scriptName, const Ptr& ptr)
void MWWorld::LocalScripts::addCell (CellStore *cell)
{
/*
listCellScripts (*this, cell->get<ESM::Activator>(), cell);
listCellScripts (*this, cell->get<ESM::Potion>(), cell);
listCellScripts (*this, cell->get<ESM::Apparatus>(), cell);
@ -136,6 +137,7 @@ void MWWorld::LocalScripts::addCell (CellStore *cell)
listCellScripts (*this, cell->get<ESM::Probe>(), cell);
listCellScripts (*this, cell->get<ESM::Repair>(), cell);
listCellScripts (*this, cell->get<ESM::Weapon>(), cell);
*/
}
void MWWorld::LocalScripts::clear()

@ -1693,6 +1693,7 @@ namespace MWWorld
osg::Vec2f World::getNorthVector (CellStore* cell)
{
/*
MWWorld::CellRefList<ESM::Static>& statics = cell->get<ESM::Static>();
MWWorld::LiveCellRef<ESM::Static>* ref = statics.find("northmarker");
if (!ref)
@ -1702,10 +1703,13 @@ namespace MWWorld
osg::Vec3f dir = orient * osg::Vec3f(0,1,0);
osg::Vec2f d (dir.x(), dir.y());
return d;
*/
return osg::Vec2f();
}
void World::getDoorMarkers (CellStore* cell, std::vector<World::DoorMarker>& out)
{
/*
MWWorld::CellRefList<ESM::Door>& doors = cell->get<ESM::Door>();
CellRefList<ESM::Door>::List& refList = doors.mList;
for (CellRefList<ESM::Door>::List::iterator it = refList.begin(); it != refList.end(); ++it)
@ -1744,6 +1748,7 @@ namespace MWWorld
out.push_back(newMarker);
}
}
*/
}
void World::setWaterHeight(const float height)
@ -2240,6 +2245,7 @@ namespace MWWorld
void World::getContainersOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out)
{
/*
const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells();
for (Scene::CellStoreCollection::const_iterator cellIt = collection.begin(); cellIt != collection.end(); ++cellIt)
{
@ -2254,6 +2260,7 @@ namespace MWWorld
out.push_back(ptr);
}
}
*/
}
struct ListObjectsFunctor
@ -2316,6 +2323,8 @@ namespace MWWorld
bool World::findInteriorPosition(const std::string &name, ESM::Position &pos)
{
return false;
/*
typedef MWWorld::CellRefList<ESM::Door>::List DoorList;
typedef MWWorld::CellRefList<ESM::Static>::List StaticList;
@ -2368,6 +2377,7 @@ namespace MWWorld
pos = statics.begin()->mRef.getPosition();
return true;
}
*/
return false;
}
@ -2715,6 +2725,8 @@ namespace MWWorld
bool World::findInteriorPositionInWorldSpace(MWWorld::CellStore* cell, osg::Vec3f& result)
{
return false;
/*
if (cell->isExterior())
return false;
@ -2732,7 +2744,7 @@ namespace MWWorld
MWWorld::CellStore *next = getInterior( *i );
if ( !next ) continue;
const MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnly<ESM::Door>();
const MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnlyDoors();
const CellRefList<ESM::Door>::List& refList = doors.mList;
// Check if any door in the cell leads to an exterior directly
@ -2761,10 +2773,12 @@ namespace MWWorld
// No luck :(
return false;
*/
}
MWWorld::Ptr World::getClosestMarker( const MWWorld::Ptr &ptr, const std::string &id )
{
/*
if ( ptr.getCell()->isExterior() ) {
return getClosestMarkerFromExteriorPosition(mPlayer->getLastKnownExteriorPosition(), id);
}
@ -2792,7 +2806,7 @@ namespace MWWorld
return closestMarker;
}
const MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnly<ESM::Door>();
const MWWorld::CellRefList<ESM::Door>& doors = next->getReadOnlyDoors();
const CellRefList<ESM::Door>::List& doorList = doors.mList;
// Check if any door in the cell leads to an exterior directly
@ -2816,7 +2830,7 @@ namespace MWWorld
}
}
}
*/
return MWWorld::Ptr();
}

Loading…
Cancel
Save