From 77c978c2266f9b7f08e3e57d7b37dd83b99d834a Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Tue, 24 Oct 2023 17:23:54 +0200 Subject: [PATCH] Use more fixed size integers --- components/esm3/aipackage.hpp | 10 +++++----- components/esm3/creaturelevliststate.hpp | 2 +- components/esm3/creaturestats.hpp | 5 ++--- components/esm3/debugprofile.hpp | 4 ++-- components/esm3/doorstate.hpp | 2 +- components/esm3/filter.hpp | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/components/esm3/aipackage.hpp b/components/esm3/aipackage.hpp index 61aea2750a..7346a4af36 100644 --- a/components/esm3/aipackage.hpp +++ b/components/esm3/aipackage.hpp @@ -16,10 +16,10 @@ namespace ESM struct AIData { - unsigned short mHello; // This is the base value for greeting distance [0, 65535] + uint16_t mHello; // This is the base value for greeting distance [0, 65535] unsigned char mFight, mFlee, mAlarm; // These are probabilities [0, 100] char mU1, mU2, mU3; // Unknown values - int mServices; // See the Services enum + int32_t mServices; // See the Services enum void blank(); ///< Set record to default state (does not touch the ID). @@ -27,8 +27,8 @@ namespace ESM struct AIWander { - short mDistance; - short mDuration; + int16_t mDistance; + int16_t mDuration; unsigned char mTimeOfDay; unsigned char mIdle[8]; unsigned char mShouldRepeat; @@ -44,7 +44,7 @@ namespace ESM struct AITarget { float mX, mY, mZ; - short mDuration; + int16_t mDuration; NAME32 mId; unsigned char mShouldRepeat; unsigned char mPadding; diff --git a/components/esm3/creaturelevliststate.hpp b/components/esm3/creaturelevliststate.hpp index f8fb7162ff..e7121cf8ac 100644 --- a/components/esm3/creaturelevliststate.hpp +++ b/components/esm3/creaturelevliststate.hpp @@ -9,7 +9,7 @@ namespace ESM struct CreatureLevListState final : public ObjectState { - int mSpawnActorId; + int32_t mSpawnActorId; bool mSpawn; void load(ESMReader& esm) override; diff --git a/components/esm3/creaturestats.hpp b/components/esm3/creaturestats.hpp index 63ba49cdaa..6e65a52354 100644 --- a/components/esm3/creaturestats.hpp +++ b/components/esm3/creaturestats.hpp @@ -47,9 +47,8 @@ namespace ESM std::vector mSummonGraveyard; TimeStamp mTradeTime; - int mGoldPool; - int mActorId; - // int mHitAttemptActorId; + int32_t mGoldPool; + int32_t mActorId; enum Flags { diff --git a/components/esm3/debugprofile.hpp b/components/esm3/debugprofile.hpp index fc48fb23f6..a86e84bfd5 100644 --- a/components/esm3/debugprofile.hpp +++ b/components/esm3/debugprofile.hpp @@ -24,14 +24,14 @@ namespace ESM Flag_Global = 4 // make available from main menu (i.e. not location specific) }; - unsigned int mRecordFlags; + uint32_t mRecordFlags; RefId mId; std::string mDescription; std::string mScriptText; - unsigned int mFlags; + uint32_t mFlags; void load(ESMReader& esm, bool& isDeleted); void save(ESMWriter& esm, bool isDeleted = false) const; diff --git a/components/esm3/doorstate.hpp b/components/esm3/doorstate.hpp index 5298327707..c23ffd5ad2 100644 --- a/components/esm3/doorstate.hpp +++ b/components/esm3/doorstate.hpp @@ -9,7 +9,7 @@ namespace ESM struct DoorState final : public ObjectState { - int mDoorState = 0; + int32_t mDoorState = 0; void load(ESMReader& esm) override; void save(ESMWriter& esm, bool inInventory = false) const override; diff --git a/components/esm3/filter.hpp b/components/esm3/filter.hpp index c4642285af..6a978a2596 100644 --- a/components/esm3/filter.hpp +++ b/components/esm3/filter.hpp @@ -17,7 +17,7 @@ namespace ESM static constexpr std::string_view getRecordType() { return "Filter"; } - unsigned int mRecordFlags; + uint32_t mRecordFlags; RefId mId; std::string mDescription;