mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
Address review comments.
This commit is contained in:
parent
67b6c86a59
commit
273ff1cccb
@ -130,7 +130,7 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec
|
||||
}
|
||||
|
||||
CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager)
|
||||
: mEncoder (encoding), mPathgrids (mCells), mRefs (mCells), mReferenceables(self()),
|
||||
: mEncoder (encoding), mPathgrids (mCells), mReferenceables(self()), mRefs (mCells),
|
||||
mResourcesManager (resourcesManager), mReader (0), mDialogue (0), mReaderIndex(0)
|
||||
{
|
||||
int index = 0;
|
||||
@ -1526,7 +1526,7 @@ CSMWorld::NpcStats* CSMWorld::Data::npcAutoCalculate(const ESM::NPC& npc) const
|
||||
if (autoCalc)
|
||||
level = npc.mNpdt12.mLevel;
|
||||
|
||||
CSMWorld::NpcStats *stats = new CSMWorld::NpcStats();
|
||||
std::auto_ptr<CSMWorld::NpcStats> stats (new CSMWorld::NpcStats());
|
||||
|
||||
CSStore store(mGmsts, mSkills, mMagicEffects, mSpells);
|
||||
|
||||
@ -1547,7 +1547,7 @@ CSMWorld::NpcStats* CSMWorld::Data::npcAutoCalculate(const ESM::NPC& npc) const
|
||||
for (std::vector<std::string>::const_iterator it = npc.mSpells.mList.begin();
|
||||
it != npc.mSpells.mList.end(); ++it)
|
||||
{
|
||||
stats->addSpells(*it);
|
||||
stats->addSpell(*it);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1605,8 +1605,11 @@ CSMWorld::NpcStats* CSMWorld::Data::npcAutoCalculate(const ESM::NPC& npc) const
|
||||
}
|
||||
}
|
||||
|
||||
emit cacheNpcStats (npc.mId, stats);
|
||||
return stats;
|
||||
if (stats.get() == 0)
|
||||
return 0;
|
||||
|
||||
emit cacheNpcStats (npc.mId, stats.release());
|
||||
return stats.release();
|
||||
}
|
||||
|
||||
void CSMWorld::Data::cacheNpcStatsEvent (const std::string& id, CSMWorld::NpcStats *stats)
|
||||
|
@ -45,7 +45,7 @@ namespace CSMWorld
|
||||
mAttr[index] = value;
|
||||
}
|
||||
|
||||
void NpcStats::addSpells(std::string id)
|
||||
void NpcStats::addSpell(const std::string& id)
|
||||
{
|
||||
struct SpellInfo info;
|
||||
info.mName = id;
|
||||
|
@ -43,7 +43,7 @@ namespace CSMWorld
|
||||
|
||||
virtual void setAttribute(int index, unsigned char value);
|
||||
|
||||
virtual void addSpells(std::string id);
|
||||
virtual void addSpell(const std::string& id);
|
||||
|
||||
void addPowers(const std::string& id, int type);
|
||||
|
||||
|
@ -74,7 +74,7 @@ namespace
|
||||
|
||||
virtual void setAttribute(int index, unsigned char value) { mNpcStats.setAttribute(index, value); }
|
||||
|
||||
virtual void addSpells(std::string id) { mNpcStats.getSpells().add(id); }
|
||||
virtual void addSpell(const std::string& id) { mNpcStats.getSpells().add(id); }
|
||||
|
||||
virtual unsigned char getBaseSkill(int index) const { return mNpcStats.getSkill(index).getBase(); }
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include "autocalcspell.hpp"
|
||||
|
||||
// Most of the code in this file was moved from apps/openmw/mwclass/npc.cpp
|
||||
namespace
|
||||
{
|
||||
int is_even(double d)
|
||||
@ -117,7 +116,7 @@ namespace AutoCalc
|
||||
int index = class_->mData.mSkills[i2][i];
|
||||
if (index >= 0 && index < ESM::Skill::Length)
|
||||
{
|
||||
stats.setBaseSkill (index, stats.getBaseSkill(index) + bonus);
|
||||
stats.setBaseSkill (index, bonus);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -168,7 +167,7 @@ namespace AutoCalc
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short autoCalculateHealth(int level, const ESM::Class *class_, StatsBase& stats)
|
||||
unsigned short autoCalculateHealth(int level, const ESM::Class *class_, const StatsBase& stats)
|
||||
{
|
||||
// initial health
|
||||
int strength = stats.getBaseAttribute(ESM::Attribute::Strength);
|
||||
@ -200,7 +199,7 @@ namespace AutoCalc
|
||||
|
||||
std::vector<std::string> spells = autoCalcNpcSpells(skills, attributes, race, store);
|
||||
for (std::vector<std::string>::iterator it = spells.begin(); it != spells.end(); ++it)
|
||||
stats.addSpells(*it);
|
||||
stats.addSpell(*it);
|
||||
}
|
||||
|
||||
StatsBase::StatsBase() {}
|
||||
|
@ -27,7 +27,7 @@ namespace AutoCalc
|
||||
|
||||
virtual void setAttribute(int index, unsigned char value) = 0;
|
||||
|
||||
virtual void addSpells(std::string id) = 0;
|
||||
virtual void addSpell(const std::string& id) = 0;
|
||||
|
||||
virtual unsigned char getBaseSkill(int index) const = 0;
|
||||
|
||||
@ -40,7 +40,7 @@ namespace AutoCalc
|
||||
void autoCalcSkillsImpl (const ESM::NPC* npc,
|
||||
const ESM::Race *race, const ESM::Class *class_, int level, StatsBase& stats, StoreCommon *store);
|
||||
|
||||
unsigned short autoCalculateHealth(int level, const ESM::Class *class_, StatsBase& stats);
|
||||
unsigned short autoCalculateHealth(int level, const ESM::Class *class_, const StatsBase& stats);
|
||||
|
||||
void autoCalculateSpells(const ESM::Race *race, StatsBase& stats, StoreCommon *store);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "autocalc.hpp"
|
||||
|
||||
// Most of the code in this file was moved from apps/openmw/mwmechanics/autocalcspell.cpp
|
||||
namespace AutoCalc
|
||||
{
|
||||
|
||||
|
@ -4,15 +4,8 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace Loading
|
||||
{
|
||||
class Listener;
|
||||
}
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
class ESMWriter;
|
||||
class ESMReader;
|
||||
struct Spell;
|
||||
struct Skill;
|
||||
struct MagicEffect;
|
||||
|
Loading…
x
Reference in New Issue
Block a user