1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 18:29:55 +00:00
openmw/components/esm/loadregn.cpp
2012-04-06 21:04:30 +02:00

43 lines
930 B
C++

#include "loadregn.hpp"
namespace ESM
{
void Region::load(ESMReader &esm)
{
name = esm.getHNString("FNAM");
if (esm.getVer() == VER_12)
esm.getHNExact(&data, sizeof(data) - 2, "WEAT");
else if (esm.getVer() == VER_13)
esm.getHNExact(&data, sizeof(data), "WEAT");
else
esm.fail("Don't know what to do in this version");
sleepList = esm.getHNOString("BNAM");
esm.getHNT(mapColor, "CNAM");
while (esm.hasMoreSubs())
{
SoundRef sr;
esm.getHNT(sr, "SNAM", 33);
soundList.push_back(sr);
}
}
void Region::save(ESMWriter &esm)
{
esm.writeHNString("FNAM", name);
esm.writeHNT("WEAT", data);
esm.writeHNOString("BNAM", sleepList);
esm.writeHNT("CNAM", mapColor);
for (std::vector<SoundRef>::iterator it = soundList.begin(); it != soundList.end(); ++it)
{
esm.writeHNT<SoundRef>("SNAM", *it);
}
}
}