Use the logging system instead of std::cout in components/esm4

- Remove debug-related includes
- Add some trivial missing includes
- Remove useless {}
- Move the known-but-skipped-records are the end of the switch-cases
- Always throw on unknown records
macos_ci
jvoisin 2 years ago
parent 8e3e351015
commit a58dc6fd30

@ -25,9 +25,9 @@
*/
#include "loadachr.hpp"
#include <components/debug/debuglog.hpp>
#include <stdexcept>
//#include <iostream>
#include "reader.hpp"
//#include "writer.hpp"
@ -63,18 +63,11 @@ void ESM4::ActorCharacter::load(ESM4::Reader& reader)
reader.getFormId(mOwner);
break;
case ESM4::SUB_XESP:
{
reader.getFormId(mEsp.parent);
reader.get(mEsp.flags);
break;
}
case ESM4::SUB_XRGD: // ragdoll
case ESM4::SUB_XRGB: // ragdoll biped
{
// std::cout << "ACHR " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
reader.skipSubRecordData();
break;
}
case ESM4::SUB_XHRS: // horse formId
case ESM4::SUB_XMRC: // merchant container formId
// TES5
@ -102,11 +95,9 @@ void ESM4::ActorCharacter::load(ESM4::Reader& reader)
case ESM4::SUB_SCHR: // FO3
case ESM4::SUB_TNAM: // FO3
case ESM4::SUB_XATO: // FONV
{
// std::cout << "ACHR " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "ACHR " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::ACHR::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -25,9 +25,9 @@
*/
#include "loadacre.hpp"
#include <components/debug/debuglog.hpp>
#include <stdexcept>
//#include <iostream>
#include "reader.hpp"
//#include "writer.hpp"
@ -56,11 +56,9 @@ void ESM4::ActorCreature::load(ESM4::Reader& reader)
reader.get(mScale);
break;
case ESM4::SUB_XESP:
{
reader.getFormId(mEsp.parent);
reader.get(mEsp.flags);
break;
}
case ESM4::SUB_XOWN:
reader.getFormId(mOwner);
break;
@ -70,14 +68,6 @@ void ESM4::ActorCreature::load(ESM4::Reader& reader)
case ESM4::SUB_XRNK:
reader.get(mFactionRank);
break;
case ESM4::SUB_XRGD: // ragdoll
case ESM4::SUB_XRGB: // ragdoll biped
{
// seems to occur only for dead bodies, e.g. DeadMuffy, DeadDogVicious
// std::cout << "ACRE " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
reader.skipSubRecordData();
break;
}
case ESM4::SUB_XLKR: // FO3
case ESM4::SUB_XLCM: // FO3
case ESM4::SUB_XEZN: // FO3
@ -87,11 +77,12 @@ void ESM4::ActorCreature::load(ESM4::Reader& reader)
case ESM4::SUB_XRDS: // FO3
case ESM4::SUB_XPRD: // FO3
case ESM4::SUB_XATO: // FONV
{
// std::cout << "ACRE " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
// seems to occur only for dead bodies, e.g. DeadMuffy, DeadDogVicious
case ESM4::SUB_XRGD: // ragdoll
case ESM4::SUB_XRGB: // ragdoll biped
Log(Debug::Verbose) << "ACRE " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::ACRE::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,7 +26,8 @@
*/
#include "loadacti.hpp"
#include <iostream> // FIXME
#include <components/debug/debuglog.hpp>
#include <stdexcept>
#include "reader.hpp"
@ -88,11 +89,9 @@ void ESM4::Activator::load(ESM4::Reader& reader)
case ESM4::SUB_PNAM:
case ESM4::SUB_VMAD:
case ESM4::SUB_WNAM:
{
// std::cout << "ACTI " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "ACTI " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::ACTI::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,9 +26,10 @@
*/
#include "loadalch.hpp"
#include <components/debug/debuglog.hpp>
#include <cstring>
#include <stdexcept>
//#include <iostream> // FIXME
#include "reader.hpp"
//#include "writer.hpp"
@ -68,13 +69,10 @@ void ESM4::Potion::load(ESM4::Reader& reader)
reader.get(mBoundRadius);
break;
case ESM4::SUB_SCIT:
{
reader.get(mEffect);
reader.adjustFormId(mEffect.formId);
break;
}
case ESM4::SUB_ENIT:
{
if (subHdr.dataSize == 8) // TES4
{
reader.get(&mItem, 8);
@ -82,12 +80,10 @@ void ESM4::Potion::load(ESM4::Reader& reader)
mItem.sound = 0;
break;
}
reader.get(mItem);
reader.adjustFormId(mItem.withdrawl);
reader.adjustFormId(mItem.sound);
break;
}
case ESM4::SUB_YNAM:
reader.getFormId(mPickUpSound);
break;
@ -103,11 +99,9 @@ void ESM4::Potion::load(ESM4::Reader& reader)
case ESM4::SUB_MODS:
case ESM4::SUB_OBND:
case ESM4::SUB_ETYP: // FO3
{
// std::cout << "ALCH " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "ALCH " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::ALCH::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,10 +26,10 @@
*/
#include "loadaloc.hpp"
#include <components/debug/debuglog.hpp>
#include <cstring>
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
//#include <iomanip> // FIXME: for debugging only
//#include "formid.hpp" // FIXME:
@ -145,18 +145,14 @@ void ESM4::MediaLocationController::load(ESM4::Reader& reader)
else if (i < subHdr.dataSize-1)
ss << " ";
}
std::cout << ss.str() << std::endl;
std::cout << ss.str();
#else
// std::cout << "ALOC " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "ALOC " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
#endif
break;
}
default:
// std::cout << "ALOC " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
// reader.skipSubRecordData();
throw std::runtime_error("ESM4::ALOC::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -48,7 +50,6 @@ void ESM4::Ammunition::load(ESM4::Reader& reader)
reader.getLocalizedString(mFullName);
break;
case ESM4::SUB_DATA:
{
// FO3/FNV or TES4
if (subHdr.dataSize == 13 || subHdr.dataSize == 18)
{
@ -81,9 +82,7 @@ void ESM4::Ammunition::load(ESM4::Reader& reader)
reader.skipSubRecordData();
}
break;
}
case ESM4::SUB_DAT2:
{
if (subHdr.dataSize == 20)
{
reader.get(mData.mProjPerShot);
@ -97,7 +96,6 @@ void ESM4::Ammunition::load(ESM4::Reader& reader)
reader.skipSubRecordData();
}
break;
}
case ESM4::SUB_ICON:
reader.getZString(mIcon);
break;
@ -139,19 +137,15 @@ void ESM4::Ammunition::load(ESM4::Reader& reader)
break;
}
case ESM4::SUB_SCRI:
{
reader.getFormId(mScript);
break;
}
case ESM4::SUB_MODT:
case ESM4::SUB_OBND:
case ESM4::SUB_KSIZ:
case ESM4::SUB_KWDA:
{
// std::cout << "AMMO " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "AMMO " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::AMMO::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,6 +26,8 @@
*/
#include "loadanio.hpp"
#include <components/debug/debuglog.hpp>
#include <stdexcept>
#include "reader.hpp"
@ -59,11 +61,9 @@ void ESM4::AnimObject::load(ESM4::Reader& reader)
break;
case ESM4::SUB_MODT: // TES5 only
case ESM4::SUB_MODS: // TES5 only
{
// std::cout << "ANIO " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "ANIO " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::ANIO::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,6 +26,8 @@
*/
#include "loadappa.hpp"
#include <components/debug/debuglog.hpp>
#include <stdexcept>
#include "reader.hpp"
@ -49,7 +51,6 @@ void ESM4::Apparatus::load(ESM4::Reader& reader)
reader.getLocalizedString(mFullName);
break;
case ESM4::SUB_DATA:
{
if (reader.esmVersion() == ESM::VER_094 || reader.esmVersion() == ESM::VER_170)
{
reader.get(mData.value);
@ -63,7 +64,6 @@ void ESM4::Apparatus::load(ESM4::Reader& reader)
reader.get(mData.quality);
}
break;
}
case ESM4::SUB_ICON:
reader.getZString(mIcon);
break;
@ -82,11 +82,9 @@ void ESM4::Apparatus::load(ESM4::Reader& reader)
case ESM4::SUB_MODT:
case ESM4::SUB_OBND:
case ESM4::SUB_QUAL:
{
// std::cout << "APPA " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "APPA " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::APPA::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,7 +27,8 @@
#include "loadarma.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: testing only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -59,9 +60,6 @@ void ESM4::ArmorAddon::load(ESM4::Reader& reader)
{
std::string model;
reader.getZString(model);
// std::cout << mEditorId << " " << ESM::printName(subHdr.typeId) << " " << model << std::endl;
break;
}
case ESM4::SUB_NAM0:
@ -74,7 +72,6 @@ void ESM4::ArmorAddon::load(ESM4::Reader& reader)
reader.getFormId(mRacePrimary);
break;
case ESM4::SUB_MODL:
{
if ((esmVer == ESM::VER_094 || esmVer == ESM::VER_170) && subHdr.dataSize == 4) // TES5
{
FormId formId;
@ -85,20 +82,15 @@ void ESM4::ArmorAddon::load(ESM4::Reader& reader)
reader.skipSubRecordData(); // FIXME: this should be mModelMale for FO3/FONV
break;
}
case ESM4::SUB_BODT: // body template
{
reader.get(mBodyTemplate.bodyPart);
reader.get(mBodyTemplate.flags);
reader.get(mBodyTemplate.unknown1); // probably padding
reader.get(mBodyTemplate.unknown2); // probably padding
reader.get(mBodyTemplate.unknown3); // probably padding
reader.get(mBodyTemplate.type);
break;
}
case ESM4::SUB_BOD2: // TES5
{
reader.get(mBodyTemplate.bodyPart);
mBodyTemplate.flags = 0;
mBodyTemplate.unknown1 = 0; // probably padding
@ -107,7 +99,6 @@ void ESM4::ArmorAddon::load(ESM4::Reader& reader)
reader.get(mBodyTemplate.type);
break;
}
case ESM4::SUB_DNAM:
case ESM4::SUB_MO2T: // FIXME: should group with MOD2
case ESM4::SUB_MO2S: // FIXME: should group with MOD2
@ -130,11 +121,9 @@ void ESM4::ArmorAddon::load(ESM4::Reader& reader)
case ESM4::SUB_MODS: // FO3 // FIXME: should group with MODL
case ESM4::SUB_MODD: // FO3 // FIXME: should group with MODL
case ESM4::SUB_OBND: // FO3
{
// std::cout << "ARMA " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "ARMA " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::ARMA::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,7 +27,8 @@
#include "loadarmo.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: testing only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -113,7 +114,6 @@ void ESM4::Armor::load(ESM4::Reader& reader)
reader.getZString(mMiniIconFemale);
break;
case ESM4::SUB_BMDT:
{
if (subHdr.dataSize == 8) // FO3
{
reader.get(mArmorFlags);
@ -128,7 +128,6 @@ void ESM4::Armor::load(ESM4::Reader& reader)
mGeneralFlags |= TYPE_TES4;
}
break;
}
case ESM4::SUB_BODT:
{
reader.get(mArmorFlags);
@ -143,13 +142,11 @@ void ESM4::Armor::load(ESM4::Reader& reader)
break;
}
case ESM4::SUB_BOD2:
{
reader.get(mArmorFlags);
reader.get(mGeneralFlags);
mGeneralFlags &= 0x0000000f; // 0 (light), 1 (heavy) or 2 (none)
mGeneralFlags |= TYPE_TES5;
break;
}
case ESM4::SUB_SCRI:
reader.getFormId(mScriptId);
break;
@ -201,17 +198,15 @@ void ESM4::Armor::load(ESM4::Reader& reader)
case ESM4::SUB_MO3S: // FO3
case ESM4::SUB_BNAM: // FONV
case ESM4::SUB_SNAM: // FONV
{
// std::cout << "ARMO " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "ARMO " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::ARMO::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}
// if ((mArmorFlags&0xffff) == 0x02) // only hair
// std::cout << "only hair " << mEditorId << std::endl;
// std::cout << "only hair " << mEditorId;
}
// void ESM4::Armor::save(ESM4::Writer& writer) const

@ -27,7 +27,8 @@
#include "loadaspc.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -66,17 +67,14 @@ void ESM4::AcousticSpace::load(ESM4::Reader& reader)
{
std::uint32_t dummy;
reader.get(dummy);
// std::cout << "WNAM " << mEditorId << " " << dummy << std::endl;
Log(Debug::Verbose) << "WNAM " << mEditorId << " " << dummy;
break;
}
case ESM4::SUB_BNAM: // TES5 reverb formid
case ESM4::SUB_OBND:
{
// std::cout << "ASPC " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "ASPC " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::ASPC::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -102,11 +104,9 @@ void ESM4::Book::load(ESM4::Reader& reader)
case ESM4::SUB_CNAM:
case ESM4::SUB_INAM:
case ESM4::SUB_VMAD:
{
// std::cout << "BOOK " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "BOOK " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::BOOK::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,9 +27,10 @@
#include "loadbptd.hpp"
#include <cstring>
#include <iostream> // FIXME: testing only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -86,30 +87,24 @@ void ESM4::BodyPartData::load(ESM4::Reader& reader)
reader.getZString(bodyPart.mLimbReplacementModel);
break;
case ESM4::SUB_NAM4: // FIXME: assumed occurs last
{
reader.getZString(bodyPart.mGoreEffectsTarget); // target bone
mBodyParts.push_back(bodyPart); // FIXME: possible without copying?
bodyPart.clear();
break;
}
case ESM4::SUB_NAM5:
case ESM4::SUB_RAGA: // ragdoll
case ESM4::SUB_MODS:
case ESM4::SUB_MODT:
{
// std::cout << "BPTD " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "BPTD " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::BPTD::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}
// if (mEditorId == "DefaultBodyPartData")
// std::cout << "BPTD: " << mEditorId << std::endl; // FIXME: testing only
// std::cout << "BPTD: " << mEditorId; // FIXME: testing only
}
// void ESM4::BodyPartData::save(ESM4::Writer& writer) const

@ -27,6 +27,8 @@
#ifndef ESM4_BPTD_H
#define ESM4_BPTD_H
#include <cstdint>
#include <string>
#include <vector>
#include "formid.hpp"

@ -31,10 +31,11 @@
#endif
#include <cfloat> // FLT_MAX for gcc
#include <iostream> // FIXME: debug only
#include <limits>
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "grouptype.hpp"
#include "reader.hpp"
// #include "writer.hpp"
@ -92,7 +93,7 @@ void ESM4::Cell::load(ESM4::Reader& reader)
#if 0
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "CELL Editor ID: " << mEditorId << std::endl;
std::cout << padding << "CELL Editor ID: " << mEditorId;
#endif
break;
}
@ -115,9 +116,9 @@ void ESM4::Cell::load(ESM4::Reader& reader)
#if 0
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "CELL group " << ESM4::printLabel(reader.grp().label, reader.grp().type) << std::endl;
std::cout << padding << "CELL formId " << std::hex << reader.hdr().record.id << std::endl;
std::cout << padding << "CELL X " << std::dec << mX << ", Y " << mY << std::endl;
std::cout << padding << "CELL group " << ESM4::printLabel(reader.grp().label, reader.grp().type);
std::cout << padding << "CELL formId " << std::hex << reader.hdr().record.id;
std::cout << padding << "CELL X " << std::dec << mX << ", Y " << mY;
#endif
if (esmVer == ESM::VER_094 || esmVer == ESM::VER_170 || isFONV)
if (subHdr.dataSize == 12)
@ -150,7 +151,7 @@ void ESM4::Cell::load(ESM4::Reader& reader)
#if 0
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "flags: " << std::hex << mCellFlags << std::endl;
std::cout << padding << "flags: " << std::hex << mCellFlags;
#endif
break;
}
@ -163,7 +164,7 @@ void ESM4::Cell::load(ESM4::Reader& reader)
#if 0
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "region: " << std::hex << *it << std::endl;
std::cout << padding << "region: " << std::hex << *it;
#endif
}
break;
@ -232,11 +233,9 @@ void ESM4::Cell::load(ESM4::Reader& reader)
case ESM4::SUB_XRNK: // Oblivion only?
case ESM4::SUB_XCET: // FO3
case ESM4::SUB_IMPF: // FO3 Zeta
{
// std::cout << "CELL " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "CELL " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::CELL::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,9 +26,7 @@
*/
#include "loadclas.hpp"
//#ifdef NDEBUG // FIXME: debugging only
//#undef NDEBUG
//#endif
#include <components/debug/debuglog.hpp>
#include <stdexcept>
@ -59,11 +57,9 @@ void ESM4::Class::load(ESM4::Reader& reader)
reader.getZString(mIcon);
break;
case ESM4::SUB_DATA:
{
// std::cout << "CLAS " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "CLAS " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::CLAS::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,7 +26,6 @@
*/
#include "loadclfm.hpp"
#include <iostream> // FIXME: for debugging only
#include <stdexcept>
#include "reader.hpp"
@ -50,24 +49,15 @@ void ESM4::Colour::load(ESM4::Reader& reader)
reader.getLocalizedString(mFullName);
break;
case ESM4::SUB_CNAM:
{
reader.get(mColour.red);
reader.get(mColour.green);
reader.get(mColour.blue);
reader.get(mColour.custom);
break;
}
case ESM4::SUB_FNAM:
{
reader.get(mPlayable);
break;
}
default:
// std::cout << "CLFM " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
// reader.skipSubRecordData();
throw std::runtime_error("ESM4::CLFM::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}

@ -27,7 +27,8 @@
#include "loadclot.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -91,17 +92,15 @@ void ESM4::Clothing::load(ESM4::Reader& reader)
case ESM4::SUB_MO2T:
case ESM4::SUB_MO3T:
case ESM4::SUB_MO4T:
{
// std::cout << "CLOT " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "CLOT " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::CLOT::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}
// if ((mClothingFlags&0xffff) == 0x02) // only hair
// std::cout << "only hair " << mEditorId << std::endl;
// std::cout << "only hair " << mEditorId;
}
// void ESM4::Clothing::save(ESM4::Writer& writer) const

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -48,11 +50,9 @@ void ESM4::Container::load(ESM4::Reader& reader)
reader.getLocalizedString(mFullName);
break;
case ESM4::SUB_DATA:
{
reader.get(mDataFlags);
reader.get(mWeight);
break;
}
case ESM4::SUB_CNTO:
{
static InventoryItem inv; // FIXME: use unique_ptr here?
@ -88,11 +88,9 @@ void ESM4::Container::load(ESM4::Reader& reader)
case ESM4::SUB_DMDL: // FONV
case ESM4::SUB_DMDT: // FONV
case ESM4::SUB_RNAM: // FONV
{
// std::cout << "CONT " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "CONT " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::CONT::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -31,11 +31,11 @@
#endif
#include <cstring>
#include <iostream> // FIXME
#include <sstream>
#include <stdexcept>
#include <string>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -82,11 +82,9 @@ void ESM4::Creature::load(ESM4::Reader& reader)
break;
}
case ESM4::SUB_SNAM:
{
reader.get(mFaction);
reader.adjustFormId(mFaction.faction);
break;
}
case ESM4::SUB_INAM:
reader.getFormId(mDeathItem);
break;
@ -94,30 +92,24 @@ void ESM4::Creature::load(ESM4::Reader& reader)
reader.getFormId(mScriptId);
break;
case ESM4::SUB_AIDT:
{
if (subHdr.dataSize == 20) // FO3
reader.skipSubRecordData();
else
reader.get(mAIData); // 12 bytes
break;
}
case ESM4::SUB_ACBS:
{
// if (esmVer == ESM::VER_094 || esmVer == ESM::VER_170 || mIsFONV)
if (subHdr.dataSize == 24)
reader.get(mBaseConfig);
else
reader.get(&mBaseConfig, 16); // TES4
break;
}
case ESM4::SUB_DATA:
{
if (subHdr.dataSize == 17) // FO3
reader.skipSubRecordData();
else
reader.get(mData);
break;
}
case ESM4::SUB_ZNAM:
reader.getFormId(mCombatStyle);
break;
@ -149,11 +141,9 @@ void ESM4::Creature::load(ESM4::Reader& reader)
reader.getZString(mBloodDecal);
break;
case ESM4::SUB_NIFZ:
{
if (!reader.getZeroTerminatedStringArray(mNif))
throw std::runtime_error("CREA NIFZ data read error");
break;
}
case ESM4::SUB_NIFT:
{
if (subHdr.dataSize != 4) // FIXME: FO3
@ -167,15 +157,13 @@ void ESM4::Creature::load(ESM4::Reader& reader)
std::uint32_t nift;
reader.get(nift);
if (nift)
std::cout << "CREA NIFT " << mFormId << ", non-zero " << nift << std::endl;
Log(Debug::Verbose) << "CREA NIFT " << mFormId << ", non-zero " << nift;
break;
}
case ESM4::SUB_KFFZ:
{
if (!reader.getZeroTerminatedStringArray(mKf))
throw std::runtime_error("CREA KFFZ data read error");
break;
}
case ESM4::SUB_TPLT:
reader.getFormId(mBaseTemplate);
break; // FO3
@ -184,7 +172,6 @@ void ESM4::Creature::load(ESM4::Reader& reader)
FormId bodyPart;
reader.getFormId(bodyPart);
mBodyParts.push_back(bodyPart);
break;
}
case ESM4::SUB_MODT:
@ -204,11 +191,9 @@ void ESM4::Creature::load(ESM4::Reader& reader)
case ESM4::SUB_DMDL: // FO3
case ESM4::SUB_DMDT: // FO3
case ESM4::SUB_COED: // FO3
{
// std::cout << "CREA " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "CREA " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::CREA::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,9 +27,10 @@
#include "loaddial.hpp"
#include <cstring>
#include <iostream> // FIXME: for debugging only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -55,7 +56,6 @@ void ESM4::Dialogue::load(ESM4::Reader& reader)
FormId questId;
reader.getFormId(questId);
mQuests.push_back(questId);
break;
}
case ESM4::SUB_QSTR: // Seems never used in TES4
@ -63,7 +63,6 @@ void ESM4::Dialogue::load(ESM4::Reader& reader)
FormId questRem;
reader.getFormId(questRem);
mQuestsRemoved.push_back(questRem);
break;
}
case ESM4::SUB_DATA:
@ -100,8 +99,7 @@ void ESM4::Dialogue::load(ESM4::Reader& reader)
case ESM4::SUB_SNAM: // TES5
case ESM4::SUB_TIFC: // TES5
{
// std::cout << "DIAL " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "DIAL " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}

@ -30,9 +30,8 @@
#include <cstring>
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
//#include "formid.hpp"
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -52,7 +51,6 @@ void ESM4::DefaultObj::load(ESM4::Reader& reader)
reader.getZString(mEditorId);
break; // "DefaultObjectManager"
case ESM4::SUB_DATA:
{
reader.getFormId(mData.stimpack);
reader.getFormId(mData.superStimpack);
reader.getFormId(mData.radX);
@ -91,20 +89,12 @@ void ESM4::DefaultObj::load(ESM4::Reader& reader)
reader.getFormId(mData.itemDetectedEfect);
reader.getFormId(mData.cateyeMobileEffectNYI);
}
break;
}
case ESM4::SUB_DNAM:
{
// std::cout << "DOBJ " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "DOBJ " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
// std::cout << "DOBJ " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
// reader.skipSubRecordData();
throw std::runtime_error("ESM4::DOBJ::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -80,11 +82,9 @@ void ESM4::Door::load(ESM4::Reader& reader)
case ESM4::SUB_DSTF: // FO3
case ESM4::SUB_DMDL: // FO3
case ESM4::SUB_DMDT: // FO3
{
// std::cout << "DOOR " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "DOOR " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::DOOR::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -73,11 +75,9 @@ void ESM4::Flora::load(ESM4::Reader& reader)
case ESM4::SUB_PNAM:
case ESM4::SUB_RNAM:
case ESM4::SUB_VMAD:
{
// std::cout << "FLOR " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "FLOR " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::FLOR::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,7 +27,8 @@
#include "loadflst.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -50,19 +51,13 @@ void ESM4::FormIdList::load(ESM4::Reader& reader)
{
FormId formId;
reader.getFormId(formId);
mObjects.push_back(formId);
break;
}
default:
// std::cout << "FLST " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
// reader.skipSubRecordData();
throw std::runtime_error("ESM4::FLST::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}
// std::cout << "flst " << mEditorId << " " << mObjects.size() << std::endl; // FIXME
}
// void ESM4::FormIdList::save(ESM4::Writer& writer) const

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -77,11 +79,9 @@ void ESM4::Furniture::load(ESM4::Reader& reader)
case ESM4::SUB_VMAD:
case ESM4::SUB_WBDT:
case ESM4::SUB_XMRK:
{
// std::cout << "FURN " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "FURN " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::FURN::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,9 +26,10 @@
*/
#include "loadglob.hpp"
#include <iostream> // FIXME
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -59,11 +60,9 @@ void ESM4::GlobalVariable::load(ESM4::Reader& reader)
case ESM4::SUB_DATA:
case ESM4::SUB_OBND: // TES5
case ESM4::SUB_VMAD: // TES5
{
// std::cout << "GLOB " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "GLOB " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::GLOB::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -1,6 +1,8 @@
#include "loadgmst.hpp"
#include <cstdint>
#include <stdexcept>
#include <string>
#include "reader.hpp"

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -56,11 +58,9 @@ void ESM4::Grass::load(ESM4::Reader& reader)
break;
case ESM4::SUB_MODT:
case ESM4::SUB_OBND:
{
// std::cout << "GRAS " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "GRAS " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::GRAS::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,7 +27,8 @@
#include "loadhair.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -62,11 +63,9 @@ void ESM4::Hair::load(ESM4::Reader& reader)
reader.get(mBoundRadius);
break;
case ESM4::SUB_MODT:
{
// std::cout << "HAIR " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "HAIR " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::HAIR::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,9 +26,11 @@
*/
#include "loadhdpt.hpp"
#include <cstdint>
#include <optional>
#include <stdexcept>
//#include <iostream> // FIXME: testing only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -66,7 +68,6 @@ void ESM4::HeadPart::load(ESM4::Reader& reader)
std::uint32_t value;
reader.get(value);
type = value;
break;
}
case ESM4::SUB_NAM1: // TES5
@ -84,7 +85,6 @@ void ESM4::HeadPart::load(ESM4::Reader& reader)
"Failed to read ESM4 HDPT record: invalid file type: " + std::to_string(*type));
mTriFile[*type] = std::move(file);
break;
}
case ESM4::SUB_TNAM:
@ -95,11 +95,9 @@ void ESM4::HeadPart::load(ESM4::Reader& reader)
case ESM4::SUB_MODT:
case ESM4::SUB_RNAM:
case ESM4::SUB_CNAM:
{
// std::cout << "HDPT " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "HDPT " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::HDPT::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -29,6 +29,7 @@
#include <array>
#include <cstdint>
#include <string>
#include "formid.hpp"

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -52,24 +54,20 @@ void ESM4::IdleAnimation::load(ESM4::Reader& reader)
reader.getZString(mEvent);
break;
case ESM4::SUB_ANAM:
{
reader.getFormId(mParent);
reader.getFormId(mPrevious);
break;
}
case ESM4::SUB_CTDA: // formId
case ESM4::SUB_DATA: // formId
{
// std::cout << "IDLE " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
reader.skipSubRecordData();
break;
}
case ESM4::SUB_MODL:
reader.getZString(mModel);
break;
case ESM4::SUB_MODB:
reader.get(mBoundRadius);
break;
case ESM4::SUB_CTDA: // formId
case ESM4::SUB_DATA: // formId
Log(Debug::Verbose) << "IDLE " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
default:
throw std::runtime_error("ESM4::IDLE::load - Unknown subrecord " + std::to_string(subHdr.typeId) + " "
+ ESM::printName(subHdr.typeId));

@ -27,7 +27,8 @@
#include "loadidlm.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: testing only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -52,7 +53,6 @@ void ESM4::IdleMarker::load(ESM4::Reader& reader)
reader.get(mIdleFlags);
break;
case ESM4::SUB_IDLC:
{
if (subHdr.dataSize != 1) // FO3 can have 4?
{
reader.skipSubRecordData();
@ -61,7 +61,6 @@ void ESM4::IdleMarker::load(ESM4::Reader& reader)
reader.get(mIdleCount);
break;
}
case ESM4::SUB_IDLT:
reader.get(mIdleTimer);
break;
@ -80,11 +79,9 @@ void ESM4::IdleMarker::load(ESM4::Reader& reader)
break;
}
case ESM4::SUB_OBND: // object bounds
{
// std::cout << "IDLM " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "IDLM " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::IDLM::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -28,6 +28,7 @@
#define ESM4_IDLM_H
#include <cstdint>
#include <string>
#include <vector>
#include "formid.hpp"

@ -28,9 +28,10 @@
*/
#include "loadimod.hpp"
#include <iostream> // FIXME: for debugging only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -59,15 +60,12 @@ void ESM4::ItemMod::load(ESM4::Reader& reader)
case ESM4::SUB_ZNAM:
case ESM4::SUB_DATA:
{
// std::cout << "IMOD " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "IMOD " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
std::cout << "IMOD " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize << std::endl;
reader.skipSubRecordData();
// throw std::runtime_error("ESM4::IMOD::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
throw std::runtime_error("ESM4::IMOD::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}
}

@ -27,9 +27,10 @@
#include "loadinfo.hpp"
#include <cstring>
#include <iostream> // FIXME: for debugging only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -195,16 +196,11 @@ void ESM4::DialogInfo::load(ESM4::Reader& reader)
case ESM4::SUB_ONAM: // TES5
case ESM4::SUB_QNAM: // TES5 for mScript
case ESM4::SUB_RNAM: // TES5
{
// std::cout << "INFO " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "INFO " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
std::cout << "INFO " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize << std::endl;
reader.skipSubRecordData();
// throw std::runtime_error("ESM4::INFO::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
throw std::runtime_error("ESM4::INFO::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}
}

@ -29,6 +29,8 @@
#include <cstring>
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -107,7 +109,7 @@ void ESM4::Ingredient::load(ESM4::Reader& reader)
case ESM4::SUB_ZNAM:
case ESM4::SUB_ETYP: // FO3
{
// std::cout << "INGR " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "INGR " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -77,11 +79,9 @@ void ESM4::Key::load(ESM4::Reader& reader)
case ESM4::SUB_KWDA:
case ESM4::SUB_OBND:
case ESM4::SUB_VMAD:
{
// std::cout << "KEYM " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "KEYM " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::KEYM::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -30,10 +30,9 @@
#undef NDEBUG
#endif
#include <cstdint>
#include <stdexcept>
#include <iostream> // FIXME: debug only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
@ -114,7 +113,7 @@ void ESM4::Land::load(ESM4::Reader& reader)
#if 0
std::cout << "Base Texture formid: 0x"
<< std::hex << mTextures[base.quadrant].base.formId
<< ", quad " << std::dec << (int)base.quadrant << std::endl;
<< ", quad " << std::dec << (int)base.quadrant;
#endif
}
break;
@ -144,9 +143,9 @@ void ESM4::Land::load(ESM4::Reader& reader)
#if 0
std::cout << "Additional Texture formId: 0x"
<< std::hex << layer.texture.formId
<< ", quad " << std::dec << (int)layer.texture.quadrant << std::endl;
<< ", quad " << std::dec << (int)layer.texture.quadrant;
std::cout << "Additional Texture layer: "
<< std::dec << (int)layer.texture.layerIndex << std::endl;
<< std::dec << (int)layer.texture.layerIndex;
#endif
currentAddQuad = layer.texture.quadrant;
break;
@ -168,7 +167,7 @@ void ESM4::Land::load(ESM4::Reader& reader)
{
reader.get(*it);
// FIXME: debug only
// std::cout << "pos: " << std::dec << (int)(*it).position << std::endl;
// std::cout << "pos: " << std::dec << (int)(*it).position;
}
}
mTextures[currentAddQuad].layers.push_back(layer);
@ -181,7 +180,7 @@ void ESM4::Land::load(ESM4::Reader& reader)
currentAddQuad = -1;
layer.data.clear();
// FIXME: debug only
// std::cout << "VTXT: count " << std::dec << count << std::endl;
// std::cout << "VTXT: count " << std::dec << count;
break;
}
case ESM4::SUB_VTEX: // only in Oblivion?
@ -197,7 +196,7 @@ void ESM4::Land::load(ESM4::Reader& reader)
{
reader.getFormId(*it);
// FIXME: debug only
// std::cout << "VTEX: " << std::hex << *it << std::endl;
// std::cout << "VTEX: " << std::hex << *it;
}
}
break;
@ -220,16 +219,16 @@ void ESM4::Land::load(ESM4::Reader& reader)
{
if (mTextures[i].base.formId == 0)
{
// std::cout << "ESM4::LAND " << ESM4::formIdToString(mFormId) << " missing base, quad " << i << std::endl;
// std::cout << "layers " << mTextures[i].layers.size() << std::endl;
// std::cout << "ESM4::LAND " << ESM4::formIdToString(mFormId) << " missing base, quad " << i;
// std::cout << "layers " << mTextures[i].layers.size();
// NOTE: can't set the default here since FO3/FONV may have different defaults
// mTextures[i].base.formId = 0x000008C0; // TerrainHDDirt01.dds
missing = true;
}
// else
//{
// std::cout << "ESM4::LAND " << ESM4::formIdToString(mFormId) << " base, quad " << i << std::endl;
// std::cout << "layers " << mTextures[i].layers.size() << std::endl;
// std::cout << "ESM4::LAND " << ESM4::formIdToString(mFormId) << " base, quad " << i;
// std::cout << "layers " << mTextures[i].layers.size();
// }
}
// at least one of the quadrants do not have a base texture, return without setting the flag

@ -28,7 +28,6 @@
#define ESM4_LAND_H
#include <cstdint>
#include <string>
#include <vector>
#include "formid.hpp"

@ -30,7 +30,8 @@
#include <cfloat> // FLT_MAX for gcc
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -50,7 +51,6 @@ void ESM4::LightingTemplate::load(ESM4::Reader& reader)
reader.getZString(mEditorId);
break;
case ESM4::SUB_DATA:
{
if (subHdr.dataSize == 36) // TES4
reader.get(&mLighting, 36);
if (subHdr.dataSize == 40) // FO3/FONV
@ -62,16 +62,11 @@ void ESM4::LightingTemplate::load(ESM4::Reader& reader)
}
else
reader.skipSubRecordData(); // throw?
break;
}
case ESM4::SUB_DALC: // TES5
{
// std::cout << "LGTM " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "LGTM " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::LGTM::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -102,11 +104,9 @@ void ESM4::Light::load(ESM4::Reader& reader)
case ESM4::SUB_MODT:
case ESM4::SUB_OBND:
case ESM4::SUB_VMAD: // Dragonborn only?
{
// std::cout << "LIGH " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "LIGH " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::LIGH::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -31,7 +31,6 @@
#endif
#include <stdexcept>
//#include <iostream> // FIXME: debugging only
#include "reader.hpp"
//#include "writer.hpp"

@ -27,7 +27,8 @@
#include "loadlvlc.hpp"
#include <stdexcept>
//#include <iostream> // FIXME
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -69,7 +70,7 @@ void ESM4::LevelledCreature::load(ESM4::Reader& reader)
reader.get(lvlo.item);
reader.get(lvlo.count);
// std::cout << "LVLC " << mEditorId << " LVLO lev " << lvlo.level << ", item " << lvlo.item
//<< ", count " << lvlo.count << std::endl;
// << /g", count " << lvlo.count;
// FIXME: seems to happen only once, don't add to mLvlObject
// LVLC TesKvatchCreature LVLO lev 1, item 1393819648, count 2
// 0x0001, 0x5314 0000, 0x0002
@ -87,7 +88,7 @@ void ESM4::LevelledCreature::load(ESM4::Reader& reader)
}
case ESM4::SUB_OBND: // FO3
{
// std::cout << "LVLC " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "LVLC " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}

@ -26,9 +26,10 @@
*/
#include "loadlvli.hpp"
#include <iostream> // FIXME: for debugging
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -66,9 +67,6 @@ void ESM4::LevelledItem::load(ESM4::Reader& reader)
reader.get(lvlo.level);
reader.get(lvlo.item);
reader.get(lvlo.count);
// std::cout << "LVLI " << mEditorId << " LVLO lev " << lvlo.level << ",
// item " << lvlo.item
// << ", count " << lvlo.count << std::endl;
break;
}
else
@ -85,13 +83,9 @@ void ESM4::LevelledItem::load(ESM4::Reader& reader)
case ESM4::SUB_OBND: // FO3/FONV
case ESM4::SUB_COED: // FO3/FONV
case ESM4::SUB_LVLG: // FO3/FONV
{
// std::cout << "LVLI " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize <<
// std::endl;
Log(Debug::Verbose) << "LVLI " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::LVLI::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
@ -99,7 +93,7 @@ void ESM4::LevelledItem::load(ESM4::Reader& reader)
// FIXME: testing
// if (mHasLvlItemFlags && mChanceNone >= 90)
// std::cout << "LVLI " << mEditorId << " chance none " << int(mChanceNone) << std::endl;
// std::cout << "LVLI " << mEditorId << " chance none " << int(mChanceNone);
}
bool ESM4::LevelledItem::calcAllLvlLessThanPlayer() const

@ -28,6 +28,7 @@
#define ESM4_LVLI_H
#include <cstdint>
#include <string>
#include <vector>
#include "formid.hpp"

@ -27,7 +27,8 @@
#include "loadlvln.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: testing only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -94,11 +95,9 @@ void ESM4::LevelledNpc::load(ESM4::Reader& reader)
case ESM4::SUB_COED: // owner
case ESM4::SUB_OBND: // object bounds
case ESM4::SUB_MODT: // model texture data
{
// std::cout << "LVLN " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "LVLN " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::LVLN::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -28,6 +28,7 @@
#define ESM4_LVLN_H
#include <cstdint>
#include <string>
#include <vector>
#include "formid.hpp"

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -50,11 +52,9 @@ void ESM4::Material::load(ESM4::Reader& reader)
break;
case ESM4::SUB_DNAM:
case ESM4::SUB_DATA:
{
// std::cout << "MATO " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "MATO " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::MATO::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -78,11 +80,9 @@ void ESM4::MiscItem::load(ESM4::Reader& reader)
case ESM4::SUB_OBND:
case ESM4::SUB_VMAD:
case ESM4::SUB_RNAM: // FONV
{
// std::cout << "MISC " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "MISC " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::MISC::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,9 +26,10 @@
*/
#include "loadmset.hpp"
#include <iostream> // FIXME: for debugging only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -128,12 +129,9 @@ void ESM4::MediaSet::load(ESM4::Reader& reader)
reader.get(mTime4);
break;
case ESM4::SUB_DATA:
{
// std::cout << "MSET " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "MSET " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::MSET::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,7 +27,8 @@
#include "loadmstt.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: testing only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -65,11 +66,9 @@ void ESM4::MovableStatic::load(ESM4::Reader& reader)
case ESM4::SUB_MODS:
case ESM4::SUB_FULL:
case ESM4::SUB_MODB:
{
// std::cout << "MSTT " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "MSTT " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::MSTT::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -29,7 +29,8 @@
#include "loadmusc.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
#include <components/debug/debuglog.hpp>
//#include "formid.hpp"
@ -52,18 +53,14 @@ void ESM4::Music::load(ESM4::Reader& reader)
break;
case ESM4::SUB_FNAM:
reader.getZString(mMusicFile);
// std::cout << "music: " << /*formIdToString(mFormId)*/mEditorId << " " << mMusicFile << std::endl;
break;
case ESM4::SUB_ANAM: // FONV float (attenuation in db? loop if positive?)
case ESM4::SUB_WNAM: // TES5
case ESM4::SUB_PNAM: // TES5
case ESM4::SUB_TNAM: // TES5
{
// std::cout << "MUSC " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "MUSC " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::MUSC::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -32,8 +32,6 @@
#include <stdexcept>
#include <iostream> // FIXME: debugging only
#include "reader.hpp"
//#include "writer.hpp"
@ -51,7 +49,7 @@ void ESM4::Navigation::IslandInfo::load(ESM4::Reader& reader)
if (count)
{
triangles.resize(count);
// std::cout << "NVMI island triangles " << std::dec << count << std::endl; // FIXME
// std::cout << "NVMI island triangles " << std::dec << count; // FIXME
for (std::vector<Navigation::Triangle>::iterator it = triangles.begin(); it != triangles.end(); ++it)
{
reader.get(*it);
@ -69,7 +67,7 @@ void ESM4::Navigation::IslandInfo::load(ESM4::Reader& reader)
#if 0
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "NVMI vert " << std::dec << (*it).x << ", " << (*it).y << ", " << (*it).z << std::endl;
std::cout << padding << "NVMI vert " << std::dec << (*it).x << ", " << (*it).y << ", " << (*it).z;
#endif
}
}
@ -94,9 +92,9 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
padding.insert(0, 4, '.');
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "NVMI formId: 0x" << std::hex << formId << std::endl;
std::cout << padding << "NVMI flags: " << std::hex << flags << std::endl;
std::cout << padding << "NVMI center: " << std::dec << x << ", " << y << ", " << z << std::endl;
std::cout << padding << "NVMI formId: 0x" << std::hex << formId;
std::cout << padding << "NVMI flags: " << std::hex << flags;
std::cout << padding << "NVMI center: " << std::dec << x << ", " << y << ", " << z;
#endif
reader.get(flagPrefMerges);
@ -104,7 +102,7 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
reader.get(count); // countMerged;
if (count)
{
// std::cout << "NVMI countMerged " << std::dec << count << std::endl;
// std::cout << "NVMI countMerged " << std::dec << count;
formIdMerged.resize(count);
for (FormId& value : formIdMerged)
reader.getFormId(value);
@ -113,7 +111,7 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
reader.get(count); // countPrefMerged;
if (count)
{
// std::cout << "NVMI countPrefMerged " << std::dec << count << std::endl;
// std::cout << "NVMI countPrefMerged " << std::dec << count;
formIdPrefMerged.resize(count);
for (FormId& value : formIdPrefMerged)
reader.getFormId(value);
@ -122,7 +120,7 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
reader.get(count); // countLinkedDoors;
if (count)
{
// std::cout << "NVMI countLinkedDoors " << std::dec << count << std::endl;
// std::cout << "NVMI countLinkedDoors " << std::dec << count;
linkedDoors.resize(count);
for (std::vector<DoorRef>::iterator it = linkedDoors.begin(); it != linkedDoors.end(); ++it)
{
@ -138,8 +136,8 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
island2.load(reader);
islandInfo.push_back(island2); // Maybe don't use a vector for just one entry?
}
else if (flags == FLG_Island) // FIXME: debug only
std::cerr << "nvmi no island but has 0x20 flag" << std::endl;
// else if (flags == FLG_Island) // FIXME: debug only
// std::cerr << "nvmi no island but has 0x20 flag";
reader.get(locationMarker);
@ -157,9 +155,9 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
if (worldSpaceId == ESM4::FLG_Morrowind)
std::cout << padding << "NVMI MW: X " << std::dec << cellGrid.grid.x << ", Y " << cellGrid.grid.y << std::endl;
std::cout << padding << "NVMI MW: X " << std::dec << cellGrid.grid.x << ", Y " << cellGrid.grid.y;
else
std::cout << padding << "NVMI SR: X " << std::dec << cellGrid.grid.x << ", Y " << cellGrid.grid.y << std::endl;
std::cout << padding << "NVMI SR: X " << std::dec << cellGrid.grid.x << ", Y " << cellGrid.grid.y;
#endif
}
else
@ -170,9 +168,9 @@ void ESM4::Navigation::NavMeshInfo::load(ESM4::Reader& reader)
#if 0
if (worldSpaceId == 0) // interior
std::cout << "NVMI Interior: cellId " << std::hex << cellGrid.cellId << std::endl;
std::cout << "NVMI Interior: cellId " << std::hex << cellGrid.cellId;
else
std::cout << "NVMI FormID: cellId " << std::hex << cellGrid.cellId << std::endl;
std::cout << "NVMI FormID: cellId " << std::hex << cellGrid.cellId;
#endif
}
}
@ -283,7 +281,7 @@ void ESM4::Navigation::load(ESM4::Reader& reader)
mPreferredPaths.push_back(std::make_pair(node, preferredPaths));
#if 0
std::cout << "node " << std::hex << node // FIXME: debugging only
<< ", count " << count << ", i " << std::dec << i << std::endl;
<< ", count " << count << ", i " << std::dec << i;
#endif
}
reader.get(count);
@ -295,7 +293,7 @@ void ESM4::Navigation::load(ESM4::Reader& reader)
mPreferredPaths.push_back(std::make_pair(node, preferredPaths)); // empty
#if 0
std::cout << "node " << std::hex << node // FIXME: debugging only
<< ", count " << 0 << std::endl;
<< ", count " << 0;
#endif
reader.get(count); // HACK
@ -309,7 +307,7 @@ void ESM4::Navigation::load(ESM4::Reader& reader)
reader.get(index);
#if 0
std::cout << "node " << std::hex << node // FIXME: debugging only
<< ", index " << index << ", i " << std::dec << total+i << std::endl;
<< ", index " << index << ", i " << std::dec << total+i;
#endif
FormId nodeFormId = FormId::fromUint32(node); // should we apply reader.adjustFormId?
// std::pair<std::map<FormId, std::uint32_t>::iterator, bool> res =
@ -324,7 +322,7 @@ void ESM4::Navigation::load(ESM4::Reader& reader)
{
std::uint32_t version; // always the same? (0x0c)
reader.get(version); // TODO: store this or use it for merging?
// std::cout << "NAVI version " << std::dec << version << std::endl;
// std::cout << "NAVI version " << std::dec << version;
break;
}
case ESM4::SUB_NVMI: // multiple
@ -335,7 +333,7 @@ void ESM4::Navigation::load(ESM4::Reader& reader)
break;
}
// std::cout << "\nNVMI start" << std::endl;
// std::cout << "\nNVMI start";
NavMeshInfo nvmi;
nvmi.load(reader);
mNavMeshInfo.push_back(nvmi);

@ -29,7 +29,7 @@
#include <cstring>
#include <stdexcept>
#include <iostream> // FIXME: debugging only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -37,7 +37,7 @@
void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
{
// std::cout << "start: divisor " << std::dec << divisor << ", segments " << triSegments.size() << //std::endl;
//"this 0x" << this << std::endl; // FIXME
//"this 0x" << this; // FIXME
std::uint32_t count;
@ -73,9 +73,9 @@ void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
if (worldSpaceId == ESM4::FLG_Morrowind)
std::cout << padding << "NVNM MW: X " << std::dec << cellGrid.grid.x << ", Y " << cellGrid.grid.y << std::endl;
std::cout << padding << "NVNM MW: X " << std::dec << cellGrid.grid.x << ", Y " << cellGrid.grid.y;
else
std::cout << padding << "NVNM SR: X " << std::dec << cellGrid.grid.x << ", Y " << cellGrid.grid.y << std::endl;
std::cout << padding << "NVNM SR: X " << std::dec << cellGrid.grid.x << ", Y " << cellGrid.grid.y;
#endif
}
else
@ -88,9 +88,9 @@ void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
std::string padding; // FIXME
padding.insert(0, reader.stackSize()*2, ' ');
if (worldSpaceId == 0) // interior
std::cout << padding << "NVNM Interior: cellId " << std::hex << cellGrid.cellId << std::endl;
std::cout << padding << "NVNM Interior: cellId " << std::hex << cellGrid.cellId;
else
std::cout << padding << "NVNM FormID: cellId " << std::hex << cellGrid.cellId << std::endl;
std::cout << padding << "NVNM FormID: cellId " << std::hex << cellGrid.cellId;
#endif
}
@ -104,7 +104,7 @@ void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
// FIXME: debugging only
#if 0
//if (reader.hdr().record.id == 0x2004ecc) // FIXME
std::cout << "nvnm vert " << (*it).x << ", " << (*it).y << ", " << (*it).z << std::endl;
std::cout << "nvnm vert " << (*it).x << ", " << (*it).y << ", " << (*it).z;
#endif
}
}
@ -128,7 +128,7 @@ void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
reader.get(*it);
// FIXME: debugging only
#if 0
std::cout << "nvnm ext 0x" << std::hex << (*it).navMesh << std::endl;
std::cout << "nvnm ext 0x" << std::hex << (*it).navMesh;
#endif
}
}
@ -184,7 +184,7 @@ void ESM4::NavMesh::NVNMstruct::load(ESM4::Reader& reader)
#if 0
if (triSegments.size() != divisor*divisor)
std::cout << "divisor " << std::dec << divisor << ", segments " << triSegments.size() << //std::endl;
"this 0x" << this << std::endl;
"this 0x" << this;
#endif
}
@ -193,15 +193,15 @@ void ESM4::NavMesh::load(ESM4::Reader& reader)
mFormId = reader.hdr().record.getFormId();
mFlags = reader.hdr().record.flags;
// std::cout << "NavMesh 0x" << std::hex << this << std::endl; // FIXME
// std::cout << "NavMesh 0x" << std::hex << this; // FIXME
std::uint32_t subSize = 0; // for XXXX sub record
// FIXME: debugging only
#if 0
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "NAVM flags 0x" << std::hex << reader.hdr().record.flags << std::endl;
std::cout << padding << "NAVM id 0x" << std::hex << reader.hdr().record.id << std::endl;
std::cout << padding << "NAVM flags 0x" << std::hex << reader.hdr().record.flags;
std::cout << padding << "NAVM id 0x" << std::hex << reader.hdr().record.id;
#endif
while (reader.getSubRecordHeader())
{
@ -225,10 +225,11 @@ void ESM4::NavMesh::load(ESM4::Reader& reader)
subSize = 0;
}
else
// const ESM4::SubRecordHeader& subHdr = reader.subRecordHeader();
// std::cout << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
{
const ESM4::SubRecordHeader& subHdr = reader.subRecordHeader();
Log(Debug::Verbose) << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData(); // FIXME: process the subrecord rather than skip
}
break;
}
case ESM4::SUB_XXXX:
@ -245,16 +246,15 @@ void ESM4::NavMesh::load(ESM4::Reader& reader)
case ESM4::SUB_NVGD: // FO3
case ESM4::SUB_NVEX: // FO3
case ESM4::SUB_EDID: // FO3
{
reader.skipSubRecordData(); // FIXME:
Log(Debug::Verbose) << ESM::printName(reader.subRecordHeader().typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error(
"ESM4::NAVM::load - Unknown subrecord " + ESM::printName(reader.subRecordHeader().typeId));
}
}
// std::cout << "num nvnm " << std::dec << mData.size() << std::endl; // FIXME
// std::cout << "num nvnm " << std::dec << mData.size(); // FIXME
}
// void ESM4::NavMesh::save(ESM4::Writer& writer) const

@ -27,7 +27,8 @@
#include "loadnote.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: testing only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -62,11 +63,9 @@ void ESM4::Note::load(ESM4::Reader& reader)
case ESM4::SUB_TNAM:
case ESM4::SUB_XNAM:
case ESM4::SUB_OBND:
{
// std::cout << "NOTE " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "NOTE " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::NOTE::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,16 +27,12 @@
#include "loadnpc.hpp"
#include <cstring>
#include <iomanip> // NOTE: for testing only
#include <iostream> // NOTE: for testing only
#include <sstream> // NOTE: for testing only
#include <stdexcept>
#include <string> // getline
//#include <boost/iostreams/filtering_streambuf.hpp>
//#include <boost/iostreams/copy.hpp>
#include <components/debug/debuglog.hpp>
#include "formid.hpp" // NOTE: for testing only
#include "formid.hpp"
#include "reader.hpp"
//#include "writer.hpp"
@ -221,8 +217,8 @@ void ESM4::Npc::load(ESM4::Reader& reader)
case ESM4::SUB_FNAM:
{
reader.get(mFgRace);
// std::cout << "race " << mEditorId << " " << mRace << std::endl; // FIXME
// std::cout << "fg race " << mEditorId << " " << mFgRace << std::endl; // FIXME
// std::cout << "race " << mEditorId << " " << mRace; // FIXME
// std::cout << "fg race " << mEditorId << " " << mFgRace; // FIXME
break;
}
case ESM4::SUB_PNAM: // FO3/FONV/TES5
@ -259,7 +255,7 @@ void ESM4::Npc::load(ESM4::Reader& reader)
case ESM4::SUB_DSTD:
case ESM4::SUB_DSTF:
{
#if 1
#if 0
std::vector<unsigned char> dataBuf(subHdr.dataSize);
reader.get(dataBuf.data(), subHdr.dataSize);
@ -276,10 +272,9 @@ void ESM4::Npc::load(ESM4::Reader& reader)
else if (i < (size_t)(subHdr.dataSize - 1)) // quiesce gcc
ss << " ";
}
std::cout << ss.str() << std::endl;
std::cout << ss.str();
#else
// std::cout << "NPC_ " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "NPC_ " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
#endif
break;
@ -318,11 +313,9 @@ void ESM4::Npc::load(ESM4::Reader& reader)
case ESM4::SUB_EAMT: // FO3
case ESM4::SUB_NAM4: // FO3
case ESM4::SUB_COED: // FO3
{
// std::cout << "NPC_ " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "NPC_ " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::NPC_::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,7 +27,6 @@
#include "loadotft.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
#include "reader.hpp"
//#include "writer.hpp"
@ -53,16 +52,11 @@ void ESM4::Outfit::load(ESM4::Reader& reader)
{
FormId formId;
reader.getFormId(formId);
mInventory.push_back(formId);
}
break;
}
default:
// std::cout << "OTFT " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
// reader.skipSubRecordData();
throw std::runtime_error("ESM4::OTFT::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}

@ -28,7 +28,8 @@
#include <cstring>
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -51,7 +52,7 @@ void ESM4::AIPackage::load(ESM4::Reader& reader)
{
if (subHdr.dataSize != sizeof(PKDT) && subHdr.dataSize == 4)
{
// std::cout << "skip fallout" << mEditorId << std::endl; // FIXME
// std::cout << "skip fallout" << mEditorId; // FIXME
reader.get(mData.flags);
mData.type = 0; // FIXME
}
@ -163,12 +164,9 @@ void ESM4::AIPackage::load(ESM4::Reader& reader)
case ESM4::SUB_CIS2: // TES5
case ESM4::SUB_VMAD: // TES5
case ESM4::SUB_TPIC: // TES5
{
// std::cout << "PACK " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "PACK " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::PACK::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,8 +27,8 @@
#include "loadpgrd.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
//#include <iomanip> // FIXME: for debugging only
#include <components/debug/debuglog.hpp>
#include "formid.hpp" // FIXME: for mEditorId workaround
#include "reader.hpp"
@ -87,7 +87,7 @@ void ESM4::Pathgrid::load(ESM4::Reader& reader)
// CELL formId 00049E2A
// PGRD formId 000304B7
// if (mFormId == 0x0001C2C8)
// std::cout << link.startNode << "," << link.endNode << std::endl;
// std::cout << link.startNode << "," << link.endNode;
mLinks.push_back(link);
}
}
@ -140,10 +140,9 @@ void ESM4::Pathgrid::load(ESM4::Reader& reader)
else if (i < subHdr.dataSize-1)
ss << " ";
}
std::cout << ss.str() << std::endl;
std::cout << ss.str();
#else
// std::cout << "PGRD " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "PGRD " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
#endif
break;

@ -28,9 +28,10 @@
*/
#include "loadpgre.hpp"
#include <iostream> // FIXME: for debugging only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -75,15 +76,12 @@ void ESM4::PlacedGrenade::load(ESM4::Reader& reader)
case ESM4::SUB_XSCL:
case ESM4::SUB_DATA:
{
// std::cout << "PGRE " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "PGRE " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
std::cout << "PGRE " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize << std::endl;
reader.skipSubRecordData();
// throw std::runtime_error("ESM4::PGRE::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
throw std::runtime_error("ESM4::PGRE::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}
}

@ -28,9 +28,10 @@
*/
#include "loadpwat.hpp"
#include <iostream> // FIXME: for debugging only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -52,15 +53,12 @@ void ESM4::PlaceableWater::load(ESM4::Reader& reader)
case ESM4::SUB_MODL:
case ESM4::SUB_DNAM:
{
// std::cout << "PWAT " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "PWAT " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
std::cout << "PWAT " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize << std::endl;
reader.skipSubRecordData();
// throw std::runtime_error("ESM4::PWAT::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
throw std::runtime_error("ESM4::PWAT::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}
}

@ -27,9 +27,10 @@
#include "loadqust.hpp"
#include <cstring>
#include <iostream> // FIXME: for debugging only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -61,7 +62,7 @@ void ESM4::Quest::load(ESM4::Reader& reader)
mData.questDelay = 0.f; // unused in TES4 but keep it clean
// if ((mData.flags & Flag_StartGameEnabled) != 0)
// std::cout << "start quest " << mEditorId << std::endl;
// std::cout << "start quest " << mEditorId;
}
else
reader.get(mData); // FO3
@ -157,18 +158,15 @@ void ESM4::Quest::load(ESM4::Reader& reader)
case ESM4::SUB_SPOR: // TES5
case ESM4::SUB_VMAD: // TES5
case ESM4::SUB_VTCK: // TES5
{
// std::cout << "QUST " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "QUST " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::QUST::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}
// if (mEditorId == "DAConversations")
// std::cout << mEditorId << std::endl;
// std::cout << mEditorId;
}
// void ESM4::Quest::save(ESM4::Writer& writer) const

@ -28,6 +28,8 @@
#define ESM4_QUST_H
#include <cstdint>
#include <string>
#include <vector>
#include "formid.hpp"
#include "script.hpp" // TargetCondition, ScriptDefinition

@ -27,10 +27,10 @@
#include "loadrace.hpp"
#include <cstring>
#include <iomanip> // FIXME: for debugging only
#include <iostream> // FIXME: for debugging only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "formid.hpp"
#include "reader.hpp"
//#include "writer.hpp"
@ -53,7 +53,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
while (reader.getSubRecordHeader())
{
const ESM4::SubRecordHeader& subHdr = reader.subRecordHeader();
// std::cout << "RACE " << ESM::printName(subHdr.typeId) << std::endl;
// std::cout << "RACE " << ESM::printName(subHdr.typeId);
switch (subHdr.typeId)
{
case ESM4::SUB_EDID:
@ -129,7 +129,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
else if (i < 256/*bufSize*/-1)
ss << " ";
}
std::cout << ss.str() << std::endl;
std::cout << ss.str();
#else
if (subHdr.dataSize == 36) // TES4/FO3/FONV
{
@ -215,8 +215,8 @@ void ESM4::Race::load(ESM4::Reader& reader)
else
{
reader.skipSubRecordData();
std::cout << "RACE " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize
<< std::endl;
// std::cout << "RACE " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize <<
// std::endl;
}
#endif
break;
@ -346,12 +346,12 @@ void ESM4::Race::load(ESM4::Reader& reader)
}
// else if (curr_part == 2) // egt
// {
// // std::cout << mEditorId << " egt " << currentIndex << std::endl; // FIXME
// // std::cout << mEditorId << " egt " << currentIndex; // FIXME
// reader.skipSubRecordData(); // FIXME TES5 egt
// }
else
{
// std::cout << mEditorId << " hkx " << currentIndex << std::endl; // FIXME
// std::cout << mEditorId << " hkx " << currentIndex; // FIXME
reader.skipSubRecordData(); // FIXME TES5 hkx
}
@ -518,8 +518,8 @@ void ESM4::Race::load(ESM4::Reader& reader)
else
{
reader.skipSubRecordData();
std::cout << "RACE " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize
<< std::endl;
// std::cout << "RACE " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize <<
// std::endl;
}
break;
@ -547,7 +547,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
case ESM4::SUB_WNAM: // ARMO FormId
{
reader.getFormId(mSkin);
// std::cout << mEditorId << " skin " << formIdToString(mSkin) << std::endl; // FIXME
// std::cout << mEditorId << " skin " << formIdToString(mSkin); // FIXME
break;
}
case ESM4::SUB_BODT: // body template
@ -584,7 +584,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
mHeadPartIdsFemale[currentIndex] = formId;
// std::cout << mEditorId << (isMale ? " male head " : " female head ")
//<< formIdToString(formId) << " " << currentIndex << std::endl; // FIXME
// << /gformIdToString(formId) << " " << currentIndex; // FIXME
break;
}
@ -632,7 +632,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
{
std::string name;
reader.getZString(name);
// std::cout << mEditorId << " " << name << std::endl;
// std::cout << mEditorId << " " << name;
break;
}
@ -686,13 +686,9 @@ void ESM4::Race::load(ESM4::Reader& reader)
case ESM4::SUB_MODT: // FO3
case ESM4::SUB_MODD: // FO3
case ESM4::SUB_ONAM: // FO3
{
// std::cout << "RACE " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize <<
// std::endl;
Log(Debug::Verbose) << "RACE " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::RACE::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,9 +26,10 @@
*/
#include "loadrefr.hpp"
#include <iostream> // FIXME: debug only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
// #include "writer.hpp"
@ -68,11 +69,11 @@ void ESM4::Reference::load(ESM4::Reader& reader)
if (mFlags & ESM4::Rec_Disabled)
std::cout << "REFR disable at start " << formIdToString(mFormId) <<
" baseobj " << formIdToString(mBaseObj) <<
" " << (mEditorId.empty() ? "" : mEditorId) << std::endl; // FIXME
" " << (mEditorId.empty() ? "" : mEditorId); // FIXME
#endif
// if (mBaseObj == 0x20) // e.g. FO3 mFormId == 0x0007E90F
// if (mBaseObj == 0x17)
// std::cout << mEditorId << std::endl;
// std::cout << mEditorId;
break;
}
case ESM4::SUB_DATA:
@ -95,7 +96,7 @@ void ESM4::Reference::load(ESM4::Reader& reader)
reader.getFormId(mEsp.parent);
reader.get(mEsp.flags);
// std::cout << "REFR parent: " << formIdToString(mEsp.parent) << " ref " << formIdToString(mFormId)
//<< ", 0x" << std::hex << (mEsp.flags & 0xff) << std::endl;// FIXME
// << /g", 0x" << std::hex << (mEsp.flags & 0xff);// FIXME
break;
}
case ESM4::SUB_XTEL:
@ -104,7 +105,7 @@ void ESM4::Reference::load(ESM4::Reader& reader)
reader.get(mDoor.destPos);
if (esmVer == ESM::VER_094 || esmVer == ESM::VER_170 || isFONV)
reader.get(mDoor.flags); // not in Obvlivion
// std::cout << "REFR dest door: " << formIdToString(mDoor.destDoor) << std::endl;// FIXME
// std::cout << "REFR dest door: " << formIdToString(mDoor.destDoor);// FIXME
break;
}
case ESM4::SUB_XSED:
@ -114,18 +115,18 @@ void ESM4::Reference::load(ESM4::Reader& reader)
{
uint8_t data;
reader.get(data);
// std::cout << "REFR XSED " << std::hex << (int)data << std::endl;
// std::cout << "REFR XSED " << std::hex << (int)data;
break;
}
else if (subHdr.dataSize == 4)
{
uint32_t data;
reader.get(data);
// std::cout << "REFR XSED " << std::hex << (int)data << std::endl;
// std::cout << "REFR XSED " << std::hex << (int)data;
break;
}
// std::cout << "REFR XSED dataSize: " << subHdr.dataSize << std::endl;// FIXME
// std::cout << "REFR XSED dataSize: " << subHdr.dataSize;// FIXME
reader.skipSubRecordData();
break;
}
@ -146,7 +147,7 @@ void ESM4::Reference::load(ESM4::Reader& reader)
// std::endl;
break;
}
// std::cout << "REFR XLOD dataSize: " << subHdr.dataSize << std::endl;// FIXME
// std::cout << "REFR XLOD dataSize: " << subHdr.dataSize;// FIXME
reader.skipSubRecordData();
break;
}
@ -156,11 +157,11 @@ void ESM4::Reference::load(ESM4::Reader& reader)
{
uint32_t data;
reader.get(data);
// std::cout << "REFR XACT " << std::hex << (int)data << std::endl;
// std::cout << "REFR XACT " << std::hex << (int)data;
break;
}
// std::cout << "REFR XACT dataSize: " << subHdr.dataSize << std::endl;// FIXME
// std::cout << "REFR XACT dataSize: " << subHdr.dataSize;// FIXME
reader.skipSubRecordData();
break;
}
@ -178,7 +179,7 @@ void ESM4::Reference::load(ESM4::Reader& reader)
// XRTM : 000A4DD7 in OblivionRDCavesMiddleA05 (maybe spawn points?)
FormId marker;
reader.getFormId(marker);
// std::cout << "REFR " << mEditorId << " XRTM : " << formIdToString(marker) << std::endl;// FIXME
// std::cout << "REFR " << mEditorId << " XRTM : " << formIdToString(marker);// FIXME
break;
}
case ESM4::SUB_TNAM: // reader.get(mMapMarker); break;
@ -197,14 +198,14 @@ void ESM4::Reference::load(ESM4::Reader& reader)
case ESM4::SUB_FNAM:
{
// std::cout << "REFR " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
// << /gsubHdr.dataSize;
reader.skipSubRecordData();
break;
}
case ESM4::SUB_XTRG: // formId
{
reader.getFormId(mTargetRef);
// std::cout << "REFR XRTG : " << formIdToString(id) << std::endl;// FIXME
// std::cout << "REFR XRTG : " << formIdToString(id);// FIXME
break;
}
case ESM4::SUB_CNAM:
@ -223,7 +224,7 @@ void ESM4::Reference::load(ESM4::Reader& reader)
{
reader.getFormId(sid);
// if (mFormId == 0x0016b74B)
// std::cout << "REFR SCRO : " << formIdToString(sid) << std::endl;// FIXME
// std::cout << "REFR SCRO : " << formIdToString(sid);// FIXME
break;
}
case ESM4::SUB_XLOC:
@ -325,7 +326,7 @@ void ESM4::Reference::load(ESM4::Reader& reader)
{
// if (mFormId == 0x0007e90f) // XPRM XPOD
// if (mBaseObj == 0x17) //XPRM XOCP occlusion plane data XMBO bound half extents
// std::cout << "REFR " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "REFR " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
@ -334,7 +335,7 @@ void ESM4::Reference::load(ESM4::Reader& reader)
}
}
// if (mFormId == 0x0016B74B) // base is TACT vCasinoUltraLuxeRadio in cell ULCasino
// std::cout << "REFR SCRO " << formIdToString(sid) << std::endl;
// std::cout << "REFR SCRO " << formIdToString(sid);
}
// void ESM4::Reference::save(ESM4::Writer& writer) const

@ -32,8 +32,7 @@
#include <stdexcept>
//#include <iostream> // FIXME: debug only
//#include "formid.hpp"
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -73,7 +72,7 @@ void ESM4::Region::load(ESM4::Reader& reader)
#if 0
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "RPLD: 0x" << std::hex << *it << std::endl;
std::cout << padding << "RPLD: 0x" << std::hex << *it;
#endif
}
@ -96,7 +95,7 @@ void ESM4::Region::load(ESM4::Reader& reader)
#if 0
int dummy;
reader.get(dummy);
std::cout << "REGN " << mEditorId << " " << dummy << std::endl;
std::cout << "REGN " << mEditorId << " " << dummy;
#else
reader.skipSubRecordData();
#endif
@ -105,7 +104,7 @@ void ESM4::Region::load(ESM4::Reader& reader)
case ESM4::SUB_RDMO: // not seen in FO3/FONV?
{
// std::cout << "REGN " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
// << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
@ -130,7 +129,6 @@ void ESM4::Region::load(ESM4::Reader& reader)
case ESM4::SUB_RDSB: // FONV
case ESM4::SUB_RDSI: // FONV
case ESM4::SUB_NVMI: // TES5
{
// RDAT skipping... following is a map
// RDMP skipping... map name
//
@ -145,11 +143,9 @@ void ESM4::Region::load(ESM4::Reader& reader)
// RDAT skipping... following is grass
// RDGS skipping... unknown, maybe grass
// std::cout << "REGN " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
reader.skipSubRecordData(); // FIXME: process the subrecord rather than skip
Log(Debug::Verbose) << "REGN " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::REGN::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,7 +27,6 @@
#include "loadroad.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
#include "formid.hpp" // FIXME: for workaround
#include "reader.hpp"

@ -28,9 +28,10 @@
*/
#include "loadscol.hpp"
#include <iostream> // FIXME: for debugging only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -53,16 +54,11 @@ void ESM4::StaticCollection::load(ESM4::Reader& reader)
case ESM4::SUB_MODT:
case ESM4::SUB_ONAM:
case ESM4::SUB_DATA:
{
// std::cout << "SCOL " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "SCOL " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
std::cout << "SCOL " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize << std::endl;
reader.skipSubRecordData();
// throw std::runtime_error("ESM4::SCOL::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
throw std::runtime_error("ESM4::SCOL::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}
}

@ -26,8 +26,6 @@
*/
#include "loadscpt.hpp"
#include <iomanip>
#include <iostream> // FIXME: debugging only
#include <stdexcept>
#include "reader.hpp"
@ -70,7 +68,7 @@ void ESM4::Script::load(ESM4::Reader& reader)
else if (i < 256/*bufSize*/-1)
ss << " ";
}
std::cout << ss.str() << std::endl;
std::cout << ss.str();
#else
reader.get(mScript.scriptHeader);
#endif
@ -79,7 +77,7 @@ void ESM4::Script::load(ESM4::Reader& reader)
case ESM4::SUB_SCTX:
reader.getString(mScript.scriptSource);
// if (mEditorId == "CTrapLogs01SCRIPT")
// std::cout << mScript.scriptSource << std::endl;
// std::cout << mScript.scriptSource;
break;
case ESM4::SUB_SCDA: // compiled script data
{
@ -87,12 +85,12 @@ void ESM4::Script::load(ESM4::Reader& reader)
#if 0
if (subHdr.dataSize >= 4096)
{
std::cout << "Skipping " << mEditorId << std::endl;
std::cout << "Skipping " << mEditorId;
reader.skipSubRecordData();
break;
}
std::cout << mEditorId << std::endl;
std::cout << mEditorId;
unsigned char mDataBuf[4096/*bufSize*/];
reader.get(mDataBuf, subHdr.dataSize);
@ -109,7 +107,7 @@ void ESM4::Script::load(ESM4::Reader& reader)
else if (i < 4096/*bufSize*/-1)
ss << " ";
}
std::cout << ss.str() << std::endl;
std::cout << ss.str();
#else
reader.skipSubRecordData();
#endif
@ -132,27 +130,17 @@ void ESM4::Script::load(ESM4::Reader& reader)
break;
}
case ESM4::SUB_SCVR: // assumed always pair with SLSD
{
reader.getZString(localVar.variableName);
mScript.localVarData.push_back(localVar);
break;
}
case ESM4::SUB_SCRV:
{
std::uint32_t index;
reader.get(index);
mScript.localRefVarIndex.push_back(index);
break;
}
default:
// std::cout << "SCPT " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
// reader.skipSubRecordData();
// break;
throw std::runtime_error("ESM4::SCPT::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}
}

@ -28,6 +28,7 @@
#define ESM4_SCPT_H
#include <cstdint>
#include <string>
#include "formid.hpp"
#include "script.hpp"

@ -27,7 +27,8 @@
#include "loadscrl.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: testing only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -53,11 +54,9 @@ void ESM4::Scroll::load(ESM4::Reader& reader)
reader.getLocalizedString(mText);
break;
case ESM4::SUB_DATA:
{
reader.get(mData.value);
reader.get(mData.weight);
break;
}
case ESM4::SUB_MODL:
reader.getZString(mModel);
break;
@ -73,11 +72,9 @@ void ESM4::Scroll::load(ESM4::Reader& reader)
case ESM4::SUB_MODT:
case ESM4::SUB_SPIT:
case ESM4::SUB_CIS2:
{
// std::cout << "SCRL " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "SCRL " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::SCRL::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -28,6 +28,7 @@
#define ESM4_SGST_H
#include <cstdint>
#include <string>
#include <vector>
#include "effect.hpp"

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -74,11 +76,9 @@ void ESM4::SoulGem::load(ESM4::Reader& reader)
case ESM4::SUB_KWDA:
case ESM4::SUB_NAM0:
case ESM4::SUB_OBND:
{
// std::cout << "SLGM " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "SLGM " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::SLGM::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,7 +27,8 @@
#include "loadsndr.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: for debugging only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -47,16 +48,13 @@ void ESM4::SoundReference::load(ESM4::Reader& reader)
reader.getZString(mEditorId);
break;
case ESM4::SUB_CTDA:
{
reader.get(&mTargetCondition, 20);
reader.get(mTargetCondition.runOn);
reader.get(mTargetCondition.reference);
if (mTargetCondition.reference)
reader.adjustFormId(mTargetCondition.reference);
reader.skipSubRecordData(4); // unknown
break;
}
case ESM4::SUB_GNAM:
reader.getFormId(mSoundCategory);
break;
@ -77,12 +75,9 @@ void ESM4::SoundReference::load(ESM4::Reader& reader)
break;
case ESM4::SUB_CNAM: // CRC32 hash
case ESM4::SUB_FNAM: // unknown
{
// std::cout << "SNDR " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "SNDR " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::SNDR::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,7 +27,8 @@
#include "loadsoun.hpp"
#include <stdexcept>
//#include <iostream> // FIXME
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -53,7 +54,6 @@ void ESM4::Sound::load(ESM4::Reader& reader)
reader.get(mData);
break;
case ESM4::SUB_SNDD:
{
if (subHdr.dataSize == 8)
reader.get(&mData, 8);
else
@ -61,21 +61,16 @@ void ESM4::Sound::load(ESM4::Reader& reader)
reader.get(mData);
reader.get(mExtra);
}
break;
}
case ESM4::SUB_OBND: // TES5 only
case ESM4::SUB_SDSC: // TES5 only
case ESM4::SUB_ANAM: // FO3
case ESM4::SUB_GNAM: // FO3
case ESM4::SUB_HNAM: // FO3
case ESM4::SUB_RNAM: // FONV
{
// std::cout << "SOUN " << ESM::printName(subHdr.typeId) << " skipping..."
//<< subHdr.dataSize << std::endl;
Log(Debug::Verbose) << "SOUN " << ESM::printName(subHdr.typeId) << " skipping..." << subHdr.dataSize;
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::SOUN::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,9 +26,10 @@
*/
#include "loadstat.hpp"
#include <iostream> // FIXME: debug only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
// #include "writer.hpp"
@ -55,7 +56,7 @@ void ESM4::Static::load(ESM4::Reader& reader)
{
// version is only availabe in TES5 (seems to be 27 or 28?)
// if (reader.esmVersion() == ESM::VER_094 || reader.esmVersion() == ESM::VER_170)
// std::cout << "STAT MODT ver: " << std::hex << reader.hdr().record.version << std::endl;
// std::cout << "STAT MODT ver: " << std::hex << reader.hdr().record.version;
// for TES4 these are just a sequence of bytes
mMODT.resize(subHdr.dataSize / sizeof(std::uint8_t));
@ -65,7 +66,7 @@ void ESM4::Static::load(ESM4::Reader& reader)
#if 0
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "MODT: " << std::hex << *it << std::endl;
std::cout << padding << "MODT: " << std::hex << *it;
#endif
}
break;
@ -76,11 +77,9 @@ void ESM4::Static::load(ESM4::Reader& reader)
case ESM4::SUB_MNAM:
case ESM4::SUB_BRUS: // FONV
case ESM4::SUB_RNAM: // FONV
{
// std::cout << "STAT " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "STAT " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::STAT::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,9 +26,10 @@
*/
#include "loadtact.hpp"
#include <iostream> // FIXME: testing only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -71,11 +72,9 @@ void ESM4::TalkingActivator::load(ESM4::Reader& reader)
case ESM4::SUB_PNAM:
case ESM4::SUB_MODT: // texture file hash?
case ESM4::SUB_OBND:
{
// std::cout << "TACT " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "TACT " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::TACT::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,7 +27,8 @@
#include "loadterm.hpp"
#include <stdexcept>
//#include <iostream> // FIXME: testing only
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -83,11 +84,9 @@ void ESM4::Terminal::load(ESM4::Reader& reader)
case ESM4::SUB_TNAM:
case ESM4::SUB_OBND:
case ESM4::SUB_MODS: // FONV
{
// std::cout << "TERM " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "TERM " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::TERM::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -32,7 +32,7 @@
#include <stdexcept>
#include <iostream> // FIXME: debugging only
#include <components/debug/debuglog.hpp>
#include "common.hpp"
#include "formid.hpp"
@ -97,7 +97,7 @@ void ESM4::Header::load(ESM4::Reader& reader)
#if 0
std::string padding;
padding.insert(0, reader.stackSize()*2, ' ');
std::cout << padding << "ESM4::Header::ONAM overrides: " << formIdToString(mOverride) << std::endl;
std::cout << padding << "ESM4::Header::ONAM overrides: " << formIdToString(mOverride);
#endif
}
break;
@ -106,11 +106,9 @@ void ESM4::Header::load(ESM4::Reader& reader)
case ESM4::SUB_INCC:
case ESM4::SUB_OFST: // Oblivion only?
case ESM4::SUB_DELE: // Oblivion only?
{
// std::cout << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::Header::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -27,6 +27,8 @@
#ifndef ESM4_TES4_H
#define ESM4_TES4_H
#include <cstdint>
#include <string>
#include <vector>
#include "../esm/common.hpp" // ESMVersion, MasterData

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -61,11 +63,9 @@ void ESM4::Tree::load(ESM4::Reader& reader)
case ESM4::SUB_OBND:
case ESM4::SUB_PFIG:
case ESM4::SUB_PFPC:
{
// std::cout << "TREE " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "TREE " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::TREE::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,9 +26,10 @@
*/
#include "loadtxst.hpp"
#include <iostream> // FIXME: testing only
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -73,11 +74,9 @@ void ESM4::TextureSet::load(ESM4::Reader& reader)
case ESM4::SUB_DNAM:
case ESM4::SUB_DODT:
case ESM4::SUB_OBND: // object bounds
{
// std::cout << "TXST " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "TXST " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::TXST::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -28,6 +28,8 @@
#include <stdexcept>
#include <components/debug/debuglog.hpp>
#include "reader.hpp"
//#include "writer.hpp"
@ -176,11 +178,9 @@ void ESM4::Weapon::load(ESM4::Reader& reader)
case ESM4::SUB_WNM6: // FONV
case ESM4::SUB_WNM7: // FONV
case ESM4::SUB_EFSD: // FONV DeadMoney
{
// std::cout << "WEAP " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
Log(Debug::Verbose) << "WEAP " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::WEAP::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -26,8 +26,8 @@
*/
#include "loadwrld.hpp"
#include <components/debug/debuglog.hpp>
#include <stdexcept>
// #include <iostream> // FIXME: debug only
#include "reader.hpp"
// #include "writer.hpp"
@ -146,6 +146,20 @@ void ESM4::World::load(ESM4::Reader& reader)
case ESM4::SUB_PNAM:
reader.get(mParentUseFlags);
break;
case ESM4::SUB_OFST:
if (subSize)
{
reader.skipSubRecordData(subSize); // special post XXXX
reader.updateRecordRead(subSize); // WARNING: manually update
subSize = 0;
}
else
reader.skipSubRecordData(); // FIXME: process the subrecord rather than skip
break;
case ESM4::SUB_XXXX:
reader.get(subSize);
break;
case ESM4::SUB_RNAM: // multiple
case ESM4::SUB_MHDT:
case ESM4::SUB_LTMP:
@ -165,29 +179,9 @@ void ESM4::World::load(ESM4::Reader& reader)
case ESM4::SUB_XNAM: // FO3
case ESM4::SUB_IMPS: // FO3 Anchorage
case ESM4::SUB_IMPF: // FO3 Anchorage
{
// std::cout << "WRLD " << ESM::printName(subHdr.typeId) << " skipping..." << std::endl;
reader.skipSubRecordData(); // FIXME: process the subrecord rather than skip
break;
}
case ESM4::SUB_OFST:
{
if (subSize)
{
reader.skipSubRecordData(subSize); // special post XXXX
reader.updateRecordRead(subSize); // WARNING: manually update
subSize = 0;
}
else
reader.skipSubRecordData(); // FIXME: process the subrecord rather than skip
break;
}
case ESM4::SUB_XXXX:
{
reader.get(subSize);
Log(Debug::Verbose) << "WRLD " << ESM::printName(subHdr.typeId) << " skipping...";
reader.skipSubRecordData();
break;
}
default:
throw std::runtime_error("ESM4::WRLD::load - Unknown subrecord " + ESM::printName(subHdr.typeId));
}

@ -28,11 +28,10 @@
#undef DEBUG_GROUPSTACK
#include <iomanip> // for debugging
#include <iostream> // for debugging
#include <sstream> // for debugging
#include <iomanip>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <unordered_map>
#if defined(_MSC_VER)
#pragma warning(push)
@ -462,7 +461,7 @@ namespace ESM4
else if (i < uncompressedSize - 1)
ss << " ";
}
std::cout << ss.str() << std::endl;
std::cout << ss.str();
}
// #endif
mStream = std::make_unique<Files::StreamWithBuffer<Bsa::MemoryInputStream>>(std::move(memoryStreamPtr));
@ -524,15 +523,14 @@ namespace ESM4
std::string padding; // FIXME: debugging only
padding.insert(0, mCtx.groupStack.size() * 2, ' ');
std::cout << padding << "Starting record group "
<< printLabel(mCtx.recordHeader.group.label, mCtx.recordHeader.group.type) << std::endl;
<< printLabel(mCtx.recordHeader.group.label, mCtx.recordHeader.group.type);
#endif
// empty group if the group size is same as the header size
if (mCtx.recordHeader.group.groupSize == (std::uint32_t)mCtx.recHeaderSize)
{
#ifdef DEBUG_GROUPSTACK
std::cout << padding << "Ignoring record group " // FIXME: debugging only
<< printLabel(mCtx.recordHeader.group.label, mCtx.recordHeader.group.type) << " (empty)"
<< std::endl;
<< printLabel(mCtx.recordHeader.group.label, mCtx.recordHeader.group.type) << " (empty)";
#endif
if (!mCtx.groupStack.empty()) // top group may be empty (e.g. HAIR in Skyrim)
{
@ -573,7 +571,7 @@ namespace ESM4
#ifdef DEBUG_GROUPSTACK
std::string padding; // FIXME: debugging only
padding.insert(0, mCtx.groupStack.size() * 2, ' ');
std::cout << padding << "Finished record group " << printLabel(grp.label, grp.type) << std::endl;
std::cout << padding << "Finished record group " << printLabel(grp.label, grp.type);
#endif
// if the previous group was the final one no need to do below
if (mCtx.groupStack.empty())
@ -588,7 +586,7 @@ namespace ESM4
// #if 0
if (mCtx.groupStack.back().second > lastGroupSize) // FIXME: debugging only
std::cerr << printLabel(mCtx.groupStack.back().first.label, mCtx.groupStack.back().first.type)
<< " read more records than available" << std::endl;
<< " read more records than available";
// #endif
}
}
@ -627,7 +625,7 @@ namespace ESM4
std::string padding; // FIXME: debugging only
padding.insert(0, mCtx.groupStack.size() * 2, ' ');
std::cout << padding << "Skipping record group "
<< printLabel(mCtx.recordHeader.group.label, mCtx.recordHeader.group.type) << std::endl;
<< printLabel(mCtx.recordHeader.group.label, mCtx.recordHeader.group.type);
#endif
// subtract the size of header already read before skipping
std::uint32_t skipSize = mCtx.recordHeader.group.groupSize - (std::uint32_t)mCtx.recHeaderSize;

Loading…
Cancel
Save