applying new interface vol.1, inconsistent

This commit is contained in:
greye 2012-11-05 18:39:42 +04:00
parent 7cf0b8a680
commit bd1bb2e55d
6 changed files with 34 additions and 26 deletions

View file

@ -152,13 +152,16 @@ namespace MWClass
if (typeGmst.empty()) if (typeGmst.empty())
return -1; return -1;
float iWeight = MWBase::Environment::get().getWorld()->getStore().gameSettings.find (typeGmst)->getInt(); const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fLightMaxMod")->getFloat()>= float iWeight = gmst.find (typeGmst)->getInt();
if (iWeight * gmst.find ("fLightMaxMod")->getFloat()>=
ref->mBase->mData.mWeight) ref->mBase->mData.mWeight)
return ESM::Skill::LightArmor; return ESM::Skill::LightArmor;
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMedMaxMod")->getFloat()>= if (iWeight * gmst.get<ESM::GameSetting>().find ("fMedMaxMod")->getFloat()>=
ref->mBase->mData.mWeight) ref->mBase->mData.mWeight)
return ESM::Skill::MediumArmor; return ESM::Skill::MediumArmor;

View file

@ -220,12 +220,13 @@ namespace MWClass
// door leads to exterior, use cell name (if any), otherwise translated region name // door leads to exterior, use cell name (if any), otherwise translated region name
int x,y; int x,y;
MWBase::Environment::get().getWorld()->positionToIndex (ref->mRef.mDoorDest.pos[0], ref->mRef.mDoorDest.pos[1], x, y); MWBase::Environment::get().getWorld()->positionToIndex (ref->mRef.mDoorDest.pos[0], ref->mRef.mDoorDest.pos[1], x, y);
const ESM::Cell* cell = store.cells.findExt(x,y); const ESM::Cell* cell = store.get<ESM::Cell>().find(x,y);
if (cell->mName != "") if (cell->mName != "")
dest = cell->mName; dest = cell->mName;
else else
{ {
const ESM::Region* region = store.regions.search(cell->mRegion); const ESM::Region* region =
store.get<ESM::Region>().find(cell->mRegion);
dest = region->mName; dest = region->mName;
} }
} }

View file

