mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Rewrite NAME_T into FIXED_STRING.
This commit is contained in:
parent
964ea78367
commit
d5dfa89060
53 changed files with 178 additions and 118 deletions
|
@ -357,10 +357,10 @@ int load(Arguments& info)
|
||||||
EsmTool::RecordBase *record = EsmTool::RecordBase::create(n);
|
EsmTool::RecordBase *record = EsmTool::RecordBase::create(n);
|
||||||
if (record == 0)
|
if (record == 0)
|
||||||
{
|
{
|
||||||
if (std::find(skipped.begin(), skipped.end(), n.val) == skipped.end())
|
if (std::find(skipped.begin(), skipped.end(), n.intval) == skipped.end())
|
||||||
{
|
{
|
||||||
std::cout << "Skipping " << n.toString() << " records." << std::endl;
|
std::cout << "Skipping " << n.toString() << " records." << std::endl;
|
||||||
skipped.push_back(n.val);
|
skipped.push_back(n.intval);
|
||||||
}
|
}
|
||||||
|
|
||||||
esm.skipRecord();
|
esm.skipRecord();
|
||||||
|
@ -392,7 +392,7 @@ int load(Arguments& info)
|
||||||
record->print();
|
record->print();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (record->getType().val == ESM::REC_CELL && loadCells && interested)
|
if (record->getType().intval == ESM::REC_CELL && loadCells && interested)
|
||||||
{
|
{
|
||||||
loadCell(record->cast<ESM::Cell>()->get(), esm, info);
|
loadCell(record->cast<ESM::Cell>()->get(), esm, info);
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ int load(Arguments& info)
|
||||||
{
|
{
|
||||||
delete record;
|
delete record;
|
||||||
}
|
}
|
||||||
++info.data.mRecordStats[n.val];
|
++info.data.mRecordStats[n.intval];
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(std::exception &e) {
|
} catch(std::exception &e) {
|
||||||
|
@ -448,14 +448,13 @@ int clone(Arguments& info)
|
||||||
|
|
||||||
std::cout << "Loaded " << recordCount << " records:" << std::endl << std::endl;
|
std::cout << "Loaded " << recordCount << " records:" << std::endl << std::endl;
|
||||||
|
|
||||||
ESM::NAME name;
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
typedef std::map<int, int> Stats;
|
typedef std::map<int, int> Stats;
|
||||||
Stats &stats = info.data.mRecordStats;
|
Stats &stats = info.data.mRecordStats;
|
||||||
for (Stats::iterator it = stats.begin(); it != stats.end(); ++it)
|
for (Stats::iterator it = stats.begin(); it != stats.end(); ++it)
|
||||||
{
|
{
|
||||||
name.val = it->first;
|
ESM::NAME name;
|
||||||
|
name.intval = it->first;
|
||||||
int amount = it->second;
|
int amount = it->second;
|
||||||
std::cout << std::setw(digitCount) << amount << " " << name.toString() << " ";
|
std::cout << std::setw(digitCount) << amount << " " << name.toString() << " ";
|
||||||
|
|
||||||
|
@ -488,12 +487,12 @@ int clone(Arguments& info)
|
||||||
for (Records::iterator it = records.begin(); it != records.end() && i > 0; ++it)
|
for (Records::iterator it = records.begin(); it != records.end() && i > 0; ++it)
|
||||||
{
|
{
|
||||||
EsmTool::RecordBase *record = *it;
|
EsmTool::RecordBase *record = *it;
|
||||||
name.val = record->getType().val;
|
const ESM::NAME& typeName = record->getType();
|
||||||
|
|
||||||
esm.startRecord(name.toString(), record->getFlags());
|
esm.startRecord(typeName.toString(), record->getFlags());
|
||||||
|
|
||||||
record->save(esm);
|
record->save(esm);
|
||||||
if (name.val == ESM::REC_CELL) {
|
if (typeName.intval == ESM::REC_CELL) {
|
||||||
ESM::Cell *ptr = &record->cast<ESM::Cell>()->get();
|
ESM::Cell *ptr = &record->cast<ESM::Cell>()->get();
|
||||||
if (!info.data.mCellRefs[ptr].empty()) {
|
if (!info.data.mCellRefs[ptr].empty()) {
|
||||||
typedef std::deque<std::pair<ESM::CellRef, bool> > RefList;
|
typedef std::deque<std::pair<ESM::CellRef, bool> > RefList;
|
||||||
|
@ -505,7 +504,7 @@ int clone(Arguments& info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
esm.endRecord(name.toString());
|
esm.endRecord(typeName.toString());
|
||||||
|
|
||||||
saved++;
|
saved++;
|
||||||
int perc = (int)((saved / (float)recordCount)*100);
|
int perc = (int)((saved / (float)recordCount)*100);
|
||||||
|
|
|
@ -179,7 +179,7 @@ RecordBase::create(ESM::NAME type)
|
||||||
{
|
{
|
||||||
RecordBase *record = 0;
|
RecordBase *record = 0;
|
||||||
|
|
||||||
switch (type.val) {
|
switch (type.intval) {
|
||||||
case ESM::REC_ACTI:
|
case ESM::REC_ACTI:
|
||||||
{
|
{
|
||||||
record = new EsmTool::Record<ESM::Activator>;
|
record = new EsmTool::Record<ESM::Activator>;
|
||||||
|
|
|
@ -322,14 +322,14 @@ namespace ESSImport
|
||||||
ESM::NAME n = esm.getRecName();
|
ESM::NAME n = esm.getRecName();
|
||||||
esm.getRecHeader();
|
esm.getRecHeader();
|
||||||
|
|
||||||
std::map<unsigned int, boost::shared_ptr<Converter> >::iterator it = converters.find(n.val);
|
std::map<unsigned int, boost::shared_ptr<Converter> >::iterator it = converters.find(n.intval);
|
||||||
if (it != converters.end())
|
if (it != converters.end())
|
||||||
{
|
{
|
||||||
it->second->read(esm);
|
it->second->read(esm);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (unknownRecords.insert(n.val).second)
|
if (unknownRecords.insert(n.intval).second)
|
||||||
{
|
{
|
||||||
std::ios::fmtflags f(std::cerr.flags());
|
std::ios::fmtflags f(std::cerr.flags());
|
||||||
std::cerr << "unknown record " << n.toString() << " (0x" << std::hex << esm.getFileOffset() << ")" << std::endl;
|
std::cerr << "unknown record " << n.toString() << " (0x" << std::hex << esm.getFileOffset() << ")" << std::endl;
|
||||||
|
|
|
@ -942,7 +942,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages)
|
||||||
|
|
||||||
bool unhandledRecord = false;
|
bool unhandledRecord = false;
|
||||||
|
|
||||||
switch (n.val)
|
switch (n.intval)
|
||||||
{
|
{
|
||||||
case ESM::REC_GLOB: mGlobals.load (*mReader, mBase); break;
|
case ESM::REC_GLOB: mGlobals.load (*mReader, mBase); break;
|
||||||
case ESM::REC_GMST: mGmsts.load (*mReader, mBase); break;
|
case ESM::REC_GMST: mGmsts.load (*mReader, mBase); break;
|
||||||
|
|
|
@ -1187,7 +1187,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
std::vector<ESM::ContItem>& list = container.mInventory.mList;
|
std::vector<ESM::ContItem>& list = container.mInventory.mList;
|
||||||
|
|
||||||
ESM::ContItem newRow = {0, {""}};
|
ESM::ContItem newRow = ESM::ContItem();
|
||||||
|
|
||||||
if (position >= (int)list.size())
|
if (position >= (int)list.size())
|
||||||
list.push_back(newRow);
|
list.push_back(newRow);
|
||||||
|
|
|
@ -385,7 +385,7 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
||||||
ESM::NAME n = reader.getRecName();
|
ESM::NAME n = reader.getRecName();
|
||||||
reader.getRecHeader();
|
reader.getRecHeader();
|
||||||
|
|
||||||
switch (n.val)
|
switch (n.intval)
|
||||||
{
|
{
|
||||||
case ESM::REC_SAVE:
|
case ESM::REC_SAVE:
|
||||||
{
|
{
|
||||||
|
@ -405,12 +405,12 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
||||||
case ESM::REC_JOUR_LEGACY:
|
case ESM::REC_JOUR_LEGACY:
|
||||||
case ESM::REC_QUES:
|
case ESM::REC_QUES:
|
||||||
|
|
||||||
MWBase::Environment::get().getJournal()->readRecord (reader, n.val);
|
MWBase::Environment::get().getJournal()->readRecord (reader, n.intval);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESM::REC_DIAS:
|
case ESM::REC_DIAS:
|
||||||
|
|
||||||
MWBase::Environment::get().getDialogueManager()->readRecord (reader, n.val);
|
MWBase::Environment::get().getDialogueManager()->readRecord (reader, n.intval);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESM::REC_ALCH:
|
case ESM::REC_ALCH:
|
||||||
|
@ -433,7 +433,7 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
||||||
case ESM::REC_ENAB:
|
case ESM::REC_ENAB:
|
||||||
case ESM::REC_LEVC:
|
case ESM::REC_LEVC:
|
||||||
case ESM::REC_LEVI:
|
case ESM::REC_LEVI:
|
||||||
MWBase::Environment::get().getWorld()->readRecord(reader, n.val, contentFileMap);
|
MWBase::Environment::get().getWorld()->readRecord(reader, n.intval, contentFileMap);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESM::REC_CAM_:
|
case ESM::REC_CAM_:
|
||||||
|
@ -442,7 +442,7 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
||||||
|
|
||||||
case ESM::REC_GSCR:
|
case ESM::REC_GSCR:
|
||||||
|
|
||||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().readRecord (reader, n.val);
|
MWBase::Environment::get().getScriptManager()->getGlobalScripts().readRecord (reader, n.intval);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESM::REC_GMAP:
|
case ESM::REC_GMAP:
|
||||||
|
@ -450,13 +450,13 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
||||||
case ESM::REC_ASPL:
|
case ESM::REC_ASPL:
|
||||||
case ESM::REC_MARK:
|
case ESM::REC_MARK:
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->readRecord(reader, n.val);
|
MWBase::Environment::get().getWindowManager()->readRecord(reader, n.intval);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESM::REC_DCOU:
|
case ESM::REC_DCOU:
|
||||||
case ESM::REC_STLN:
|
case ESM::REC_STLN:
|
||||||
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->readRecord(reader, n.val);
|
MWBase::Environment::get().getMechanicsManager()->readRecord(reader, n.intval);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -74,10 +74,10 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
|
||||||
esm.getRecHeader();
|
esm.getRecHeader();
|
||||||
|
|
||||||
// Look up the record type.
|
// Look up the record type.
|
||||||
std::map<int, StoreBase *>::iterator it = mStores.find(n.val);
|
std::map<int, StoreBase *>::iterator it = mStores.find(n.intval);
|
||||||
|
|
||||||
if (it == mStores.end()) {
|
if (it == mStores.end()) {
|
||||||
if (n.val == ESM::REC_INFO) {
|
if (n.intval == ESM::REC_INFO) {
|
||||||
if (dialogue)
|
if (dialogue)
|
||||||
{
|
{
|
||||||
dialogue->readInfo(esm, esm.getIndex() != 0);
|
dialogue->readInfo(esm, esm.getIndex() != 0);
|
||||||
|
@ -87,12 +87,12 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
|
||||||
std::cerr << "error: info record without dialog" << std::endl;
|
std::cerr << "error: info record without dialog" << std::endl;
|
||||||
esm.skipRecord();
|
esm.skipRecord();
|
||||||
}
|
}
|
||||||
} else if (n.val == ESM::REC_MGEF) {
|
} else if (n.intval == ESM::REC_MGEF) {
|
||||||
mMagicEffects.load (esm);
|
mMagicEffects.load (esm);
|
||||||
} else if (n.val == ESM::REC_SKIL) {
|
} else if (n.intval == ESM::REC_SKIL) {
|
||||||
mSkills.load (esm);
|
mSkills.load (esm);
|
||||||
}
|
}
|
||||||
else if (n.val==ESM::REC_FILT || n.val == ESM::REC_DBGP)
|
else if (n.intval==ESM::REC_FILT || n.intval == ESM::REC_DBGP)
|
||||||
{
|
{
|
||||||
// ignore project file only records
|
// ignore project file only records
|
||||||
esm.skipRecord();
|
esm.skipRecord();
|
||||||
|
@ -110,7 +110,7 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n.val==ESM::REC_DIAL) {
|
if (n.intval==ESM::REC_DIAL) {
|
||||||
dialogue = const_cast<ESM::Dialogue*>(mDialogs.find(id.mId));
|
dialogue = const_cast<ESM::Dialogue*>(mDialogs.find(id.mId));
|
||||||
} else {
|
} else {
|
||||||
dialogue = 0;
|
dialogue = 0;
|
||||||
|
|
|
@ -62,7 +62,7 @@ void ESM::CellRef::loadData(ESMReader &esm, bool &isDeleted)
|
||||||
while (!isLoaded && esm.hasMoreSubs())
|
while (!isLoaded && esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::FourCC<'U','N','A','M'>::value:
|
case ESM::FourCC<'U','N','A','M'>::value:
|
||||||
esm.getHT(mReferenceBlocked);
|
esm.getHT(mReferenceBlocked);
|
||||||
|
|
|
@ -13,7 +13,7 @@ void ESM::DebugProfile::load (ESMReader& esm, bool &isDeleted)
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -15,43 +15,98 @@ enum Version
|
||||||
VER_13 = 0x3fa66666
|
VER_13 = 0x3fa66666
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A structure used for holding fixed-length strings. In the case of
|
|
||||||
LEN=4, it can be more efficient to match the string as a 32 bit
|
// CRTP for FIXED_STRING class, a structure used for holding fixed-length strings
|
||||||
number, therefore the struct is implemented as a union with an int.
|
template< template<size_t> class DERIVED, size_t SIZE>
|
||||||
*/
|
class FIXED_STRING_BASE
|
||||||
template <int LEN>
|
|
||||||
union NAME_T
|
|
||||||
{
|
{
|
||||||
char name[LEN];
|
/* The following methods must be implemented in derived classes:
|
||||||
uint32_t val;
|
* char const* ro_data() const; // return pointer to ro buffer
|
||||||
|
* char* rw_data(); // return pointer to rw buffer
|
||||||
|
*/
|
||||||
|
public:
|
||||||
|
enum { size = SIZE };
|
||||||
|
|
||||||
bool operator==(const char *str) const
|
template<size_t OTHER_SIZE>
|
||||||
{
|
bool operator==(char const (&str)[OTHER_SIZE]) const
|
||||||
for(int i=0; i<LEN; i++)
|
{
|
||||||
if(name[i] != str[i]) return false;
|
size_t other_len = strnlen(str, OTHER_SIZE);
|
||||||
else if(name[i] == 0) return true;
|
if (other_len != this->length())
|
||||||
return str[LEN] == 0;
|
return false;
|
||||||
}
|
return std::strncmp(self()->ro_data(), str, size) == 0;
|
||||||
bool operator!=(const char *str) const { return !((*this)==str); }
|
}
|
||||||
|
bool operator==(const char* const str) const
|
||||||
|
{
|
||||||
|
char const* const data = self()->ro_data();
|
||||||
|
for(size_t i = 0; i < size; ++i)
|
||||||
|
{
|
||||||
|
if(data[i] != str[i]) return false;
|
||||||
|
else if(data[i] == '\0') return true;
|
||||||
|
}
|
||||||
|
return str[size] == '\0';
|
||||||
|
}
|
||||||
|
bool operator!=(const char* const str) const { return !( (*this) == str ); }
|
||||||
|
|
||||||
bool operator==(const std::string &str) const
|
bool operator==(const std::string& str) const
|
||||||
{
|
{
|
||||||
return (*this) == str.c_str();
|
return (*this) == str.c_str();
|
||||||
}
|
}
|
||||||
bool operator!=(const std::string &str) const { return !((*this)==str); }
|
bool operator!=(const std::string& str) const { return !( (*this) == str ); }
|
||||||
|
|
||||||
bool operator==(uint32_t v) const { return v == val; }
|
size_t data_size() const { return size; }
|
||||||
bool operator!=(uint32_t v) const { return v != val; }
|
size_t length() const { return strnlen(self()->ro_data(), size); }
|
||||||
|
std::string toString() const { return std::string(self()->ro_data(), this->length()); }
|
||||||
|
|
||||||
std::string toString() const { return std::string(name, strnlen(name, LEN)); }
|
void assign(const std::string& value) { std::strncpy(self()->rw_data(), value.c_str(), size); }
|
||||||
|
void clear() { this->assign(""); }
|
||||||
|
private:
|
||||||
|
DERIVED<size> const* self() const
|
||||||
|
{
|
||||||
|
return static_cast<DERIVED<size> const*>(this);
|
||||||
|
}
|
||||||
|
|
||||||
void assign (const std::string& value) { std::strncpy (name, value.c_str(), LEN); }
|
// write the non-const version in terms of the const version
|
||||||
|
// Effective C++ 3rd ed., Item 3 (p. 24-25)
|
||||||
|
DERIVED<size>* self()
|
||||||
|
{
|
||||||
|
return const_cast<DERIVED<size>*>(static_cast<FIXED_STRING_BASE const*>(this)->self());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef NAME_T<4> NAME;
|
// Generic implementation
|
||||||
typedef NAME_T<32> NAME32;
|
template <size_t SIZE>
|
||||||
typedef NAME_T<64> NAME64;
|
struct FIXED_STRING : public FIXED_STRING_BASE<FIXED_STRING, SIZE>
|
||||||
typedef NAME_T<256> NAME256;
|
{
|
||||||
|
char data[SIZE];
|
||||||
|
|
||||||
|
char const* ro_data() const { return data; }
|
||||||
|
char* rw_data() { return data; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// In the case of SIZE=4, it can be more efficient to match the string
|
||||||
|
// as a 32 bit number, therefore the struct is implemented as a union with an int.
|
||||||
|
template <>
|
||||||
|
struct FIXED_STRING<4> : public FIXED_STRING_BASE<FIXED_STRING, 4>
|
||||||
|
{
|
||||||
|
union {
|
||||||
|
char data[4];
|
||||||
|
uint32_t intval;
|
||||||
|
};
|
||||||
|
|
||||||
|
using FIXED_STRING_BASE::operator==;
|
||||||
|
using FIXED_STRING_BASE::operator!=;
|
||||||
|
|
||||||
|
bool operator==(uint32_t v) const { return v == intval; }
|
||||||
|
bool operator!=(uint32_t v) const { return v != intval; }
|
||||||
|
|
||||||
|
char const* ro_data() const { return data; }
|
||||||
|
char* rw_data() { return data; }
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef FIXED_STRING<4> NAME;
|
||||||
|
typedef FIXED_STRING<32> NAME32;
|
||||||
|
typedef FIXED_STRING<64> NAME64;
|
||||||
|
typedef FIXED_STRING<256> NAME256;
|
||||||
|
|
||||||
/* This struct defines a file 'context' which can be saved and later
|
/* This struct defines a file 'context' which can be saved and later
|
||||||
restored by an ESMReader instance. It will save the position within
|
restored by an ESMReader instance. It will save the position within
|
||||||
|
|
|
@ -55,8 +55,8 @@ void ESMReader::close()
|
||||||
mCtx.leftRec = 0;
|
mCtx.leftRec = 0;
|
||||||
mCtx.leftSub = 0;
|
mCtx.leftSub = 0;
|
||||||
mCtx.subCached = false;
|
mCtx.subCached = false;
|
||||||
mCtx.recName.val = 0;
|
mCtx.recName.clear();
|
||||||
mCtx.subName.val = 0;
|
mCtx.subName.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESMReader::openRaw(Files::IStreamPtr _esm, const std::string& name)
|
void ESMReader::openRaw(Files::IStreamPtr _esm, const std::string& name)
|
||||||
|
@ -204,16 +204,18 @@ void ESMReader::getSubName()
|
||||||
}
|
}
|
||||||
|
|
||||||
// reading the subrecord data anyway.
|
// reading the subrecord data anyway.
|
||||||
getExact(mCtx.subName.name, 4);
|
const size_t subNameSize = mCtx.subName.data_size();
|
||||||
mCtx.leftRec -= 4;
|
getExact(mCtx.subName.rw_data(), subNameSize);
|
||||||
|
mCtx.leftRec -= subNameSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ESMReader::isEmptyOrGetName()
|
bool ESMReader::isEmptyOrGetName()
|
||||||
{
|
{
|
||||||
if (mCtx.leftRec)
|
if (mCtx.leftRec)
|
||||||
{
|
{
|
||||||
getExact(mCtx.subName.name, 4);
|
const size_t subNameSize = mCtx.subName.data_size();
|
||||||
mCtx.leftRec -= 4;
|
getExact(mCtx.subName.rw_data(), subNameSize);
|
||||||
|
mCtx.leftRec -= subNameSize;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -267,7 +269,7 @@ NAME ESMReader::getRecName()
|
||||||
if (!hasMoreRecs())
|
if (!hasMoreRecs())
|
||||||
fail("No more records, getRecName() failed");
|
fail("No more records, getRecName() failed");
|
||||||
getName(mCtx.recName);
|
getName(mCtx.recName);
|
||||||
mCtx.leftFile -= 4;
|
mCtx.leftFile -= mCtx.recName.data_size();
|
||||||
|
|
||||||
// Make sure we don't carry over any old cached subrecord
|
// Make sure we don't carry over any old cached subrecord
|
||||||
// names. This can happen in some cases when we skip parts of a
|
// names. This can happen in some cases when we skip parts of a
|
||||||
|
|
|
@ -13,7 +13,7 @@ void ESM::Filter::load (ESMReader& esm, bool &isDeleted)
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
uint32_t name = esm.retSubName().val;
|
uint32_t name = esm.retSubName().intval;
|
||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace ESM
|
||||||
while (!isLoaded && esm.hasMoreSubs())
|
while (!isLoaded && esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mName = esm.getHString();
|
mName = esm.getHString();
|
||||||
|
@ -114,7 +114,7 @@ namespace ESM
|
||||||
while (!isLoaded && esm.hasMoreSubs())
|
while (!isLoaded && esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::FourCC<'I','N','T','V'>::value:
|
case ESM::FourCC<'I','N','T','V'>::value:
|
||||||
int waterl;
|
int waterl;
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace ESM {
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::FourCC<'D','A','T','A'>::value:
|
case ESM::FourCC<'D','A','T','A'>::value:
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::FourCC<'D','A','T','A'>::value:
|
case ESM::FourCC<'D','A','T','A'>::value:
|
||||||
esm.getHT(mData, 12);
|
esm.getHT(mData, 12);
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace ESM
|
||||||
while (!isLoaded && esm.hasMoreSubs())
|
while (!isLoaded && esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::FourCC<'I','N','T','V'>::value:
|
case ESM::FourCC<'I','N','T','V'>::value:
|
||||||
esm.getSubHeaderIs(8);
|
esm.getSubHeaderIs(8);
|
||||||
|
@ -125,7 +125,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::FourCC<'V','N','M','L'>::value:
|
case ESM::FourCC<'V','N','M','L'>::value:
|
||||||
esm.skipHSub();
|
esm.skipHSub();
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -211,7 +211,7 @@ void MagicEffect::load(ESMReader &esm, bool &isDeleted)
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::FourCC<'I','T','E','X'>::value:
|
case ESM::FourCC<'I','T','E','X'>::value:
|
||||||
mIcon = esm.getHString();
|
mIcon = esm.getHString();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mCell = esm.getHString();
|
mCell = esm.getHString();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
@ -61,10 +61,12 @@ namespace ESM
|
||||||
esm.getHT(mMapColor);
|
esm.getHT(mMapColor);
|
||||||
break;
|
break;
|
||||||
case ESM::FourCC<'S','N','A','M'>::value:
|
case ESM::FourCC<'S','N','A','M'>::value:
|
||||||
|
{
|
||||||
SoundRef sr;
|
SoundRef sr;
|
||||||
esm.getHT(sr, 33);
|
esm.getHT(sr, 33);
|
||||||
mSoundList.push_back(sr);
|
mSoundList.push_back(sr);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ESM::SREC_DELE:
|
case ESM::SREC_DELE:
|
||||||
esm.skipHSub();
|
esm.skipHSub();
|
||||||
isDeleted = true;
|
isDeleted = true;
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -67,15 +67,17 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::FourCC<'S','C','H','D'>::value:
|
case ESM::FourCC<'S','C','H','D'>::value:
|
||||||
|
{
|
||||||
SCHD data;
|
SCHD data;
|
||||||
esm.getHT(data, 52);
|
esm.getHT(data, 52);
|
||||||
mData = data.mData;
|
mData = data.mData;
|
||||||
mId = data.mName.toString();
|
mId = data.mName.toString();
|
||||||
hasHeader = true;
|
hasHeader = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ESM::FourCC<'S','C','V','R'>::value:
|
case ESM::FourCC<'S','C','V','R'>::value:
|
||||||
// list of local variables
|
// list of local variables
|
||||||
loadSCVR(esm);
|
loadSCVR(esm);
|
||||||
|
@ -113,7 +115,7 @@ namespace ESM
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
|
|
||||||
data.mData = mData;
|
data.mData = mData;
|
||||||
memcpy(data.mName.name, mId.c_str(), mId.size());
|
data.mName.assign(mId);
|
||||||
|
|
||||||
esm.writeHNT("SCHD", data, 52);
|
esm.writeHNT("SCHD", data, 52);
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::FourCC<'I','N','D','X'>::value:
|
case ESM::FourCC<'I','N','D','X'>::value:
|
||||||
esm.getHT(mIndex);
|
esm.getHT(mIndex);
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -9,8 +9,8 @@ void ESM::Header::blank()
|
||||||
{
|
{
|
||||||
mData.version = ESM::VER_13;
|
mData.version = ESM::VER_13;
|
||||||
mData.type = 0;
|
mData.type = 0;
|
||||||
mData.author.assign ("");
|
mData.author.clear();
|
||||||
mData.desc.assign ("");
|
mData.desc.clear();
|
||||||
mData.records = 0;
|
mData.records = 0;
|
||||||
mFormat = CurrentFormat;
|
mFormat = CurrentFormat;
|
||||||
mMaster.clear();
|
mMaster.clear();
|
||||||
|
@ -32,8 +32,8 @@ void ESM::Header::load (ESMReader &esm)
|
||||||
esm.getSubHeader();
|
esm.getSubHeader();
|
||||||
esm.getT(mData.version);
|
esm.getT(mData.version);
|
||||||
esm.getT(mData.type);
|
esm.getT(mData.type);
|
||||||
mData.author.assign(esm.getString(sizeof(mData.author.name)));
|
mData.author.assign( esm.getString(mData.author.data_size()) );
|
||||||
mData.desc.assign(esm.getString(sizeof(mData.desc.name)));
|
mData.desc.assign( esm.getString(mData.desc.data_size()) );
|
||||||
esm.getT(mData.records);
|
esm.getT(mData.records);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ void ESM::Header::save (ESMWriter &esm)
|
||||||
esm.startSubRecord("HEDR");
|
esm.startSubRecord("HEDR");
|
||||||
esm.writeT(mData.version);
|
esm.writeT(mData.version);
|
||||||
esm.writeT(mData.type);
|
esm.writeT(mData.type);
|
||||||
esm.writeFixedSizeString(mData.author.toString(), 32);
|
esm.writeFixedSizeString(mData.author.toString(), mData.author.data_size());
|
||||||
esm.writeFixedSizeString(mData.desc.toString(), 256);
|
esm.writeFixedSizeString(mData.desc.toString(), mData.desc.data_size());
|
||||||
esm.writeT(mData.records);
|
esm.writeT(mData.records);
|
||||||
esm.endRecord("HEDR");
|
esm.endRecord("HEDR");
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace ESM
|
||||||
while (esm.hasMoreSubs())
|
while (esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
switch (esm.retSubName().val)
|
switch (esm.retSubName().intval)
|
||||||
{
|
{
|
||||||
case ESM::SREC_NAME:
|
case ESM::SREC_NAME:
|
||||||
mId = esm.getHString();
|
mId = esm.getHString();
|
||||||
|
|
|
@ -8,13 +8,13 @@ namespace ESM
|
||||||
|
|
||||||
void Transport::add(ESMReader &esm)
|
void Transport::add(ESMReader &esm)
|
||||||
{
|
{
|
||||||
if (esm.retSubName().val == ESM::FourCC<'D','O','D','T'>::value)
|
if (esm.retSubName().intval == ESM::FourCC<'D','O','D','T'>::value)
|
||||||
{
|
{
|
||||||
Dest dodt;
|
Dest dodt;
|
||||||
esm.getHExact(&dodt.mPos, 24);
|
esm.getHExact(&dodt.mPos, 24);
|
||||||
mList.push_back(dodt);
|
mList.push_back(dodt);
|
||||||
}
|
}
|
||||||
else if (esm.retSubName().val == ESM::FourCC<'D','N','A','M'>::value)
|
else if (esm.retSubName().intval == ESM::FourCC<'D','N','A','M'>::value)
|
||||||
{
|
{
|
||||||
mList.back().mCellName = esm.getHString();
|
mList.back().mCellName = esm.getHString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue