applying new interface vol.2, inconsistent

actorid
greye 12 years ago
parent bd1bb2e55d
commit 86ad7a96f4

@ -86,7 +86,7 @@ namespace MWMechanics
if (effects.second)
{
const ESM::MagicEffect *magicEffect =
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
iter->mEffectID);
if (iter->mDuration==0)
@ -114,18 +114,18 @@ namespace MWMechanics
std::pair<ESM::EffectList, bool> ActiveSpells::getEffectList (const std::string& id) const
{
if (const ESM::Spell *spell =
MWBase::Environment::get().getWorld()->getStore().spells.search (id))
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search (id))
return std::make_pair (spell->mEffects, false);
if (const ESM::Potion *potion =
MWBase::Environment::get().getWorld()->getStore().potions.search (id))
MWBase::Environment::get().getWorld()->getStore().get<ESM::Potion>().search (id))
return std::make_pair (potion->mEffects, false);
if (const ESM::Ingredient *ingredient =
MWBase::Environment::get().getWorld()->getStore().ingreds.search (id))
MWBase::Environment::get().getWorld()->getStore().get<ESM::Ingredient>().search (id))
{
const ESM::MagicEffect *magicEffect =
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
ingredient->mData.mEffectID[0]);
ESM::ENAMstruct effect;

