2011-09-08 09:02:55 +00:00
|
|
|
#ifndef GAME_MWWORLD_CELLS_H
|
|
|
|
#define GAME_MWWORLD_CELLS_H
|
|
|
|
|
|
|
|
#include <map>
|
2012-11-10 20:43:41 +00:00
|
|
|
#include <list>
|
2011-09-08 09:02:55 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "ptr.hpp"
|
|
|
|
|
|
|
|
namespace ESM
|
|
|
|
{
|
|
|
|
class ESMReader;
|
2014-01-23 10:29:40 +00:00
|
|
|
class ESMWriter;
|
|
|
|
struct CellId;
|
2014-02-23 19:11:05 +00:00
|
|
|
struct Cell;
|
2011-09-08 09:02:55 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 15:17:04 +00:00
|
|
|
namespace MWWorld
|
2011-09-08 09:02:55 +00:00
|
|
|
{
|
|
|
|
class ESMStore;
|
|
|
|
|
|
|
|
/// \brief Cell container
|
|
|
|
class Cells
|
|
|
|
{
|
2012-10-01 15:17:04 +00:00
|
|
|
const MWWorld::ESMStore& mStore;
|
2012-11-10 20:43:41 +00:00
|
|
|
std::vector<ESM::ESMReader>& mReader;
|
2012-07-03 10:30:50 +00:00
|
|
|
std::map<std::string, CellStore> mInteriors;
|
|
|
|
std::map<std::pair<int, int>, CellStore> mExteriors;
|
|
|
|
std::vector<std::pair<std::string, CellStore *> > mIdCache;
|
2012-06-21 09:43:18 +00:00
|
|
|
std::size_t mIdCacheIndex;
|
2011-09-08 09:02:55 +00:00
|
|
|
|
|
|
|
Cells (const Cells&);
|
|
|
|
Cells& operator= (const Cells&);
|
|
|
|
|
2012-07-03 10:30:50 +00:00
|
|
|
CellStore *getCellStore (const ESM::Cell *cell);
|
2011-09-22 10:44:17 +00:00
|
|
|
|
2012-07-03 10:30:50 +00:00
|
|
|
Ptr getPtrAndCache (const std::string& name, CellStore& cellStore);
|
2012-06-21 09:43:18 +00:00
|
|
|
|
2014-01-23 10:29:40 +00:00
|
|
|
void writeCell (ESM::ESMWriter& writer, const CellStore& cell) const;
|
|
|
|
|
|
|
|
bool hasState (const CellStore& cellStore) const;
|
|
|
|
///< Check if cell has state that needs to be included in a saved game file.
|
|
|
|
|
2011-09-08 09:02:55 +00:00
|
|
|
public:
|
|
|
|
|
2013-05-15 15:54:18 +00:00
|
|
|
void clear();
|
|
|
|
|
2012-11-25 13:12:44 +00:00
|
|
|
Cells (const MWWorld::ESMStore& store, std::vector<ESM::ESMReader>& reader);
|
2011-09-08 09:02:55 +00:00
|
|
|
|
2012-07-03 10:30:50 +00:00
|
|
|
CellStore *getExterior (int x, int y);
|
2011-09-08 09:02:55 +00:00
|
|
|
|
2012-07-03 10:30:50 +00:00
|
|
|
CellStore *getInterior (const std::string& name);
|
2011-09-08 09:02:55 +00:00
|
|
|
|
2014-01-23 10:29:40 +00:00
|
|
|
CellStore *getCell (const ESM::CellId& id);
|
|
|
|
|
2013-08-15 12:45:13 +00:00
|
|
|
Ptr getPtr (const std::string& name, CellStore& cellStore, bool searchInContainers = false);
|
|
|
|
///< \param searchInContainers Only affect loaded cells.
|
2014-01-01 01:22:11 +00:00
|
|
|
/// @note name must be lower case
|
2011-09-22 10:44:17 +00:00
|
|
|
|
2014-01-01 01:22:11 +00:00
|
|
|
/// @note name must be lower case
|
2011-09-22 10:44:17 +00:00
|
|
|
Ptr getPtr (const std::string& name);
|
2014-01-01 01:22:11 +00:00
|
|
|
|
|
|
|
/// Get all Ptrs referencing \a name in exterior cells
|
|
|
|
/// @note Due to the current implementation of getPtr this only supports one Ptr per cell.
|
|
|
|
/// @note name must be lower case
|
|
|
|
void getExteriorPtrs (const std::string& name, std::vector<MWWorld::Ptr>& out);
|
2014-01-23 10:29:40 +00:00
|
|
|
|
2014-01-11 02:29:41 +00:00
|
|
|
/// Get all Ptrs referencing \a name in interior cells
|
|
|
|
/// @note Due to the current implementation of getPtr this only supports one Ptr per cell.
|
|
|
|
/// @note name must be lower case
|
|
|
|
void getInteriorPtrs (const std::string& name, std::vector<MWWorld::Ptr>& out);
|
|
|
|
|
2014-01-23 10:29:40 +00:00
|
|
|
int countSavedGameRecords() const;
|
|
|
|
|
|
|
|
void write (ESM::ESMWriter& writer) const;
|
|
|
|
|
2014-01-27 12:27:42 +00:00
|
|
|
bool readRecord (ESM::ESMReader& reader, int32_t type,
|
|
|
|
const std::map<int, int>& contentFileMap);
|
2011-09-08 09:02:55 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|