|
|
|
@ -30,7 +30,6 @@
|
|
|
|
|
#undef NDEBUG
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
|
|
#include <iostream> // FIXME: debug only
|
|
|
|
@ -104,7 +103,8 @@ void ESM4::Land::load(ESM4::Reader& reader)
|
|
|
|
|
BTXT base;
|
|
|
|
|
if (reader.getExact(base))
|
|
|
|
|
{
|
|
|
|
|
assert(base.quadrant < 4 && "base texture quadrant index error");
|
|
|
|
|
if (base.quadrant >= 4)
|
|
|
|
|
throw std::runtime_error("base texture quadrant index error");
|
|
|
|
|
|
|
|
|
|
reader.adjustFormId(base.formId);
|
|
|
|
|
mTextures[base.quadrant].base = std::move(base);
|
|
|
|
@ -126,7 +126,8 @@ void ESM4::Land::load(ESM4::Reader& reader)
|
|
|
|
|
}
|
|
|
|
|
reader.get(layer.texture);
|
|
|
|
|
reader.adjustFormId(layer.texture.formId);
|
|
|
|
|
assert(layer.texture.quadrant < 4 && "additional texture quadrant index error");
|
|
|
|
|
if (layer.texture.quadrant >= 4)
|
|
|
|
|
throw std::runtime_error("additional texture quadrant index error");
|
|
|
|
|
#if 0
|
|
|
|
|
FormId txt = layer.texture.formId;
|
|
|
|
|
std::map<FormId, int>::iterator lb = uniqueTextures.lower_bound(txt);
|
|
|
|
@ -149,11 +150,12 @@ void ESM4::Land::load(ESM4::Reader& reader)
|
|
|
|
|
}
|
|
|
|
|
case ESM4::SUB_VTXT:
|
|
|
|
|
{
|
|
|
|
|
assert(currentAddQuad != -1 && "VTXT without ATXT found");
|
|
|
|
|
if (currentAddQuad == -1)
|
|
|
|
|
throw std::runtime_error("VTXT without ATXT found");
|
|
|
|
|
|
|
|
|
|
int count = (int)reader.subRecordHeader().dataSize / sizeof(ESM4::Land::VTXT);
|
|
|
|
|
assert((reader.subRecordHeader().dataSize % sizeof(ESM4::Land::VTXT)) == 0
|
|
|
|
|
&& "ESM4::LAND VTXT data size error");
|
|
|
|
|
if ((reader.subRecordHeader().dataSize % sizeof(ESM4::Land::VTXT)) != 0)
|
|
|
|
|
throw std::runtime_error("ESM4::LAND VTXT data size error");
|
|
|
|
|
|
|
|
|
|
if (count)
|
|
|
|
|
{
|
|
|
|
@ -182,8 +184,8 @@ void ESM4::Land::load(ESM4::Reader& reader)
|
|
|
|
|
case ESM4::SUB_VTEX: // only in Oblivion?
|
|
|
|
|
{
|
|
|
|
|
int count = (int)reader.subRecordHeader().dataSize / sizeof(FormId32);
|
|
|
|
|
assert(
|
|
|
|
|
(reader.subRecordHeader().dataSize % sizeof(FormId32)) == 0 && "ESM4::LAND VTEX data size error");
|
|
|
|
|
if ((reader.subRecordHeader().dataSize % sizeof(FormId32)) != 0)
|
|
|
|
|
throw std::runtime_error("ESM4::LAND VTEX data size error");
|
|
|
|
|
|
|
|
|
|
if (count)
|
|
|
|
|
{
|
|
|
|
|