applying new interface vol.7, inconsistent

actorid
greye 12 years ago
parent 4637503680
commit a9c1ce412a

@ -29,8 +29,11 @@ namespace
bool sortSpells(const std::string& left, const std::string& right)
{
const ESM::Spell* a = MWBase::Environment::get().getWorld()->getStore().spells.find(left);
const ESM::Spell* b = MWBase::Environment::get().getWorld()->getStore().spells.find(right);
const MWWorld::Store<ESM::Spell> &spells =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>();
const ESM::Spell* a = spells.find(left);
const ESM::Spell* b = spells.find(right);
int cmp = a->mName.compare(b->mName);
return cmp < 0;
@ -234,9 +237,15 @@ namespace MWGui
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
const MWWorld::ESMStore &esmStore =
MWBase::Environment::get().getWorld()->getStore();
// use the icon of the first effect
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->mEffects.mList.front().mEffectID);
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(spellId);
const ESM::MagicEffect* effect =
esmStore.get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mEffectID);
std::string path = effect->mIcon;
int slashPos = path.find("\\");
path.insert(slashPos+1, "b_");
@ -434,11 +443,14 @@ namespace MWGui
spellList.push_back(*it);
}
const MWWorld::ESMStore &esmStore =
MWBase::Environment::get().getWorld()->getStore();
std::vector<std::string> powers;
std::vector<std::string>::iterator it = spellList.begin();
while (it != spellList.end())
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
if (spell->mData.mType == ESM::Spell::ST_Power)
{
powers.push_back(*it);
@ -465,7 +477,9 @@ namespace MWGui
if (enchantId != "")
{
// only add items with "Cast once" or "Cast on use"
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(enchantId);
const ESM::Enchantment* enchant =
esmStore.get<ESM::Enchantment>().find(enchantId);
int type = enchant->mData.mType;
if (type != ESM::Enchantment::CastOnce
&& type != ESM::Enchantment::WhenUsed)
@ -487,7 +501,7 @@ namespace MWGui
for (std::vector<std::string>::const_iterator it = powers.begin(); it != powers.end(); ++it)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->mName);
@ -504,7 +518,7 @@ namespace MWGui
addGroup("#{sSpells}", "");
for (std::vector<std::string>::const_iterator it = spellList.begin(); it != spellList.end(); ++it)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->mName);

@ -26,8 +26,11 @@ namespace
{
bool sortSpells(const std::string& left, const std::string& right)
{
const ESM::Spell* a = MWBase::Environment::get().getWorld()->getStore().spells.find(left);
const ESM::Spell* b = MWBase::Environment::get().getWorld()->getStore().spells.find(right);
const MWWorld::Store<ESM::Spell> &spells =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>();
const ESM::Spell* a = spells.find(left);
const ESM::Spell* b = spells.find(right);
int cmp = a->mName.compare(b->mName);
return cmp < 0;
@ -139,11 +142,15 @@ namespace MWGui
spellList.push_back(*it);
}
const MWWorld::ESMStore &esmStore =
MWBase::Environment::get().getWorld()->getStore();
std::vector<std::string> powers;
std::vector<std::string>::iterator it = spellList.begin();
while (it != spellList.end())
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
if (spell->mData.mType == ESM::Spell::ST_Power)
{
powers.push_back(*it);
@ -170,7 +177,9 @@ namespace MWGui
if (enchantId != "")
{
// only add items with "Cast once" or "Cast on use"
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(enchantId);
const ESM::Enchantment* enchant =
esmStore.get<ESM::Enchantment>().find(enchantId);
int type = enchant->mData.mType;
if (type != ESM::Enchantment::CastOnce
&& type != ESM::Enchantment::WhenUsed)
@ -191,7 +200,7 @@ namespace MWGui
for (std::vector<std::string>::const_iterator it = powers.begin(); it != powers.end(); ++it)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
MyGUI::Button* t = mSpellView->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->mName);
@ -211,7 +220,7 @@ namespace MWGui
addGroup("#{sSpells}", "#{sCostChance}");
for (std::vector<std::string>::const_iterator it = spellList.begin(); it != spellList.end(); ++it)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
MyGUI::Button* t = mSpellView->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->mName);
@ -244,7 +253,8 @@ namespace MWGui
{
MWWorld::Ptr item = *it;
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(MWWorld::Class::get(item).getEnchantment(item));
const ESM::Enchantment* enchant =
esmStore.get<ESM::Enchantment>().find(MWWorld::Class::get(item).getEnchantment(item));
// check if the item is currently equipped (will display in a different color)
bool equipped = false;
@ -378,7 +388,9 @@ namespace MWGui
if (MyGUI::InputManager::getInstance().isShiftPressed())
{
// delete spell, if allowed
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);
if (spell->mData.mFlags & ESM::Spell::F_Always
|| spell->mData.mType == ESM::Spell::ST_Power)
{

@ -57,7 +57,7 @@ StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
for (int i=0; names[i][0]; ++i)
{
setText (names[i][0], store.gameSettings.find (names[i][1])->getString());
setText (names[i][0], store.get<ESM::GameSetting>().find (names[i][1])->getString());
}
getWidget(mSkillView, "SkillView");
@ -363,12 +363,16 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
float modified = stat.getModified();
int progressPercent = (modified - float(static_cast<int>(modified))) * 100;
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId);
const MWWorld::ESMStore &esmStore =
MWBase::Environment::get().getWorld()->getStore();
const ESM::Skill* skill = esmStore.get<ESM::Skill>().find(skillId);
assert(skill);
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute);
const ESM::Attribute* attr =
esmStore.get<ESM::Attribute>().find(skill->mData.mAttribute);
assert(attr);
std::string state = "normal";
@ -425,7 +429,9 @@ void StatsWindow::updateSkillArea()
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
// race tooltip
const ESM::Race* playerRace = store.races.find (MWBase::Environment::get().getWorld()->getPlayer().getRace());
const ESM::Race* playerRace =
store.get<ESM::Race>().find (MWBase::Environment::get().getWorld()->getPlayer().getRace());
MyGUI::Widget* raceWidget;
getWidget(raceWidget, "RaceText");
ToolTips::createRaceToolTip(raceWidget, playerRace);
@ -464,8 +470,8 @@ void StatsWindow::updateSkillArea()
text += std::string("\n\n#DDC79E#{sNextRank} ") + faction->mRanks[it->second+1];
ESM::RankData rankData = faction->mData.mRankData[it->second+1];
const ESM::Attribute* attr1 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->mData.mAttribute1);
const ESM::Attribute* attr2 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->mData.mAttribute2);
const ESM::Attribute* attr1 = store.get<ESM::Attribute>().find(faction->mData.mAttribute1);
const ESM::Attribute* attr2 = store.get<ESM::Attribute>().find(faction->mData.mAttribute2);
assert(attr1 && attr2);
text += "\n#BF9959#{" + attr1->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute1)

@ -179,7 +179,9 @@ void ToolTips::onFrame(float frameDuration)
else if (type == "Spell")
{
ToolTipInfo info;
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.find(focus->getUserString("Spell"));
const ESM::Spell *spell =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(focus->getUserString("Spell"));
info.caption = spell->mName;
Widgets::SpellEffectList effects;
std::vector<ESM::ENAMstruct>::const_iterator end = spell->mEffects.mList.end();
@ -368,7 +370,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
if (info.enchant != "")
{
enchant = store.enchants.search(info.enchant);
enchant = store.get<ESM::Enchantment>().find(info.enchant);
if (enchant->mData.mType == ESM::Enchantment::CastOnce)
text += "\n#{sItemCastOnce}";
else if (enchant->mData.mType == ESM::Enchantment::WhenStrikes)
@ -571,10 +573,15 @@ void ToolTips::createSkillToolTip(MyGUI::Widget* widget, int skillId)
if (skillId == -1)
return;
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId);
const ESM::Skill* skill = store.get<ESM::Skill>().find(skillId);
assert(skill);
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute);
const ESM::Attribute* attr =
store.get<ESM::Attribute>().find(skill->mData.mAttribute);
assert(attr);
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
@ -607,12 +614,14 @@ void ToolTips::createSpecializationToolTip(MyGUI::Widget* widget, const std::str
widget->setUserString("Caption_CenteredCaption", name);
std::string specText;
// get all skills of this specialisation
std::map<int, ESM::Skill> skills = MWBase::Environment::get().getWorld()->getStore().skills.list;
for (std::map<int, ESM::Skill>::const_iterator it = skills.begin();
it != skills.end(); ++it)
const MWWorld::Store<ESM::Skill> &skills =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>();
MWWorld::Store<ESM::Skill>::iterator it = skills.begin();
for (; it != skills.end(); ++it)
{
if (it->second.mData.mSpecialization == specId)
specText += std::string("\n#{") + ESM::Skill::sSkillNameIds[it->second.mIndex] + "}";
if (it->mData.mSpecialization == specId)
specText += std::string("\n#{") + ESM::Skill::sSkillNameIds[it->mIndex] + "}";
}
widget->setUserString("Caption_CenteredCaptionText", specText);
widget->setUserString("ToolTipLayout", "TextWithCenteredCaptionToolTip");
@ -621,7 +630,10 @@ void ToolTips::createSpecializationToolTip(MyGUI::Widget* widget, const std::str
void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string& birthsignId)
{
const ESM::BirthSign *sign = MWBase::Environment::get().getWorld()->getStore().birthSigns.find(birthsignId);
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
const ESM::BirthSign *sign = store.get<ESM::BirthSign>().find(birthsignId);
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
@ -640,7 +652,7 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
for (; it != end; ++it)
{
const std::string &spellId = *it;
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.search(spellId);
const ESM::Spell *spell = store.get<ESM::Spell>().search(spellId);
if (!spell)
continue; // Skip spells which cannot be found
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->mData.mType);
@ -655,7 +667,11 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
spells.push_back(spellId);
}
struct{ const std::vector<std::string> &spells; std::string label; } categories[3] = {
struct {
const std::vector<std::string> &spells;
std::string label;
}
categories[3] = {
{abilities, "sBirthsignmenu1"},
{powers, "sPowers"},
{spells, "sBirthsignmenu2"}
@ -672,7 +688,7 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
const std::string &spellId = *it;
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.search(spellId);
const ESM::Spell *spell = store.get<ESM::Spell>().find(spellId);
text += "\n#BF9959" + spell->mName;
}
}
@ -711,7 +727,8 @@ void ToolTips::createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playe
void ToolTips::createMagicEffectToolTip(MyGUI::Widget* widget, short id)
{
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld ()->getStore ().magicEffects.find(id);
const ESM::MagicEffect* effect =
MWBase::Environment::get().getWorld ()->getStore ().get<ESM::MagicEffect>().find(id);
const std::string &name = ESM::MagicEffect::effectIdToString (id);
std::string icon = effect->mIcon;

@ -107,10 +107,14 @@ namespace MWGui
bool goldFound = false;
MWWorld::Ptr gold;
MWWorld::ContainerStore& playerStore = mWindowManager.getInventoryWindow()->getContainerStore();
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
for (MWWorld::ContainerStoreIterator it = playerStore.begin();
it != playerStore.end(); ++it)
{
if (MWWorld::Class::get(*it).getName(*it) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
if (MWWorld::Class::get(*it).getName(*it) == gmst.find("sGold")->getString())
{
goldFound = true;
gold = *it;

@ -113,8 +113,11 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
/// \todo mercantile skill
int price = pcStats.getSkill (skillId).getBase() * MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find("iTrainingMod")->getInt ();
int price = pcStats.getSkill (skillId).getBase() * store.get<ESM::GameSetting>().find("iTrainingMod")->getInt ();
if (mWindowManager.getInventoryWindow()->getPlayerGold()<price)
return;
@ -128,8 +131,9 @@ namespace MWGui
// increase skill
MWWorld::LiveCellRef<ESM::NPC> *playerRef = player.get<ESM::NPC>();
const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find (
playerRef->mBase->mClass);
const ESM::Class *class_ =
store.get<ESM::Class>().find(playerRef->mBase->mClass);
pcStats.increaseSkill (skillId, *class_, true);
// remove gold

@ -54,16 +54,19 @@ namespace MWGui
{
int price = 0;
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
if(interior)
{
price = MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fMagesGuildTravel")->getFloat();
price = gmst.find("fMagesGuildTravel")->getFloat();
}
else
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
ESM::Position PlayerPos = player.getRefData().getPosition();
float d = sqrt( pow(pos.pos[0] - PlayerPos.pos[0],2) + pow(pos.pos[1] - PlayerPos.pos[1],2) + pow(pos.pos[2] - PlayerPos.pos[2],2) );
price = d/MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fTravelMult")->getFloat();
price = d/gmst.find("fTravelMult")->getFloat();
}
MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>((price>mWindowManager.getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SandTextButton", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
@ -142,7 +145,7 @@ namespace MWGui
cell = MWBase::Environment::get().getWorld()->getExterior(x,y);
ESM::Position PlayerPos = player.getRefData().getPosition();
float d = sqrt( pow(pos.pos[0] - PlayerPos.pos[0],2) + pow(pos.pos[1] - PlayerPos.pos[1],2) + pow(pos.pos[2] - PlayerPos.pos[2],2) );
int time = int(d /MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fTravelTimeMult")->getFloat());
int time = int(d /MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fTravelTimeMult")->getFloat());
for(int i = 0;i < time;i++)
{
MWBase::Environment::get().getMechanicsManager ()->restoreDynamicStats ();

@ -554,7 +554,9 @@ int WindowManager::readPressedButton ()
std::string WindowManager::getGameSettingString(const std::string &id, const std::string &default_)
{
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.search(id);
const ESM::GameSetting *setting =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().search(id);
if (setting && setting->mType == ESM::VT_String)
return setting->getString();
return default_;
@ -614,7 +616,8 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
}
else
{
const ESM::Region* region = MWBase::Environment::get().getWorld()->getStore().regions.search(cell->mCell->mRegion);
const ESM::Region* region =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().search(cell->mCell->mRegion);
if (region)
name = region->mName;
else
@ -717,7 +720,9 @@ void WindowManager::setDragDrop(bool dragDrop)
void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result)
{
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.find(_tag);
const ESM::GameSetting *setting =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(_tag);
if (setting && setting->mType == ESM::VT_String)
_result = setting->getString();
else
@ -808,7 +813,10 @@ void WindowManager::removeGuiMode(GuiMode mode)
void WindowManager::setSelectedSpell(const std::string& spellId, int successChancePercent)
{
mHud->setSelectedSpell(spellId, 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);
mSpellWindow->setTitle(spell->mName);
}

Loading…
Cancel
Save