mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:59:54 +00:00
Replace more explicitly sized reads and variable width integers
This commit is contained in:
parent
11ae1a1fcb
commit
62f47acf6b
30 changed files with 86 additions and 63 deletions
|
@ -232,7 +232,7 @@ namespace MWScript
|
||||||
|
|
||||||
desc->mLocals.write(script.mLocals, id);
|
desc->mLocals.write(script.mLocals, id);
|
||||||
|
|
||||||
script.mRunning = desc->mRunning ? 1 : 0;
|
script.mRunning = desc->mRunning;
|
||||||
|
|
||||||
writer.startRecord(ESM::REC_GSCR);
|
writer.startRecord(ESM::REC_GSCR);
|
||||||
script.save(writer);
|
script.save(writer);
|
||||||
|
@ -276,7 +276,7 @@ namespace MWScript
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
iter->second->mRunning = script.mRunning != 0;
|
iter->second->mRunning = script.mRunning;
|
||||||
iter->second->mLocals.read(script.mLocals, script.mId);
|
iter->second->mLocals.read(script.mLocals, script.mId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace ESM
|
||||||
void EffectList::add(ESMReader& esm)
|
void EffectList::add(ESMReader& esm)
|
||||||
{
|
{
|
||||||
ENAMstruct s;
|
ENAMstruct s;
|
||||||
esm.getHTSized<24>(s);
|
esm.getHT(s.mEffectID, s.mSkill, s.mAttribute, s.mRange, s.mArea, s.mDuration, s.mMagnMin, s.mMagnMax);
|
||||||
mList.push_back(s);
|
mList.push_back(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_ESM_EFFECTLIST_H
|
#ifndef OPENMW_ESM_EFFECTLIST_H
|
||||||
#define OPENMW_ESM_EFFECTLIST_H
|
#define OPENMW_ESM_EFFECTLIST_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
|
@ -17,15 +18,15 @@ namespace ESM
|
||||||
struct ENAMstruct
|
struct ENAMstruct
|
||||||
{
|
{
|
||||||
// Magical effect, hard-coded ID
|
// Magical effect, hard-coded ID
|
||||||
short mEffectID;
|
int16_t mEffectID;
|
||||||
|
|
||||||
// Which skills/attributes are affected (for restore/drain spells
|
// Which skills/attributes are affected (for restore/drain spells
|
||||||
// etc.)
|
// etc.)
|
||||||
signed char mSkill, mAttribute; // -1 if N/A
|
signed char mSkill, mAttribute; // -1 if N/A
|
||||||
|
|
||||||
// Other spell parameters
|
// Other spell parameters
|
||||||
int mRange; // 0 - self, 1 - touch, 2 - target (RangeType enum)
|
int32_t mRange; // 0 - self, 1 - touch, 2 - target (RangeType enum)
|
||||||
int mArea, mDuration, mMagnMin, mMagnMax;
|
int32_t mArea, mDuration, mMagnMin, mMagnMax;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
|
@ -362,7 +362,7 @@ namespace ESM
|
||||||
void setEncoder(ToUTF8::Utf8Encoder* encoder) { mEncoder = encoder; }
|
void setEncoder(ToUTF8::Utf8Encoder* encoder) { mEncoder = encoder; }
|
||||||
|
|
||||||
/// Get record flags of last record
|
/// Get record flags of last record
|
||||||
unsigned int getRecordFlags() { return mRecordFlags; }
|
uint32_t getRecordFlags() { return mRecordFlags; }
|
||||||
|
|
||||||
size_t getFileSize() const { return mFileSize; }
|
size_t getFileSize() const { return mFileSize; }
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ namespace ESM
|
||||||
|
|
||||||
ESM_Context mCtx;
|
ESM_Context mCtx;
|
||||||
|
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
|
|
||||||
// Special file signifier (see SpecialFile enum above)
|
// Special file signifier (see SpecialFile enum above)
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,8 @@ namespace ESM
|
||||||
|
|
||||||
void FogState::load(ESMReader& esm)
|
void FogState::load(ESMReader& esm)
|
||||||
{
|
{
|
||||||
esm.getHNOTSized<16>(mBounds, "BOUN");
|
if (esm.isNextSub("BOUN"))
|
||||||
|
esm.getHT(mBounds.mMinX, mBounds.mMinY, mBounds.mMaxX, mBounds.mMaxY);
|
||||||
esm.getHNOT(mNorthMarkerAngle, "ANGL");
|
esm.getHNOT(mNorthMarkerAngle, "ANGL");
|
||||||
const FormatVersion dataFormat = esm.getFormatVersion();
|
const FormatVersion dataFormat = esm.getFormatVersion();
|
||||||
while (esm.isNextSub("FTEX"))
|
while (esm.isNextSub("FTEX"))
|
||||||
|
@ -69,7 +70,7 @@ namespace ESM
|
||||||
esm.getT(tex.mX);
|
esm.getT(tex.mX);
|
||||||
esm.getT(tex.mY);
|
esm.getT(tex.mY);
|
||||||
|
|
||||||
const std::size_t imageSize = esm.getSubSize() - sizeof(int) * 2;
|
const std::size_t imageSize = esm.getSubSize() - sizeof(int32_t) * 2;
|
||||||
tex.mImageData.resize(imageSize);
|
tex.mImageData.resize(imageSize);
|
||||||
esm.getExact(tex.mImageData.data(), imageSize);
|
esm.getExact(tex.mImageData.data(), imageSize);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_ESM_FOGSTATE_H
|
#ifndef OPENMW_ESM_FOGSTATE_H
|
||||||
#define OPENMW_ESM_FOGSTATE_H
|
#define OPENMW_ESM_FOGSTATE_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
|
@ -10,7 +11,7 @@ namespace ESM
|
||||||
|
|
||||||
struct FogTexture
|
struct FogTexture
|
||||||
{
|
{
|
||||||
int mX, mY; // Only used for interior cells
|
int32_t mX, mY; // Only used for interior cells
|
||||||
std::vector<char> mImageData;
|
std::vector<char> mImageData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace ESM
|
||||||
|
|
||||||
void GlobalMap::load(ESMReader& esm)
|
void GlobalMap::load(ESMReader& esm)
|
||||||
{
|
{
|
||||||
esm.getHNTSized<16>(mBounds, "BNDS");
|
esm.getHNT("BNDS", mBounds.mMinX, mBounds.mMaxX, mBounds.mMinY, mBounds.mMaxY);
|
||||||
|
|
||||||
esm.getSubNameIs("DATA");
|
esm.getSubNameIs("DATA");
|
||||||
esm.getSubHeader();
|
esm.getSubHeader();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_COMPONENTS_ESM_GLOBALMAP_H
|
#ifndef OPENMW_COMPONENTS_ESM_GLOBALMAP_H
|
||||||
#define OPENMW_COMPONENTS_ESM_GLOBALMAP_H
|
#define OPENMW_COMPONENTS_ESM_GLOBALMAP_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ namespace ESM
|
||||||
// The minimum and maximum cell coordinates
|
// The minimum and maximum cell coordinates
|
||||||
struct Bounds
|
struct Bounds
|
||||||
{
|
{
|
||||||
int mMinX, mMaxX, mMinY, mMaxY;
|
int32_t mMinX, mMaxX, mMinY, mMaxY;
|
||||||
};
|
};
|
||||||
|
|
||||||
Bounds mBounds;
|
Bounds mBounds;
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include "esmreader.hpp"
|
#include "esmreader.hpp"
|
||||||
#include "esmwriter.hpp"
|
#include "esmwriter.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -12,8 +14,9 @@ namespace ESM
|
||||||
|
|
||||||
mLocals.load(esm);
|
mLocals.load(esm);
|
||||||
|
|
||||||
mRunning = 0;
|
int32_t running = 0;
|
||||||
esm.getHNOT(mRunning, "RUN_");
|
esm.getHNOT(running, "RUN_");
|
||||||
|
mRunning = running != 0;
|
||||||
|
|
||||||
mTargetRef = RefNum{};
|
mTargetRef = RefNum{};
|
||||||
mTargetId = esm.getHNORefId("TARG");
|
mTargetId = esm.getHNORefId("TARG");
|
||||||
|
@ -33,7 +36,7 @@ namespace ESM
|
||||||
mLocals.save(esm);
|
mLocals.save(esm);
|
||||||
|
|
||||||
if (mRunning)
|
if (mRunning)
|
||||||
esm.writeHNT("RUN_", mRunning);
|
esm.writeHNT("RUN_", int32_t{ 1 });
|
||||||
|
|
||||||
if (!mTargetId.empty())
|
if (!mTargetId.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace ESM
|
||||||
{
|
{
|
||||||
RefId mId; /// \note must be lowercase
|
RefId mId; /// \note must be lowercase
|
||||||
Locals mLocals;
|
Locals mLocals;
|
||||||
int mRunning;
|
bool mRunning;
|
||||||
RefId mTargetId; // for targeted scripts
|
RefId mTargetId; // for targeted scripts
|
||||||
RefNum mTargetRef;
|
RefNum mTargetRef;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define OPENMW_ESM_JOURNALENTRY_H
|
#define OPENMW_ESM_JOURNALENTRY_H
|
||||||
|
|
||||||
#include <components/esm/refid.hpp>
|
#include <components/esm/refid.hpp>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
|
@ -20,15 +22,15 @@ namespace ESM
|
||||||
Type_Quest = 2
|
Type_Quest = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
int mType;
|
int32_t mType;
|
||||||
ESM::RefId mTopic;
|
ESM::RefId mTopic;
|
||||||
ESM::RefId mInfo;
|
ESM::RefId mInfo;
|
||||||
std::string mText;
|
std::string mText;
|
||||||
std::string mActorName; // Could also be Actor ID to allow switching of localisation, but since mText is
|
std::string mActorName; // Could also be Actor ID to allow switching of localisation, but since mText is
|
||||||
// plaintext anyway...
|
// plaintext anyway...
|
||||||
int mDay; // time stamp
|
int32_t mDay; // time stamp
|
||||||
int mMonth;
|
int32_t mMonth;
|
||||||
int mDayOfMonth;
|
int32_t mDayOfMonth;
|
||||||
|
|
||||||
void load(ESMReader& esm);
|
void load(ESMReader& esm);
|
||||||
void save(ESMWriter& esm) const;
|
void save(ESMWriter& esm) const;
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "components/esm/defs.hpp"
|
#include "components/esm/defs.hpp"
|
||||||
#include "components/esm/refid.hpp"
|
#include "components/esm/refid.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
|
@ -18,7 +20,7 @@ namespace ESM
|
||||||
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
||||||
static std::string_view getRecordType() { return "Activator"; }
|
static std::string_view getRecordType() { return "Activator"; }
|
||||||
|
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
RefId mId, mScript;
|
RefId mId, mScript;
|
||||||
std::string mName, mModel;
|
std::string mName, mModel;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace ESM
|
||||||
mName = esm.getHString();
|
mName = esm.getHString();
|
||||||
break;
|
break;
|
||||||
case fourCC("ALDT"):
|
case fourCC("ALDT"):
|
||||||
esm.getHTSized<12>(mData);
|
esm.getHT(mData.mWeight, mData.mValue, mData.mAutoCalc);
|
||||||
hasData = true;
|
hasData = true;
|
||||||
break;
|
break;
|
||||||
case fourCC("ENAM"):
|
case fourCC("ENAM"):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_ESM_ALCH_H
|
#ifndef OPENMW_ESM_ALCH_H
|
||||||
#define OPENMW_ESM_ALCH_H
|
#define OPENMW_ESM_ALCH_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "components/esm/defs.hpp"
|
#include "components/esm/defs.hpp"
|
||||||
|
@ -27,12 +28,12 @@ namespace ESM
|
||||||
struct ALDTstruct
|
struct ALDTstruct
|
||||||
{
|
{
|
||||||
float mWeight;
|
float mWeight;
|
||||||
int mValue;
|
int32_t mValue;
|
||||||
int mAutoCalc;
|
int32_t mAutoCalc;
|
||||||
};
|
};
|
||||||
ALDTstruct mData;
|
ALDTstruct mData;
|
||||||
|
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
RefId mId, mScript;
|
RefId mId, mScript;
|
||||||
std::string mName, mModel, mIcon;
|
std::string mName, mModel, mIcon;
|
||||||
EffectList mEffects;
|
EffectList mEffects;
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace ESM
|
||||||
mName = esm.getHString();
|
mName = esm.getHString();
|
||||||
break;
|
break;
|
||||||
case fourCC("AADT"):
|
case fourCC("AADT"):
|
||||||
esm.getHTSized<16>(mData);
|
esm.getHT(mData.mType, mData.mQuality, mData.mWeight, mData.mValue);
|
||||||
hasData = true;
|
hasData = true;
|
||||||
break;
|
break;
|
||||||
case fourCC("SCRI"):
|
case fourCC("SCRI"):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_ESM_APPA_H
|
#ifndef OPENMW_ESM_APPA_H
|
||||||
#define OPENMW_ESM_APPA_H
|
#define OPENMW_ESM_APPA_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "components/esm/defs.hpp"
|
#include "components/esm/defs.hpp"
|
||||||
|
@ -33,14 +34,14 @@ namespace ESM
|
||||||
|
|
||||||
struct AADTstruct
|
struct AADTstruct
|
||||||
{
|
{
|
||||||
int mType;
|
int32_t mType;
|
||||||
float mQuality;
|
float mQuality;
|
||||||
float mWeight;
|
float mWeight;
|
||||||
int mValue;
|
int32_t mValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
AADTstruct mData;
|
AADTstruct mData;
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
RefId mId, mScript;
|
RefId mId, mScript;
|
||||||
std::string mName, mModel, mIcon;
|
std::string mName, mModel, mIcon;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace ESM
|
||||||
mName = esm.getHString();
|
mName = esm.getHString();
|
||||||
break;
|
break;
|
||||||
case fourCC("AODT"):
|
case fourCC("AODT"):
|
||||||
esm.getHTSized<24>(mData);
|
esm.getHT(mData.mType, mData.mWeight, mData.mValue, mData.mHealth, mData.mEnchant, mData.mArmor);
|
||||||
hasData = true;
|
hasData = true;
|
||||||
break;
|
break;
|
||||||
case fourCC("SCRI"):
|
case fourCC("SCRI"):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_ESM_ARMO_H
|
#ifndef OPENMW_ESM_ARMO_H
|
||||||
#define OPENMW_ESM_ARMO_H
|
#define OPENMW_ESM_ARMO_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -90,15 +91,15 @@ namespace ESM
|
||||||
|
|
||||||
struct AODTstruct
|
struct AODTstruct
|
||||||
{
|
{
|
||||||
int mType;
|
int32_t mType;
|
||||||
float mWeight;
|
float mWeight;
|
||||||
int mValue, mHealth, mEnchant, mArmor;
|
int32_t mValue, mHealth, mEnchant, mArmor;
|
||||||
};
|
};
|
||||||
|
|
||||||
AODTstruct mData;
|
AODTstruct mData;
|
||||||
PartReferenceList mParts;
|
PartReferenceList mParts;
|
||||||
|
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
RefId mId, mScript, mEnchant;
|
RefId mId, mScript, mEnchant;
|
||||||
std::string mName, mModel, mIcon;
|
std::string mName, mModel, mIcon;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace ESM
|
||||||
mRace = esm.getRefId();
|
mRace = esm.getRefId();
|
||||||
break;
|
break;
|
||||||
case fourCC("BYDT"):
|
case fourCC("BYDT"):
|
||||||
esm.getHTSized<4>(mData);
|
esm.getHT(mData.mPart, mData.mVampire, mData.mFlags, mData.mType);
|
||||||
hasData = true;
|
hasData = true;
|
||||||
break;
|
break;
|
||||||
case SREC_DELE:
|
case SREC_DELE:
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "components/esm/defs.hpp"
|
#include "components/esm/defs.hpp"
|
||||||
#include "components/esm/refid.hpp"
|
#include "components/esm/refid.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
|
@ -62,7 +63,7 @@ namespace ESM
|
||||||
};
|
};
|
||||||
|
|
||||||
BYDTstruct mData;
|
BYDTstruct mData;
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
RefId mId, mRace;
|
RefId mId, mRace;
|
||||||
std::string mModel;
|
std::string mModel;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace ESM
|
||||||
mName = esm.getHString();
|
mName = esm.getHString();
|
||||||
break;
|
break;
|
||||||
case fourCC("BKDT"):
|
case fourCC("BKDT"):
|
||||||
esm.getHTSized<20>(mData);
|
esm.getHT(mData.mWeight, mData.mValue, mData.mIsScroll, mData.mSkillId, mData.mEnchant);
|
||||||
hasData = true;
|
hasData = true;
|
||||||
break;
|
break;
|
||||||
case fourCC("SCRI"):
|
case fourCC("SCRI"):
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "components/esm/defs.hpp"
|
#include "components/esm/defs.hpp"
|
||||||
#include "components/esm/refid.hpp"
|
#include "components/esm/refid.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
|
@ -24,12 +26,12 @@ namespace ESM
|
||||||
struct BKDTstruct
|
struct BKDTstruct
|
||||||
{
|
{
|
||||||
float mWeight;
|
float mWeight;
|
||||||
int mValue, mIsScroll, mSkillId, mEnchant;
|
int32_t mValue, mIsScroll, mSkillId, mEnchant;
|
||||||
};
|
};
|
||||||
|
|
||||||
BKDTstruct mData;
|
BKDTstruct mData;
|
||||||
std::string mName, mModel, mIcon, mText;
|
std::string mName, mModel, mIcon, mText;
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
RefId mId;
|
RefId mId;
|
||||||
RefId mScript, mEnchant;
|
RefId mScript, mEnchant;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_ESM_BSGN_H
|
#ifndef OPENMW_ESM_BSGN_H
|
||||||
#define OPENMW_ESM_BSGN_H
|
#define OPENMW_ESM_BSGN_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "components/esm/defs.hpp"
|
#include "components/esm/defs.hpp"
|
||||||
|
@ -20,7 +21,7 @@ namespace ESM
|
||||||
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
||||||
static std::string_view getRecordType() { return "BirthSign"; }
|
static std::string_view getRecordType() { return "BirthSign"; }
|
||||||
|
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
RefId mId;
|
RefId mId;
|
||||||
std::string mName, mDescription, mTexture;
|
std::string mName, mDescription, mTexture;
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@ namespace ESM
|
||||||
const std::string_view Class::sGmstSpecializationIds[3]
|
const std::string_view Class::sGmstSpecializationIds[3]
|
||||||
= { "sSpecializationCombat", "sSpecializationMagic", "sSpecializationStealth" };
|
= { "sSpecializationCombat", "sSpecializationMagic", "sSpecializationStealth" };
|
||||||
|
|
||||||
int& Class::CLDTstruct::getSkill(int index, bool major)
|
int32_t& Class::CLDTstruct::getSkill(int index, bool major)
|
||||||
{
|
{
|
||||||
return mSkills.at(index)[major ? 1 : 0];
|
return mSkills.at(index)[major ? 1 : 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int Class::CLDTstruct::getSkill(int index, bool major) const
|
int32_t Class::CLDTstruct::getSkill(int index, bool major) const
|
||||||
{
|
{
|
||||||
return mSkills.at(index)[major ? 1 : 0];
|
return mSkills.at(index)[major ? 1 : 0];
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ namespace ESM
|
||||||
mName = esm.getHString();
|
mName = esm.getHString();
|
||||||
break;
|
break;
|
||||||
case fourCC("CLDT"):
|
case fourCC("CLDT"):
|
||||||
esm.getHTSized<60>(mData);
|
esm.getHT(
|
||||||
|
mData.mAttribute, mData.mSpecialization, mData.mSkills, mData.mIsPlayable, mData.mServices);
|
||||||
if (mData.mIsPlayable > 1)
|
if (mData.mIsPlayable > 1)
|
||||||
esm.fail("Unknown bool value");
|
esm.fail("Unknown bool value");
|
||||||
hasData = true;
|
hasData = true;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define OPENMW_ESM_CLAS_H
|
#define OPENMW_ESM_CLAS_H
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "components/esm/defs.hpp"
|
#include "components/esm/defs.hpp"
|
||||||
|
@ -34,20 +35,20 @@ namespace ESM
|
||||||
|
|
||||||
struct CLDTstruct
|
struct CLDTstruct
|
||||||
{
|
{
|
||||||
std::array<int, 2> mAttribute; // Attributes that get class bonus
|
std::array<int32_t, 2> mAttribute; // Attributes that get class bonus
|
||||||
int mSpecialization; // 0 = Combat, 1 = Magic, 2 = Stealth
|
int32_t mSpecialization; // 0 = Combat, 1 = Magic, 2 = Stealth
|
||||||
std::array<std::array<int, 2>, 5> mSkills; // Minor and major skills.
|
std::array<std::array<int32_t, 2>, 5> mSkills; // Minor and major skills.
|
||||||
int mIsPlayable; // 0x0001 - Playable class
|
int32_t mIsPlayable; // 0x0001 - Playable class
|
||||||
int mServices;
|
int32_t mServices;
|
||||||
|
|
||||||
int& getSkill(int index, bool major);
|
int32_t& getSkill(int index, bool major);
|
||||||
///< Throws an exception for invalid values of \a index.
|
///< Throws an exception for invalid values of \a index.
|
||||||
|
|
||||||
int getSkill(int index, bool major) const;
|
int32_t getSkill(int index, bool major) const;
|
||||||
///< Throws an exception for invalid values of \a index.
|
///< Throws an exception for invalid values of \a index.
|
||||||
}; // 60 bytes
|
}; // 60 bytes
|
||||||
|
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
std::string mName, mDescription;
|
std::string mName, mDescription;
|
||||||
RefId mId;
|
RefId mId;
|
||||||
CLDTstruct mData;
|
CLDTstruct mData;
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace ESM
|
||||||
mName = esm.getHString();
|
mName = esm.getHString();
|
||||||
break;
|
break;
|
||||||
case fourCC("CTDT"):
|
case fourCC("CTDT"):
|
||||||
esm.getHTSized<12>(mData);
|
esm.getHT(mData.mType, mData.mWeight, mData.mValue, mData.mEnchant);
|
||||||
hasData = true;
|
hasData = true;
|
||||||
break;
|
break;
|
||||||
case fourCC("SCRI"):
|
case fourCC("SCRI"):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_ESM_CLOT_H
|
#ifndef OPENMW_ESM_CLOT_H
|
||||||
#define OPENMW_ESM_CLOT_H
|
#define OPENMW_ESM_CLOT_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "components/esm/defs.hpp"
|
#include "components/esm/defs.hpp"
|
||||||
|
@ -40,16 +41,16 @@ namespace ESM
|
||||||
|
|
||||||
struct CTDTstruct
|
struct CTDTstruct
|
||||||
{
|
{
|
||||||
int mType;
|
int32_t mType;
|
||||||
float mWeight;
|
float mWeight;
|
||||||
unsigned short mValue;
|
uint16_t mValue;
|
||||||
unsigned short mEnchant;
|
uint16_t mEnchant;
|
||||||
};
|
};
|
||||||
CTDTstruct mData;
|
CTDTstruct mData;
|
||||||
|
|
||||||
PartReferenceList mParts;
|
PartReferenceList mParts;
|
||||||
|
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
RefId mId, mEnchant, mScript;
|
RefId mId, mEnchant, mScript;
|
||||||
std::string mModel, mIcon, mName;
|
std::string mModel, mIcon, mName;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_ESM_DOOR_H
|
#ifndef OPENMW_ESM_DOOR_H
|
||||||
#define OPENMW_ESM_DOOR_H
|
#define OPENMW_ESM_DOOR_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "components/esm/defs.hpp"
|
#include "components/esm/defs.hpp"
|
||||||
|
@ -19,7 +20,7 @@ namespace ESM
|
||||||
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
||||||
static std::string_view getRecordType() { return "Door"; }
|
static std::string_view getRecordType() { return "Door"; }
|
||||||
|
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
RefId mId, mScript, mOpenSound, mCloseSound;
|
RefId mId, mScript, mOpenSound, mCloseSound;
|
||||||
std::string mName, mModel;
|
std::string mName, mModel;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace ESM
|
||||||
hasName = true;
|
hasName = true;
|
||||||
break;
|
break;
|
||||||
case fourCC("ENDT"):
|
case fourCC("ENDT"):
|
||||||
esm.getHTSized<16>(mData);
|
esm.getHT(mData.mType, mData.mCost, mData.mCharge, mData.mFlags);
|
||||||
hasData = true;
|
hasData = true;
|
||||||
break;
|
break;
|
||||||
case fourCC("ENAM"):
|
case fourCC("ENAM"):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_ESM_ENCH_H
|
#ifndef OPENMW_ESM_ENCH_H
|
||||||
#define OPENMW_ESM_ENCH_H
|
#define OPENMW_ESM_ENCH_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "components/esm/defs.hpp"
|
#include "components/esm/defs.hpp"
|
||||||
|
@ -39,13 +40,13 @@ namespace ESM
|
||||||
|
|
||||||
struct ENDTstruct
|
struct ENDTstruct
|
||||||
{
|
{
|
||||||
int mType;
|
int32_t mType;
|
||||||
int mCost;
|
int32_t mCost;
|
||||||
int mCharge;
|
int32_t mCharge;
|
||||||
int mFlags;
|
int32_t mFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int mRecordFlags;
|
uint32_t mRecordFlags;
|
||||||
RefId mId;
|
RefId mId;
|
||||||
ENDTstruct mData;
|
ENDTstruct mData;
|
||||||
EffectList mEffects;
|
EffectList mEffects;
|
||||||
|
|
Loading…
Reference in a new issue