Use std::array in NPDTstruct52

macos_ci
Evil Eye 2 years ago
parent dd83da5eba
commit a5bb6c7d8d

@ -1100,8 +1100,8 @@ namespace EsmTool
std::cout << " Luck: " << (int)mData.mNpdt.mLuck << std::endl; std::cout << " Luck: " << (int)mData.mNpdt.mLuck << std::endl;
std::cout << " Skills:" << std::endl; std::cout << " Skills:" << std::endl;
for (int i = 0; i != ESM::Skill::Length; i++) for (size_t i = 0; i != mData.mNpdt.mSkills.size(); i++)
std::cout << " " << skillLabel(i) << ": " << (int)(mData.mNpdt.mSkills[i]) << std::endl; std::cout << " " << skillLabel(i) << ": " << int(mData.mNpdt.mSkills[i]) << std::endl;
std::cout << " Health: " << mData.mNpdt.mHealth << std::endl; std::cout << " Health: " << mData.mNpdt.mHealth << std::endl;
std::cout << " Magicka: " << mData.mNpdt.mMana << std::endl; std::cout << " Magicka: " << mData.mNpdt.mMana << std::endl;

@ -314,7 +314,7 @@ namespace MWClass
{ {
gold = ref->mBase->mNpdt.mGold; gold = ref->mBase->mNpdt.mGold;
for (unsigned int i = 0; i < ESM::Skill::Length; ++i) for (size_t i = 0; i < ref->mBase->mNpdt.mSkills.size(); ++i)
data->mNpcStats.getSkill(i).setBase(ref->mBase->mNpdt.mSkills[i]); data->mNpcStats.getSkill(i).setBase(ref->mBase->mNpdt.mSkills[i]);
data->mNpcStats.setAttribute(ESM::Attribute::Strength, ref->mBase->mNpdt.mStrength); data->mNpcStats.setAttribute(ESM::Attribute::Strength, ref->mBase->mNpdt.mStrength);

@ -128,7 +128,7 @@ namespace MWMechanics
creatureStats.getSpells().clear(true); creatureStats.getSpells().clear(true);
creatureStats.getActiveSpells().clear(ptr); creatureStats.getActiveSpells().clear(ptr);
for (int i = 0; i < 27; ++i) for (size_t i = 0; i < player->mNpdt.mSkills.size(); ++i)
npcStats.getSkill(i).setBase(player->mNpdt.mSkills[i]); npcStats.getSkill(i).setBase(player->mNpdt.mSkills[i]);
creatureStats.setAttribute(ESM::Attribute::Strength, player->mNpdt.mStrength); creatureStats.setAttribute(ESM::Attribute::Strength, player->mNpdt.mStrength);

@ -215,8 +215,7 @@ namespace ESM
mNpdt.mLevel = 0; mNpdt.mLevel = 0;
mNpdt.mStrength = mNpdt.mIntelligence = mNpdt.mWillpower = mNpdt.mAgility = mNpdt.mSpeed = mNpdt.mEndurance mNpdt.mStrength = mNpdt.mIntelligence = mNpdt.mWillpower = mNpdt.mAgility = mNpdt.mSpeed = mNpdt.mEndurance
= mNpdt.mPersonality = mNpdt.mLuck = 0; = mNpdt.mPersonality = mNpdt.mLuck = 0;
for (int i = 0; i < Skill::Length; ++i) mNpdt.mSkills.fill(0);
mNpdt.mSkills[i] = 0;
mNpdt.mReputation = 0; mNpdt.mReputation = 0;
mNpdt.mHealth = mNpdt.mMana = mNpdt.mFatigue = 0; mNpdt.mHealth = mNpdt.mMana = mNpdt.mFatigue = 0;
mNpdt.mDisposition = 0; mNpdt.mDisposition = 0;

@ -1,6 +1,7 @@
#ifndef OPENMW_ESM_NPC_H #ifndef OPENMW_ESM_NPC_H
#define OPENMW_ESM_NPC_H #define OPENMW_ESM_NPC_H
#include <array>
#include <string> #include <string>
#include <vector> #include <vector>
@ -82,7 +83,7 @@ namespace ESM
unsigned char mStrength, mIntelligence, mWillpower, mAgility, mSpeed, mEndurance, mPersonality, mLuck; unsigned char mStrength, mIntelligence, mWillpower, mAgility, mSpeed, mEndurance, mPersonality, mLuck;
// mSkill can grow up to 200, it must be unsigned // mSkill can grow up to 200, it must be unsigned
unsigned char mSkills[Skill::Length]; std::array<unsigned char, Skill::Length> mSkills;
char mUnknown1; char mUnknown1;
unsigned short mHealth, mMana, mFatigue; unsigned short mHealth, mMana, mFatigue;

Loading…
Cancel
Save