|
|
|
@ -7,10 +7,13 @@
|
|
|
|
|
#include <cctype>
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
#include <functional>
|
|
|
|
|
#include <cassert>
|
|
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
|
|
|
|
|
|
#include <QVariant>
|
|
|
|
|
|
|
|
|
|
#include <components/misc/stringops.hpp>
|
|
|
|
|
#include <components/esm/loadcell.hpp>
|
|
|
|
|
|
|
|
|
|
#include "columnbase.hpp"
|
|
|
|
|
|
|
|
|
@ -50,6 +53,8 @@ namespace CSMWorld
|
|
|
|
|
// not implemented
|
|
|
|
|
Collection (const Collection&);
|
|
|
|
|
Collection& operator= (const Collection&);
|
|
|
|
|
|
|
|
|
|
void idToCoordiantes(Record<ESXRecordT>& record, const std::string& destination) {} //dose nothing
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
@ -150,7 +155,24 @@ namespace CSMWorld
|
|
|
|
|
void setRecord (int index, const Record<ESXRecordT>& record);
|
|
|
|
|
///< \attention This function must not change the ID.
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
class Collection <ESM::Cell, IdAccessor<ESM::Cell> > : public CollectionBase //explicit specialisation
|
|
|
|
|
{
|
|
|
|
|
void idToCoordiantes(Record<ESM::Cell>& record, const std::string& destination)
|
|
|
|
|
{
|
|
|
|
|
if (record.get().isExterior())
|
|
|
|
|
{
|
|
|
|
|
unsigned separator = destination.find(' ');
|
|
|
|
|
assert(separator != std::string::npos);
|
|
|
|
|
std::string xPos(destination.substr(0, separator));
|
|
|
|
|
std::string yPos(destination.substr(separator+1, destination.size()));
|
|
|
|
|
record.get().mData.mX = boost::lexical_cast<int>(xPos);
|
|
|
|
|
record.get().mData.mY = boost::lexical_cast<int>(yPos);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<typename ESXRecordT, typename IdAccessorT>
|
|
|
|
|
const std::map<std::string, int>& Collection<ESXRecordT, IdAccessorT>::getIdMap() const
|
|
|
|
|
{
|
|
|
|
@ -208,6 +230,9 @@ namespace CSMWorld
|
|
|
|
|
copy.mState = RecordBase::State_ModifiedOnly;
|
|
|
|
|
copy.get().mId = destination;
|
|
|
|
|
|
|
|
|
|
//the below function has explicit specialization for cells, and does nothing fo other records
|
|
|
|
|
idToCoordiantes(copy, destination);
|
|
|
|
|
|
|
|
|
|
insertRecord(copy, getAppendIndex(destination, type));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|