2014-10-02 10:30:15 +00:00
|
|
|
#include "pathgrid.hpp"
|
2015-02-09 15:50:34 +00:00
|
|
|
#include "cell.hpp"
|
|
|
|
#include "idcollection.hpp"
|
2014-10-02 10:30:15 +00:00
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
2015-07-21 17:25:43 +00:00
|
|
|
void CSMWorld::Pathgrid::load(ESM::ESMReader& esm, bool& isDeleted, const IdCollection<Cell>& cells)
|
2014-10-04 13:36:52 +00:00
|
|
|
{
|
2015-07-21 17:25:43 +00:00
|
|
|
load(esm, isDeleted);
|
2014-10-04 13:36:52 +00:00
|
|
|
|
|
|
|
// correct ID
|
2022-10-06 17:39:46 +00:00
|
|
|
if (!mId.empty() && mId.getRefIdString()[0] != '#' && cells.searchId(mId) == -1)
|
2014-10-04 13:36:52 +00:00
|
|
|
{
|
|
|
|
std::ostringstream stream;
|
|
|
|
stream << "#" << mData.mX << " " << mData.mY;
|
2022-10-06 17:39:46 +00:00
|
|
|
mId = ESM::RefId::stringRefId(stream.str());
|
2014-10-04 13:36:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-21 17:25:43 +00:00
|
|
|
void CSMWorld::Pathgrid::load(ESM::ESMReader& esm, bool& isDeleted)
|
2014-10-02 10:30:15 +00:00
|
|
|
{
|
2015-07-21 17:25:43 +00:00
|
|
|
ESM::Pathgrid::load(esm, isDeleted);
|
2014-10-02 10:30:15 +00:00
|
|
|
|
2015-07-21 17:25:43 +00:00
|
|
|
mId = mCell;
|
2014-10-02 10:30:15 +00:00
|
|
|
if (mCell.empty())
|
|
|
|
{
|
|
|
|
std::ostringstream stream;
|
|
|
|
stream << "#" << mData.mX << " " << mData.mY;
|
2022-10-06 17:39:46 +00:00
|
|
|
mId = ESM::RefId::stringRefId(stream.str());
|
2014-10-02 10:30:15 +00:00
|
|
|
}
|
|
|
|
}
|