1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 18:32:36 +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.0 KiB
C++
Raw Normal View History

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