2011-04-08 13:58:21 +00:00
|
|
|
#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);
|
|
|
|
}
|
|
|
|
}
|
2012-04-06 19:04:30 +00:00
|
|
|
void Region::save(ESMWriter &esm)
|
|
|
|
{
|
2012-04-13 22:14:04 +00:00
|
|
|
esm.writeHNCString("FNAM", name);
|
2012-04-06 19:04:30 +00:00
|
|
|
|
2012-04-08 15:04:52 +00:00
|
|
|
if (esm.getVersion() == VER_12)
|
|
|
|
esm.writeHNT("WEAT", data, sizeof(data) - 2);
|
|
|
|
else
|
|
|
|
esm.writeHNT("WEAT", data);
|
2012-04-06 19:04:30 +00:00
|
|
|
|
2012-04-13 22:14:04 +00:00
|
|
|
esm.writeHNOCString("BNAM", sleepList);
|
2012-04-06 19:04:30 +00:00
|
|
|
|
|
|
|
esm.writeHNT("CNAM", mapColor);
|
|
|
|
for (std::vector<SoundRef>::iterator it = soundList.begin(); it != soundList.end(); ++it)
|
|
|
|
{
|
|
|
|
esm.writeHNT<SoundRef>("SNAM", *it);
|
|
|
|
}
|
|
|
|
}
|
2011-04-08 13:58:21 +00:00
|
|
|
|
|
|
|
}
|