@ -101,7 +101,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>(); ptr.get<ESM::Miscellaneous>();
if (ref->mBase->mName == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString()) if (ref->mBase->mName == MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sGold")->getString())
{ {
return std::string("Item Gold Up"); return std::string("Item Gold Up");
} }
@ -113,7 +113,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>(); ptr.get<ESM::Miscellaneous>();
if (ref->mBase->mName == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString()) if (ref->mBase->mName == MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sGold")->getString())
{ {
return std::string("Item Gold Down"); return std::string("Item Gold Down");
} }
@ -147,7 +147,7 @@ namespace MWClass
int count = ptr.getRefData().getCount(); int count = ptr.getRefData().getCount();
bool isGold = (ref->mBase->mName == store.gameSettings.find("sGold")->getString()); bool isGold = (ref->mBase->mName == store.get<ESM::GameSetting>().find("sGold")->getString());
if (isGold && count == 1) if (isGold && count == 1)
count = ref->mBase->mData.mValue; count = ref->mBase->mData.mValue;
@ -162,7 +162,7 @@ namespace MWClass
if (ref->mRef.mSoul != "") if (ref->mRef.mSoul != "")
{ {
const ESM::Creature *creature = store.creatures.search(ref->mRef.mSoul); const ESM::Creature *creature = store.get<ESM::Creature>().find(ref->mRef.mSoul);
info.caption += " (" + creature->mName + ")"; info.caption += " (" + creature->mName + ")";
} }
@ -192,7 +192,7 @@ namespace MWClass
const MWWorld::ESMStore &store = const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore(); MWBase::Environment::get().getWorld()->getStore();
if (MWWorld::Class::get(ptr).getName(ptr) == store.gameSettings.find("sGold")->getString()) { if (MWWorld::Class::get(ptr).getName(ptr) == store.get<ESM::GameSetting().find("sGold")->getString()) {
int goldAmount = ptr.getRefData().getCount(); int goldAmount = ptr.getRefData().getCount();
std::string base = "Gold_001"; std::string base = "Gold_001";

View file

@ -395,8 +395,10 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>(); MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find ( const ESM::Class *class_ =
ref->mBase->mClass); MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find (
ref->mBase->mClass
);
stats.useSkill (skill, *class_, usageType); stats.useSkill (skill, *class_, usageType);
} }

View file

@ -303,8 +303,8 @@ namespace MWClass
std::string type = mapping[ref->mBase->mData.mType].first; std::string type = mapping[ref->mBase->mData.mType].first;
std::string oneOrTwoHanded = mapping[ref->mBase->mData.mType].second; std::string oneOrTwoHanded = mapping[ref->mBase->mData.mType].second;
text += store.gameSettings.find(type)->getString() + text += store.get<ESM::GameSetting>().find(type)->getString() +
((oneOrTwoHanded != "") ? ", " + store.gameSettings.find(oneOrTwoHanded)->getString() : ""); ((oneOrTwoHanded != "") ? ", " + store.get<ESM::GameSetting>().find(oneOrTwoHanded)->getString() : "");
// weapon damage // weapon damage
if (ref->mBase->mData.mType >= 9) if (ref->mBase->mData.mType >= 9)

View file

@ -131,29 +131,29 @@ void MWMechanics::Alchemy::updateEffects()
float x = getChance(); float x = getChance();
x *= mTools[ESM::Apparatus::MortarPestle].get<ESM::Apparatus>()->mBase->mData.mQuality; x *= mTools[ESM::Apparatus::MortarPestle].get<ESM::Apparatus>()->mBase->mData.mQuality;
x *= MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fPotionStrengthMult")->getFloat(); x *= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fPotionStrengthMult")->getFloat();
// value // value
mValue = static_cast<int> ( mValue = static_cast<int> (
x * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("iAlchemyMod")->getFloat()); x * MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("iAlchemyMod")->getFloat());
// build quantified effect list // build quantified effect list
for (std::set<EffectKey>::const_iterator iter (effects.begin()); iter!=effects.end(); ++iter) for (std::set<EffectKey>::const_iterator iter (effects.begin()); iter!=effects.end(); ++iter)
{ {
const ESM::MagicEffect *magicEffect = const ESM::MagicEffect *magicEffect =
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (iter->mId); MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (iter->mId);
if (magicEffect->mData.mBaseCost<=0) if (magicEffect->mData.mBaseCost<=0)
throw std::runtime_error ("invalid base cost for magic effect " + iter->mId); throw std::runtime_error ("invalid base cost for magic effect " + iter->mId);
float fPotionT1MagMul = float fPotionT1MagMul =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fPotionT1MagMult")->getFloat(); MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fPotionT1MagMult")->getFloat();
if (fPotionT1MagMul<=0) if (fPotionT1MagMul<=0)
throw std::runtime_error ("invalid gmst: fPotionT1MagMul"); throw std::runtime_error ("invalid gmst: fPotionT1MagMul");
float fPotionT1DurMult = float fPotionT1DurMult =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fPotionT1DurMult")->getFloat(); MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fPotionT1DurMult")->getFloat();
if (fPotionT1DurMult<=0) if (fPotionT1DurMult<=0)
throw std::runtime_error ("invalid gmst: fPotionT1DurMult"); throw std::runtime_error ("invalid gmst: fPotionT1DurMult");
@ -192,18 +192,20 @@ void MWMechanics::Alchemy::updateEffects()
const ESM::Potion *MWMechanics::Alchemy::getRecord() const const ESM::Potion *MWMechanics::Alchemy::getRecord() const
{ {
for (MWWorld::RecListWithIDT<ESM::Potion>::MapType::const_iterator iter ( const MWWorld::Store<ESM::Potion> &potions =
MWBase::Environment::get().getWorld()->getStore().potions.list.begin()); MWBase::Environment::get().getWorld()->getStore().get<ESM::Potion>();
iter!=MWBase::Environment::get().getWorld()->getStore().potions.list.end(); ++iter)
MWWorld::Store<ESM::Potion>::iterator iter = potions.begin();
for (; iter != potions.end(); ++iter)
{ {
if (iter->second.mEffects.mList.size()!=mEffects.size()) if (iter->mEffects.mList.size() != mEffects.size())
continue; continue;
bool mismatch = false; bool mismatch = false;
for (int i=0; i<static_cast<int> (iter->second.mEffects.mList.size()); ++iter) for (int i=0; i<static_cast<int> (iter->mEffects.mList.size()); ++iter)
{ {
const ESM::ENAMstruct& first = iter->second.mEffects.mList[i]; const ESM::ENAMstruct& first = iter->mEffects.mList[i];
const ESM::ENAMstruct& second = mEffects[i]; const ESM::ENAMstruct& second = mEffects[i];
if (first.mEffectID!=second.mEffectID || if (first.mEffectID!=second.mEffectID ||
@ -221,7 +223,7 @@ const ESM::Potion *MWMechanics::Alchemy::getRecord() const
} }
if (!mismatch) if (!mismatch)
return &iter->second; return &(*iter);
} }
return 0; return 0;