OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MWWorld::CellStore Class Reference

Mutable state of a cell. More...

#include <cellstore.hpp>

Collaboration diagram for MWWorld::CellStore:

Classes

struct  GetCellStoreCallback
 

Public Types

enum  State { State_Unloaded, State_Preloaded, State_Loaded }
 

Public Member Functions

MWWorld::Ptr moveTo (const MWWorld::Ptr &object, MWWorld::CellStore *cellToMoveTo)
 
void rest ()
 
template<typename T >
LiveCellRefBaseinsert (const LiveCellRef< T > *ref)
 
 CellStore (const ESM::Cell *cell_, const MWWorld::ESMStore &store, std::vector< ESM::ESMReader > &readerList)
 
const ESM::CellgetCell () const
 
State getState () const
 
const std::vector< std::string > & getPreloadedIds () const
 Get Ids of objects in this cell, only valid in State_Preloaded. More...
 
bool hasState () const
 Does this cell have state that needs to be stored in a saved game file? More...
 
bool hasId (const std::string &id) const
 
Ptr search (const std::string &id)
 
ConstPtr searchConst (const std::string &id) const
 
Ptr searchViaActorId (int id)
 Will return an empty Ptr if cell is not loaded. More...
 
float getWaterLevel () const
 
void setWaterLevel (float level)
 
void setFog (ESM::FogState *fog)
 
ESM::FogStategetFog () const
 
int count () const
 Return total number of references, including deleted ones. More...
 
void load ()
 Load references from content file. More...
 
void preload ()
 Build ID list from content file. More...
 
template<class Visitor >
bool forEach (Visitor &visitor)
 
template<class Visitor >
bool forEachConst (Visitor &visitor) const
 
template<class T , class Visitor >
bool forEachType (Visitor &visitor)
 
const CellRefList< ESM::Door > & getReadOnlyDoors () const
 
const CellRefList< ESM::Static > & getReadOnlyStatics () const
 
bool isExterior () const
 
Ptr searchInContainer (const std::string &id)
 
void loadState (const ESM::CellState &state)
 
void saveState (ESM::CellState &state) const
 
void writeFog (ESM::ESMWriter &writer) const
 
void readFog (ESM::ESMReader &reader)
 
void writeReferences (ESM::ESMWriter &writer) const
 
void readReferences (ESM::ESMReader &reader, const std::map< int, int > &contentFileMap, GetCellStoreCallback *callback)
 
void respawn ()
 Check mLastRespawn and respawn references if necessary. This is a no-op if the cell is not loaded. More...
 

Static Public Member Functions

static bool isAccessible (const MWWorld::RefData &refdata, const MWWorld::CellRef &cref)
 

Private Types

typedef std::map
< LiveCellRefBase
*, MWWorld::CellStore * > 
MovedRefTracker
 

Private Member Functions

Ptr getCurrentPtr (MWWorld::LiveCellRefBase *ref)
 
void moveFrom (const MWWorld::Ptr &object, MWWorld::CellStore *from)
 Moves object from the given cell to this cell. More...
 
void updateMergedRefs ()
 Repopulate mMergedRefs. More...
 
template<class Visitor , class List >
bool forEachImp (Visitor &visitor, List &list)
 
template<class Visitor >
bool forEachInternal (Visitor &visitor)
 
template<class T >
CellRefList< T > & get ()
 
void listRefs ()
 Run through references and store IDs. More...
 
void loadRefs ()
 
void loadRef (ESM::CellRef &ref, bool deleted, std::map< ESM::RefNum, std::string > &refNumToID)
 

Private Attributes

const MWWorld::ESMStoremStore
 
std::vector< ESM::ESMReader > & mReader
 
std::shared_ptr< ESM::FogStatemFogState
 
const ESM::CellmCell
 
State mState
 
bool mHasState
 
std::vector< std::string > mIds
 
float mWaterLevel
 
MWWorld::TimeStamp mLastRespawn
 
