Fix loading ESX files cleaned with testool (Fixes #1382)

deque
scrawl 11 years ago
parent ce14a6413b
commit 7376cb9b61

@ -12,10 +12,26 @@ void Region::load(ESMReader &esm)
{
mName = esm.getHNOString("FNAM");
esm.getSubNameIs("WEAT");
esm.getSubHeader();
if (esm.getVer() == VER_12)
esm.getHNExact(&mData, sizeof(mData) - 2, "WEAT");
{
mData.mA = 0;
mData.mB = 0;
esm.getExact(&mData, sizeof(mData) - 2);
}
else if (esm.getVer() == VER_13)
esm.getHNExact(&mData, sizeof(mData), "WEAT");
{
// May include the additional two bytes (but not necessarily)
if (esm.getSubSize() == sizeof(mData))
esm.getExact(&mData, sizeof(mData));
else
{
mData.mA = 0;
mData.mB = 0;
esm.getExact(&mData, sizeof(mData)-2);
}
}
else
esm.fail("Don't know what to do in this version");

Loading…
Cancel
Save