OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
cells.hpp
Go to the documentation of this file.
1 #ifndef GAME_MWWORLD_CELLS_H
2 #define GAME_MWWORLD_CELLS_H
3 
4 #include <map>
5 #include <list>
6 #include <string>
7 
8 #include "ptr.hpp"
9 
10 namespace ESM
11 {
12  class ESMReader;
13  class ESMWriter;
14  struct CellId;
15  struct Cell;
16 }
17 
18 namespace Loading
19 {
20  class Listener;
21 }
22 
23 namespace MWWorld
24 {
25  class ESMStore;
26 
28  class Cells
29  {
31  std::vector<ESM::ESMReader>& mReader;
32  mutable std::map<std::string, CellStore> mInteriors;
33  mutable std::map<std::pair<int, int>, CellStore> mExteriors;
34  std::vector<std::pair<std::string, CellStore *> > mIdCache;
35  std::size_t mIdCacheIndex;
36 
37  Cells (const Cells&);
38  Cells& operator= (const Cells&);
39 
40  CellStore *getCellStore (const ESM::Cell *cell);
41 
42  Ptr getPtrAndCache (const std::string& name, CellStore& cellStore);
43 
44  void writeCell (ESM::ESMWriter& writer, CellStore& cell) const;
45 
46  public:
47 
48  void clear();
49 
50  Cells (const MWWorld::ESMStore& store, std::vector<ESM::ESMReader>& reader);
51 
52  CellStore *getExterior (int x, int y);
53 
54  CellStore *getInterior (const std::string& name);
55 
56  CellStore *getCell (const ESM::CellId& id);
57 
58  Ptr getPtr (const std::string& name, CellStore& cellStore, bool searchInContainers = false);
61 
63  Ptr getPtr (const std::string& name);
64 
68  void getExteriorPtrs (const std::string& name, std::vector<MWWorld::Ptr>& out);
69 
73  void getInteriorPtrs (const std::string& name, std::vector<MWWorld::Ptr>& out);
74 
75  int countSavedGameRecords() const;
76 
77  void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
78 
79  bool readRecord (ESM::ESMReader& reader, uint32_t type,
80  const std::map<int, int>& contentFileMap);
81  };
82 }
83 
84 #endif
Cell container.
Definition: cells.hpp:28
void write(ESM::ESMWriter &writer, Loading::Listener &progress) const
Definition: cells.cpp:293
bool readRecord(ESM::ESMReader &reader, uint32_t type, const std::map< int, int > &contentFileMap)
Definition: cells.cpp:335
Definition: esmreader.hpp:21
Ptr getPtrAndCache(const std::string &name, CellStore &cellStore)
Definition: cells.cpp:57
CellStore * getCellStore(const ESM::Cell *cell)
Definition: cells.cpp:19
void getExteriorPtrs(const std::string &name, std::vector< MWWorld::Ptr > &out)
Definition: cells.cpp:248
void getInteriorPtrs(const std::string &name, std::vector< MWWorld::Ptr > &out)
Definition: cells.cpp:262
Definition: loadinglistener.hpp:8
Cells(const Cells &)
const MWWorld::ESMStore & mStore
Definition: cells.hpp:30
Ptr getPtr(const std::string &name, CellStore &cellStore, bool searchInContainers=false)
Definition: cells.cpp:162
Definition: esmwriter.hpp:17
std::size_t mIdCacheIndex
Definition: cells.hpp:35
CellStore * getExterior(int x, int y)
Definition: cells.cpp:95
Definition: esmstore.hpp:17
void writeCell(ESM::ESMWriter &writer, CellStore &cell) const
Definition: cells.cpp:72
CellStore * getInterior(const std::string &name)
Definition: cells.cpp:134
void clear()
Definition: cells.cpp:49
std::vector< std::pair< std::string, CellStore * > > mIdCache
Definition: cells.hpp:34
Mutable state of a cell.
Definition: cellstore.hpp:53
std::map< std::string, CellStore > mInteriors
Definition: cells.hpp:32
std::vector< ESM::ESMReader > & mReader
Definition: cells.hpp:31
Definition: loadcell.hpp:64
int countSavedGameRecords() const
Definition: cells.cpp:276
std::map< std::pair< int, int >, CellStore > mExteriors
Definition: cells.hpp:33
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
Cells & operator=(const Cells &)
CellStore * getCell(const ESM::CellId &id)
Definition: cells.cpp:154
Definition: cellid.hpp:11
const char * name
Definition: crashcatcher.cpp:59