applying new interface vol.5, inconsistent

This commit is contained in:
greye 2012-11-05 23:41:26 +04:00
parent 11567663a7
commit 42aae566a7
5 changed files with 48 additions and 26 deletions

View file

@ -50,7 +50,7 @@ void GenerateClassResultDialog::setClassId(const std::string &classId)
{ {
mCurrentClassId = classId; mCurrentClassId = classId;
mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds"); mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds");
mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().classes.find(mCurrentClassId)->mName); mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(mCurrentClassId)->mName);
} }
// widget controls // widget controls
@ -187,18 +187,16 @@ void PickClassDialog::updateClasses()
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
MWWorld::RecListT<ESM::Class>::MapType::const_iterator it = store.classes.list.begin();
MWWorld::RecListT<ESM::Class>::MapType::const_iterator end = store.classes.list.end();
int index = 0; int index = 0;
for (; it != end; ++it) MWWorld::Store<ESM::Cell>::iterator it = store.get<ESM::Cell>().begin();
for (; it != store.get<ESM::Cell>().end(); ++it)
{ {
const ESM::Class &klass = it->second; bool playable = (it->mData.mIsPlayable != 0);
bool playable = (klass.mData.mIsPlayable != 0);
if (!playable) // Only display playable classes if (!playable) // Only display playable classes
continue; continue;
const std::string &id = it->first; const std::string &id = it->mId;
mClassList->addItem(klass.mName, id); mClassList->addItem(it->mName, id);
if (boost::iequals(id, mCurrentClassId)) if (boost::iequals(id, mCurrentClassId))
mClassList->setIndexSelected(index); mClassList->setIndexSelected(index);
++index; ++index;
@ -210,7 +208,7 @@ void PickClassDialog::updateStats()
if (mCurrentClassId.empty()) if (mCurrentClassId.empty())
return; return;
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Class *klass = store.classes.search(mCurrentClassId); const ESM::Class *klass = store.get<ESM::Class>().search(mCurrentClassId);
if (!klass) if (!klass)
return; return;

View file

@ -127,10 +127,13 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
if (isInventory()) if (isInventory())
{ {
const MWWorld::Store<ESM::GameSetting> &gmst =
MWWorld::Environment::get().getWorld()->getStore()->get<ESM::GameSetting>();
// the player is trying to sell an item, check if the merchant accepts it // the player is trying to sell an item, check if the merchant accepts it
// also, don't allow selling gold (let's be better than Morrowind at this, can we?) // also, don't allow selling gold (let's be better than Morrowind at this, can we?)
if (!MWBase::Environment::get().getWindowManager()->getTradeWindow()->npcAcceptsItem(object) || if (!MWBase::Environment::get().getWindowManager()->getTradeWindow()->npcAcceptsItem(object) ||
MWWorld::Class::get(object).getName(object) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString()) MWWorld::Class::get(object).getName(object) == gmst.find("sGold")->getString())
{ {
// user notification "i don't buy this item" // user notification "i don't buy this item"
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->

View file

@ -341,7 +341,9 @@ void HUD::onResChange(int width, int height)
void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent) void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
{ {
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);
std::string spellName = spell->mName; std::string spellName = spell->mName;
if (spellName != mSpellName && mSpellVisible) if (spellName != mSpellName && mSpellVisible)
{ {
@ -361,7 +363,9 @@ void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
mSpellBox->setUserString("Spell", spellId); mSpellBox->setUserString("Spell", spellId);
// use the icon of the first effect // use the icon of the first effect
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->mEffects.mList.front().mEffectID); const ESM::MagicEffect* effect =
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mEffectID);
std::string icon = effect->mIcon; std::string icon = effect->mIcon;
int slashPos = icon.find("\\"); int slashPos = icon.find("\\");
icon.insert(slashPos+1, "b_"); icon.insert(slashPos+1, "b_");

View file

@ -123,11 +123,14 @@ namespace MWGui
const ESM::Class& playerClass = MWBase::Environment::get().getWorld ()->getPlayer ().getClass (); const ESM::Class& playerClass = MWBase::Environment::get().getWorld ()->getPlayer ().getClass ();
// retrieve the ID to this class // retrieve the ID to this class
std::string classId; std::string classId;
std::map<std::string, ESM::Class> list = MWBase::Environment::get().getWorld()->getStore ().classes.list; const MWWorld::Store<ESM::Class> &classes =
for (std::map<std::string, ESM::Class>::iterator it = list.begin(); it != list.end(); ++it) MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>();
MWWorld::Store<ESM::Class>::iterator it = classes.begin();
for (; it != classes.end(); ++it)
{ {
if (playerClass.mName == it->second.mName) if (playerClass.mName == it->mName)
classId = it->first; classId = it->mId;
} }
mClassImage->setImageTexture ("textures\\levelup\\" + classId + ".dds"); mClassImage->setImageTexture ("textures\\levelup\\" + classId + ".dds");

View file

@ -28,8 +28,11 @@ namespace
bool sortMagicEffects (short id1, short id2) bool sortMagicEffects (short id1, short id2)
{ {
return MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find(ESM::MagicEffect::effectIdToString (id1))->getString() const MWWorld::Store<ESM::GameSetting> &gmst =
< MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find(ESM::MagicEffect::effectIdToString (id2))->getString(); MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
return gmst.find(ESM::MagicEffect::effectIdToString (id1))->getString()
< gmst.find(ESM::MagicEffect::effectIdToString (id2))->getString();
} }
} }
@ -105,7 +108,8 @@ namespace MWGui
void EditEffectDialog::editEffect (ESM::ENAMstruct effect) void EditEffectDialog::editEffect (ESM::ENAMstruct effect)
{ {
const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(effect.mEffectID); const ESM::MagicEffect* magicEffect =
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
setMagicEffect(magicEffect); setMagicEffect(magicEffect);
@ -358,16 +362,23 @@ namespace MWGui
{ {
float y = 0; float y = 0;
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it) for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
{ {
float x = 0.5 * it->mMagnMin + it->mMagnMax; float x = 0.5 * it->mMagnMin + it->mMagnMax;
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(it->mEffectID); const ESM::MagicEffect* effect =
store.get<ESM::MagicEffect>().find(it->mEffectID);
x *= 0.1 * effect->mData.mBaseCost; x *= 0.1 * effect->mData.mBaseCost;
x *= 1 + it->mDuration; x *= 1 + it->mDuration;
x += 0.05 * std::max(1, it->mArea) * effect->mData.mBaseCost; x += 0.05 * std::max(1, it->mArea) * effect->mData.mBaseCost;
float fEffectCostMult = MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fEffectCostMult")->getFloat(); float fEffectCostMult =
store.get<ESM::GameSetting>().find("fEffectCostMult")->getFloat();
y += x * fEffectCostMult; y += x * fEffectCostMult;
y = std::max(1.f,y); y = std::max(1.f,y);
@ -384,7 +395,8 @@ namespace MWGui
mMagickaCost->setCaption(boost::lexical_cast<std::string>(int(y))); mMagickaCost->setCaption(boost::lexical_cast<std::string>(int(y)));
float fSpellMakingValueMult = MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fSpellMakingValueMult")->getFloat(); float fSpellMakingValueMult =
store.get<ESM::GameSetting>().find("fSpellMakingValueMult")->getFloat();
/// \todo mercantile /// \todo mercantile
int price = int(y) * fSpellMakingValueMult; int price = int(y) * fSpellMakingValueMult;
@ -422,7 +434,8 @@ namespace MWGui
for (MWMechanics::Spells::TIterator it = spells.begin(); it != spells.end(); ++it) for (MWMechanics::Spells::TIterator it = spells.begin(); it != spells.end(); ++it)
{ {
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it); const ESM::Spell* spell =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(*it);
// only normal spells count // only normal spells count
if (spell->mData.mType != ESM::Spell::ST_Spell) if (spell->mData.mType != ESM::Spell::ST_Spell)
@ -442,14 +455,14 @@ namespace MWGui
for (std::vector<short>::const_iterator it = knownEffects.begin(); it != knownEffects.end(); ++it) for (std::vector<short>::const_iterator it = knownEffects.begin(); it != knownEffects.end(); ++it)
{ {
mAvailableEffectsList->addItem(MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find( mAvailableEffectsList->addItem(MWBase::Environment::get().getWorld ()->getStore ().get<ESM::GameSetting>().find(
ESM::MagicEffect::effectIdToString (*it))->getString()); ESM::MagicEffect::effectIdToString (*it))->getString());
} }
mAvailableEffectsList->adjustSize (); mAvailableEffectsList->adjustSize ();
for (std::vector<short>::const_iterator it = knownEffects.begin(); it != knownEffects.end(); ++it) for (std::vector<short>::const_iterator it = knownEffects.begin(); it != knownEffects.end(); ++it)
{ {
std::string name = MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find( std::string name = MWBase::Environment::get().getWorld ()->getStore ().get<ESM::GameSetting>().find(
ESM::MagicEffect::effectIdToString (*it))->getString(); ESM::MagicEffect::effectIdToString (*it))->getString();
MyGUI::Widget* w = mAvailableEffectsList->getItemWidget(name); MyGUI::Widget* w = mAvailableEffectsList->getItemWidget(name);
w->setUserData(*it); w->setUserData(*it);
@ -515,7 +528,8 @@ namespace MWGui
} }
} }
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(effectId); const ESM::MagicEffect* effect =
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectId);
mAddEffectDialog.newEffect (effect); mAddEffectDialog.newEffect (effect);