1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:59:56 +00:00
openmw/components/esm3/globalmap.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1 KiB
C++
Raw Normal View History

2014-01-25 17:20:17 +00:00
#include "globalmap.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
void GlobalMap::load(ESMReader& esm)
{
2014-01-25 17:20:17 +00:00
esm.getHNT(mBounds, "BNDS");
2022-09-22 18:26:05 +00:00
2014-01-25 17:20:17 +00:00
esm.getSubNameIs("DATA");
esm.getSubHeader();
2014-01-25 17:20:17 +00:00
mImageData.resize(esm.getSubSize());
2022-09-03 15:41:35 +00:00
esm.getExact(mImageData.data(), mImageData.size());
2022-09-22 18:26:05 +00:00
while (esm.isNextSub("MRK_"))
2022-09-22 18:26:05 +00:00
{
esm.getSubHeader();
CellId cell;
esm.getT(cell.first);
esm.getT(cell.second);
mMarkers.insert(cell);
2022-09-22 18:26:05 +00:00
}
}
2014-01-25 17:20:17 +00:00
void GlobalMap::save(ESMWriter& esm) const
{
2014-01-25 17:20:17 +00:00
esm.writeHNT("BNDS", mBounds);
2022-09-22 18:26:05 +00:00
2014-01-25 17:20:17 +00:00
esm.startSubRecord("DATA");
2022-09-03 15:41:35 +00:00
esm.write(mImageData.data(), mImageData.size());
2014-01-25 17:20:17 +00:00
esm.endRecord("DATA");
2022-09-22 18:26:05 +00:00
for (std::set<CellId>::const_iterator it = mMarkers.begin(); it != mMarkers.end(); ++it)
2022-09-22 18:26:05 +00:00
{
esm.startSubRecord("MRK_");
esm.writeT(it->first);
esm.writeT(it->second);
esm.endRecord("MRK_");
2022-09-22 18:26:05 +00:00
}
}
}