CellRefList< ESM::ActivatormActivators
 
CellRefList< ESM::PotionmPotions
 
CellRefList< ESM::ApparatusmAppas
 
CellRefList< ESM::ArmormArmors
 
CellRefList< ESM::BookmBooks
 
CellRefList< ESM::ClothingmClothes
 
CellRefList< ESM::ContainermContainers
 
CellRefList< ESM::CreaturemCreatures
 
CellRefList< ESM::DoormDoors
 
CellRefList< ESM::IngredientmIngreds
 
CellRefList< ESM::CreatureLevListmCreatureLists
 
CellRefList< ESM::ItemLevListmItemLists
 
CellRefList< ESM::LightmLights
 
CellRefList< ESM::LockpickmLockpicks
 
CellRefList< ESM::MiscellaneousmMiscItems
 
CellRefList< ESM::NPCmNpcs
 
CellRefList< ESM::ProbemProbes
 
CellRefList< ESM::RepairmRepairs
 
CellRefList< ESM::StaticmStatics
 
CellRefList< ESM::WeaponmWeapons
 
CellRefList< ESM::BodyPartmBodyParts
 
MovedRefTracker mMovedHere
 
MovedRefTracker mMovedToAnotherCell
 
std::vector< LiveCellRefBase * > mMergedRefs
 

Detailed Description

Mutable state of a cell.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
State_Unloaded 
State_Preloaded 
State_Loaded 

Constructor & Destructor Documentation

MWWorld::CellStore::CellStore ( const ESM::Cell cell_,
const MWWorld::ESMStore store,
std::vector< ESM::ESMReader > &  readerList 
)
Parameters
readerListThe readers to use for loading of the cell on-demand.

Member Function Documentation

int MWWorld::CellStore::count ( ) const

Return total number of references, including deleted ones.

Here is the caller graph for this function:

template<class Visitor >
bool MWWorld::CellStore::forEach ( Visitor &  visitor)
inline

Call visitor (MWWorld::Ptr) for each reference. visitor must return a bool. Returning false will abort the iteration.

Note
Prefer using forEachConst when possible.
Do not modify this cell (i.e. remove/add objects) during the forEach, doing this may result in unintended behaviour.
Attention
This function also lists deleted (count 0) objects!
Returns
Iteration completed?

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Visitor >
bool MWWorld::CellStore::forEachConst ( Visitor &  visitor) const
inline

Call visitor (MWWorld::ConstPtr) for each reference. visitor must return a bool. Returning false will abort the iteration.

Note
Do not modify this cell (i.e. remove/add objects) during the forEach, doing this may result in unintended behaviour.
Attention
This function also lists deleted (count 0) objects!
Returns
Iteration completed?

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Visitor , class List >
bool MWWorld::CellStore::forEachImp ( Visitor &  visitor,
List &  list 
)
inlineprivate

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Visitor >
bool MWWorld::CellStore::forEachInternal ( Visitor &  visitor)
inlineprivate

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T , class Visitor >
bool MWWorld::CellStore::forEachType ( Visitor &  visitor)
inline

Call visitor (ref) for each reference of given type. visitor must return a bool. Returning false will abort the iteration.

Note
Do not modify this cell (i.e. remove/add objects) during the forEach, doing this may result in unintended behaviour.
Attention
This function also lists deleted (count 0) objects!
Returns
Iteration completed?

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
CellRefList<T>& MWWorld::CellStore::get ( )
private
Note
If you get a linker error here, this means the given type can not be stored in a cell. The supported types are defined at the bottom of this file.
const ESM::Cell * MWWorld::CellStore::getCell ( ) const
Ptr MWWorld::CellStore::getCurrentPtr ( MWWorld::LiveCellRefBase ref)
private

Here is the caller graph for this function:

ESM::FogState * MWWorld::CellStore::getFog ( ) const

Here is the caller graph for this function:

const std::vector< std::string > & MWWorld::CellStore::getPreloadedIds ( ) const

