1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 09:53:52 +00:00
openmw/components/esm3/globalmap.cpp

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