@ -103,9 +103,9 @@ namespace MWMechanics
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
float fFatigueReturnBase = store.gameSettings.find("fFatigueReturnBase")->getFloat ();
float fFatigueReturnMult = store.gameSettings.find("fFatigueReturnMult")->getFloat ();
float fEndFatigueMult = store.gameSettings.find("fEndFatigueMult")->getFloat ();
float fFatigueReturnBase = store.get<ESM::GameSetting>().find("fFatigueReturnBase")->getFloat ();
float fFatigueReturnMult = store.get<ESM::GameSetting>().find("fFatigueReturnMult")->getFloat ();
float fEndFatigueMult = store.get<ESM::GameSetting>().find("fEndFatigueMult")->getFloat ();
float capacity = MWWorld::Class::get(ptr).getCapacity(ptr);
float encumbrance = MWWorld::Class::get(ptr).getEncumbrance(ptr);
@ -122,7 +122,7 @@ namespace MWMechanics
if (!stunted)
{
float fRestMagicMult = store.gameSettings.find("fRestMagicMult")->getFloat ();
float fRestMagicMult = store.get<ESM::GameSetting>().find("fRestMagicMult")->getFloat ();
DynamicStat<float> magicka = stats.getMagicka();
magicka.setCurrent (magicka.getCurrent()

@ -41,10 +41,11 @@ namespace MWMechanics
float normalised = max==0 ? 1 : std::max (0.0f, static_cast<float> (current)/max);
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
return store.gameSettings.find ("fFatigueBase")->getFloat()
- store.gameSettings.find ("fFatigueMult")->getFloat() * (1-normalised);
return gmst.find ("fFatigueBase")->getFloat()
- gmst.find ("fFatigueMult")->getFloat() * (1-normalised);
}
const Stat<int> &CreatureStats::getAttribute(int index) const

@ -42,8 +42,9 @@ namespace MWMechanics
if (mRaceSelected)
{
const ESM::Race *race =
MWBase::Environment::get().getWorld()->getStore().races.find (
MWBase::Environment::get().getWorld()->getPlayer().getRace());
MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find (
MWBase::Environment::get().getWorld()->getPlayer().getRace()
);
bool male = MWBase::Environment::get().getWorld()->getPlayer().isMale();
@ -91,7 +92,7 @@ namespace MWMechanics
if (!MWBase::Environment::get().getWorld()->getPlayer().getBirthsign().empty())
{
const ESM::BirthSign *sign =
MWBase::Environment::get().getWorld()->getStore().birthSigns.find (
MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().find (
MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
for (std::vector<std::string>::const_iterator iter (sign->mPowers.mList.begin());
@ -132,14 +133,15 @@ namespace MWMechanics
}
}
typedef MWWorld::IndexListT<ESM::Skill>::MapType ContainerType;
const ContainerType& skills = MWBase::Environment::get().getWorld()->getStore().skills.list;
const MWWorld::Store<ESM::Skill> &skills =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>();
for (ContainerType::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter)
MWWorld::Store<ESM::Skill>::iterator iter = skills.begin();
for (; iter != skills.end(); ++iter)
{
if (iter->second.mData.mSpecialization==class_.mData.mSpecialization)
if (iter->mData.mSpecialization==class_.mData.mSpecialization)
{
int index = iter->first;
int index = iter->mIndex;
if (index>=0 && index<27)
{
@ -261,12 +263,16 @@ namespace MWMechanics
if (mUpdatePlayer)
{
// basic player profile; should not change anymore after the creation phase is finished.
MWBase::Environment::get().getWindowManager()->setValue ("name", MWBase::Environment::get().getWorld()->getPlayer().getName());
MWBase::Environment::get().getWindowManager()->setValue ("race",
MWBase::Environment::get().getWorld()->getStore().races.find (MWBase::Environment::get().getWorld()->getPlayer().
getRace())->mName);
MWBase::Environment::get().getWindowManager()->setValue ("class",
MWBase::Environment::get().getWorld()->getPlayer().getClass().mName);
MWBase::WindowManager *winMgr =
MWBase::Environment::get().getWindowManager();
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Player &player = world->getPlayer();
winMgr->setValue ("name", player.getName());
winMgr->setValue ("race", world->getStore().get<ESM::Race>().find (player.getRace())->mName);
winMgr->setValue ("class", player.getClass().mName);
mUpdatePlayer = false;
MWBase::WindowManager::SkillList majorSkills (5);
@ -274,11 +280,11 @@ namespace MWMechanics
for (int i=0; i<5; ++i)
{
minorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().mData.mSkills[i][0];
majorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().mData.mSkills[i][1];
minorSkills[i] = player.getClass().mData.mSkills[i][0];
majorSkills[i] = player.getClass().mData.mSkills[i][1];
}
MWBase::Environment::get().getWindowManager()->configureSkills (majorSkills, minorSkills);
winMgr->configureSkills (majorSkills, minorSkills);
}
mActors.update (movement, duration, paused);
@ -313,7 +319,9 @@ namespace MWMechanics
void MechanicsManager::setPlayerClass (const std::string& id)
{
MWBase::Environment::get().getWorld()->getPlayer().setClass (*MWBase::Environment::get().getWorld()->getStore().classes.find (id));
MWBase::Environment::get().getWorld()->getPlayer().setClass (
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find (id)
);
mClassSelected = true;
buildPlayer();
mUpdatePlayer = true;

@ -81,7 +81,8 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
if (level<0)
level = static_cast<int> (getSkill (skillIndex).getBase());
const ESM::Skill *skill = MWBase::Environment::get().getWorld()->getStore().skills.find (skillIndex);
const ESM::Skill *skill =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>().find (skillIndex);
float skillFactor = 1;
@ -96,14 +97,15 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
throw std::runtime_error ("invalid skill gain factor");
}
float typeFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMiscSkillBonus")->getFloat();
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
float typeFactor = gmst.find ("fMiscSkillBonus")->getFloat();
for (int i=0; i<5; ++i)
if (class_.mData.mSkills[i][0]==skillIndex)
{
typeFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMinorSkillBonus")->getFloat();
typeFactor = gmst.find ("fMinorSkillBonus")->getFloat();
break;
}
@ -111,8 +113,7 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
for (int i=0; i<5; ++i)
if (class_.mData.mSkills[i][1]==skillIndex)
{
typeFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMajorSkillBonus")->getFloat();
typeFactor = gmst.find ("fMajorSkillBonus")->getFloat();
break;
}
@ -124,8 +125,7 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
if (skill->mData.mSpecialization==class_.mData.mSpecialization)
{
specialisationFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fSpecialSkillBonus")->getFloat();
specialisationFactor = gmst.find ("fSpecialSkillBonus")->getFloat();
if (specialisationFactor<=0)
throw std::runtime_error ("invalid skill specialisation factor");
@ -178,7 +178,8 @@ void MWMechanics::NpcStats::increaseSkill(int skillIndex, const ESM::Class &clas
mLevelProgress += levelProgress;
// check the attribute this skill belongs to
const ESM::Skill* skill = MWBase::Environment::get().getWorld ()->getStore ().skills.find(skillIndex);
const ESM::Skill* skill =
MWBase::Environment::get().getWorld ()->getStore ().get<ESM::Skill>().find(skillIndex);
++mSkillIncreases[skill->mData.mAttribute];
// Play sound & skill progress notification

@ -40,7 +40,8 @@ namespace MWMechanics
for (std::vector<ESM::ENAMstruct>::const_iterator it = effects.begin();
it != effects.end(); ++it)
{
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(it->mEffectID);
const ESM::MagicEffect* effect =
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(it->mEffectID);
int _school = effect->mData.mSchool;
int _skillLevel = stats.getSkill (spellSchoolToSkill(_school)).getModified();
@ -61,7 +62,8 @@ namespace MWMechanics
inline int getSpellSchool(const std::string& spellId, const MWWorld::Ptr& actor)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
const ESM::Spell* spell =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell.().find(spellId);
return getSpellSchool(spell, actor);
}
@ -107,7 +109,8 @@ namespace MWMechanics
inline float getSpellSuccessChance (const std::string& spellId, const MWWorld::Ptr& actor)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
const ESM::Spell* spell =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
return getSpellSuccessChance(spell, actor);
}
}

Loading…
Cancel
Save