Get Ids of objects in this cell, only valid in State_Preloaded.

Here is the caller graph for this function:

const CellRefList<ESM::Door>& MWWorld::CellStore::getReadOnlyDoors ( ) const
inline

Here is the caller graph for this function:

const CellRefList<ESM::Static>& MWWorld::CellStore::getReadOnlyStatics ( ) const
inline

Here is the caller graph for this function:

CellStore::State MWWorld::CellStore::getState ( ) const

Here is the caller graph for this function:

float MWWorld::CellStore::getWaterLevel ( ) const

Here is the call graph for this function:

Here is the caller graph for this function:

bool MWWorld::CellStore::hasId ( const std::string &  id) const

May return true for deleted IDs when in preload state. Will return false, if cell is unloaded.

Note
Will not account for moved references which may exist in Loaded state. Use search() instead if the cell is loaded.

Here is the call graph for this function:

Here is the caller graph for this function:

bool MWWorld::CellStore::hasState ( ) const

Does this cell have state that needs to be stored in a saved game file?

template<typename T >
LiveCellRefBase* MWWorld::CellStore::insert ( const LiveCellRef< T > *  ref)
inline

Make a copy of the given object and insert it into this cell.

Note
If you get a linker error here, this means the given type can not be inserted into a cell. The supported types are defined at the bottom of this file.

Here is the call graph for this function:

Here is the caller graph for this function:

static bool MWWorld::CellStore::isAccessible ( const MWWorld::RefData refdata,
const MWWorld::CellRef cref 
)
inlinestatic

Should this reference be accessible to the outside world (i.e. to scripts / game logic)? Determined based on the deletion flags. By default, objects deleted by content files are never accessible; objects deleted by setCount(0) are still accessible if they came from a content file (needed for vanilla scripting compatibility, and the fact that objects may be "un-deleted" in the original game).

Here is the call graph for this function:

Here is the caller graph for this function:

bool MWWorld::CellStore::isExterior ( ) const

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::CellStore::listRefs ( )
private

Run through references and store IDs.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::CellStore::load ( )

Load references from content file.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::CellStore::loadRef ( ESM::CellRef ref,
bool  deleted,
std::map< ESM::RefNum, std::string > &  refNumToID 
)
private

Make case-adjustments to ref and insert it into the respective container.

Invalid ref objects are silently dropped.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::CellStore::loadRefs ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::CellStore::loadState ( const ESM::CellState state)

Here is the caller graph for this function:

void MWWorld::CellStore::moveFrom ( const MWWorld::Ptr object,
MWWorld::CellStore from 
)
private

Moves object from the given cell to this cell.

Here is the call graph for this function:

Here is the caller graph for this function:

MWWorld::Ptr MWWorld::CellStore::moveTo ( const MWWorld::Ptr object,
MWWorld::CellStore cellToMoveTo 
)

Moves object from this cell to the given cell.

Note
automatically updates given cell by calling cellToMoveTo->moveFrom(...)
throws exception if cellToMoveTo == this
Returns
updated MWWorld::Ptr with the new CellStore pointer set.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::CellStore::preload ( )

Build ID list from content file.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::CellStore::readFog ( ESM::ESMReader reader)

Here is the caller graph for this function:

void MWWorld::CellStore::readReferences ( ESM::ESMReader reader,
const std::map< int, int > &  contentFileMap,
GetCellStoreCallback callback 
)
Parameters
callbackto use for retrieving of additional CellStore objects by ID (required for resolving moved references)

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::CellStore::respawn ( )

Check mLastRespawn and respawn references if necessary. This is a no-op if the cell is not loaded.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::CellStore::rest ( )

Here is the call graph for this function:

void MWWorld::CellStore::saveState ( ESM::CellState state) const

Here is the call graph for this function:

Here is the caller graph for this function:

Ptr MWWorld::CellStore::search ( const std::string &  id)

Will return an empty Ptr if cell is not loaded. Does not check references in containers.

Note
Triggers CellStore hasState flag.

Here is the call graph for this function:

Here is the caller graph for this function:

ConstPtr MWWorld::CellStore::searchConst ( const std::string &  id) const

Will return an empty Ptr if cell is not loaded. Does not check references in containers.

Note
Does not trigger CellStore hasState flag.

Here is the call graph for this function:

Here is the caller graph for this function:

Ptr MWWorld::CellStore::searchInContainer ( const std::string &  id)

Here is the call graph for this function:

Here is the caller graph for this function:

Ptr MWWorld::CellStore::searchViaActorId ( int  id)

Will return an empty Ptr if cell is not loaded.

Here is the call graph for this function:

void MWWorld::CellStore::setFog ( ESM::FogState fog)
Note
Takes ownership of the pointer

Here is the caller graph for this function:

void MWWorld::CellStore::setWaterLevel ( float  level)

Here is the caller graph for this function:

void MWWorld::CellStore::updateMergedRefs ( )
private

Repopulate mMergedRefs.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWWorld::CellStore::writeFog ( ESM::ESMWriter writer) const

Here is the caller graph for this function:

void MWWorld::CellStore::writeReferences ( ESM::ESMWriter writer) const

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

CellRefList<ESM::Activator> MWWorld::CellStore::mActivators
private
CellRefList<ESM::Apparatus> MWWorld::CellStore::mAppas
private
CellRefList<ESM::Armor> MWWorld::CellStore::mArmors
private
CellRefList<ESM::BodyPart> MWWorld::CellStore::mBodyParts
private
CellRefList<ESM::Book> MWWorld::CellStore::mBooks
private
const ESM::Cell* MWWorld::CellStore::mCell
private
CellRefList<ESM::Clothing> MWWorld::CellStore::mClothes
private
CellRefList<ESM::Container> MWWorld::CellStore::mContainers
private
CellRefList<ESM::CreatureLevList> MWWorld::CellStore::mCreatureLists
private
CellRefList<ESM::Creature> MWWorld::CellStore::mCreatures
private
CellRefList<ESM::Door> MWWorld::CellStore::mDoors
private
std::shared_ptr<ESM::FogState> MWWorld::CellStore::mFogState
private
bool MWWorld::CellStore::mHasState
private
std::vector<std::string> MWWorld::CellStore::mIds
private
CellRefList<ESM::Ingredient> MWWorld::CellStore::mIngreds
private
CellRefList<ESM::ItemLevList> MWWorld::CellStore::mItemLists
private
MWWorld::TimeStamp MWWorld::CellStore::mLastRespawn
private
CellRefList<ESM::Light> MWWorld::CellStore::mLights
private
CellRefList<ESM::Lockpick> MWWorld::CellStore::mLockpicks
private
std::vector<LiveCellRefBase*> MWWorld::CellStore::mMergedRefs
private
CellRefList<ESM::Miscellaneous> MWWorld::CellStore::mMiscItems
private
MovedRefTracker MWWorld::CellStore::mMovedHere
private
MovedRefTracker MWWorld::CellStore::mMovedToAnotherCell
private
CellRefList<ESM::NPC> MWWorld::CellStore::mNpcs
private
CellRefList<ESM::Potion> MWWorld::CellStore::mPotions
private
CellRefList<ESM::Probe> MWWorld::CellStore::mProbes
private
std::vector<ESM::ESMReader>& MWWorld::CellStore::mReader
private
CellRefList<ESM::Repair> MWWorld::CellStore::mRepairs
private
State MWWorld::CellStore::mState
private
CellRefList<ESM::Static> MWWorld::CellStore::mStatics
private
const MWWorld::ESMStore& MWWorld::CellStore::mStore
private
float MWWorld::CellStore::mWaterLevel
private
CellRefList<ESM::Weapon> MWWorld::CellStore::mWeapons
private

The documentation for this class was generated from the following files: