applying new interface vol.6, inconsistent

actorid
greye 12 years ago
parent 42aae566a7
commit 4637503680

@ -130,19 +130,18 @@ void BirthDialog::updateBirths()
{
mBirthList->removeAllItems();
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::Store<ESM::BirthSign> &signs =
MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>();
MWWorld::RecListT<ESM::BirthSign>::MapType::const_iterator it = store.birthSigns.list.begin();
MWWorld::RecListT<ESM::BirthSign>::MapType::const_iterator end = store.birthSigns.list.end();
int index = 0;
// sort by name
std::vector < std::pair<std::string, const ESM::BirthSign*> > birthSigns;
for (; it!=end; ++it)
MWWorld::Store<ESM::BirthSign>::iterator it = signs.begin();
for (; it != signs.end(); ++it)
{
std::string id = it->first;
const ESM::BirthSign* sign = &it->second;
birthSigns.push_back(std::make_pair(id, sign));
birthSigns.push_back(std::make_pair(it->mId, &(*it)));
}
std::sort(birthSigns.begin(), birthSigns.end(), sortBirthSigns);
@ -170,8 +169,11 @@ void BirthDialog::updateSpells()
const int lineHeight = 18;
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18);
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::BirthSign *birth = store.birthSigns.find(mCurrentBirthId);
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
const ESM::BirthSign *birth =
store.get<ESM::BirthSign>().find(mCurrentBirthId);
std::string texturePath = std::string("textures\\") + birth->mTexture;
fixTexturePath(texturePath);
@ -200,11 +202,17 @@ void BirthDialog::updateSpells()
}
int i = 0;
struct{ const std::vector<std::string> &spells; const char *label; } categories[3] = {
struct {
const std::vector<std::string> &spells;
const char *label;
}
categories[3] = {
{abilities, "sBirthsignmenu1"},
{powers, "sPowers"},
{spells, "sBirthsignmenu2"}
};
for (int category = 0; category < 3; ++category)
{
if (!categories[category].spells.empty())

@ -357,7 +357,9 @@ void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
const std::string &classId = mPickClassDialog->getClassId();
if (!classId.empty())
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
const ESM::Class *klass = MWBase::Environment::get().getWorld()->getStore().classes.find(classId);
const ESM::Class *klass =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(classId);
if (klass)
{
mPlayerClass = *klass;
@ -729,7 +731,10 @@ void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
mGenerateClassResultDialog = 0;
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
const ESM::Class *klass = MWBase::Environment::get().getWorld()->getStore().classes.find(mGenerateClass);
const ESM::Class *klass =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(mGenerateClass);
mPlayerClass = *klass;
mWM->setPlayerClass(mPlayerClass);

@ -92,10 +92,10 @@ namespace MWGui
scanner.listKeywords (mNames);
// identifier
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store =
MWBase::Environment::get().getWorld()->getStore();
for (MWWorld::RecListList::const_iterator iter (store.recLists.begin());
iter!=store.recLists.end(); ++iter)
for (MWWorld::ESMStore::iterator it = store.begin(); it != store.end(); ++it)
{
iter->second->listIdentifier (mNames);
}

@ -127,33 +127,36 @@ void DialogueWindow::onSelectTopic(std::string topic)
{
if (!mEnabled) return;
if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sBarter")->getString())
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
if (topic == gmst.find("sBarter")->getString())
{
/// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)?
mWindowManager.pushGuiMode(GM_Barter);
mWindowManager.getTradeWindow()->startTrade(mPtr);
}
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpells")->getString())
else if (topic == gmst.find("sSpells")->getString())
{
mWindowManager.pushGuiMode(GM_SpellBuying);
mWindowManager.getSpellBuyingWindow()->startSpellBuying(mPtr);
}
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sTravel")->getString())
else if (topic == gmst.find("sTravel")->getString())
{
mWindowManager.pushGuiMode(GM_Travel);
mWindowManager.getTravelWindow()->startTravel(mPtr);
}
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpellMakingMenuTitle")->getString())
else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
{
mWindowManager.pushGuiMode(GM_SpellCreation);
mWindowManager.startSpellMaking (mPtr);
}
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sEnchanting")->getString())
else if (topic == gmst.find("sEnchanting")->getString())
{
mWindowManager.pushGuiMode(GM_Enchanting);
mWindowManager.startEnchanting (mPtr);
}
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sServiceTrainingTitle")->getString())
else if (topic == gmst.find("sServiceTrainingTitle")->getString())
{
mWindowManager.pushGuiMode(GM_Training);
mWindowManager.startTraining (mPtr);
@ -180,23 +183,26 @@ void DialogueWindow::setKeywords(std::list<std::string> keyWords)
bool anyService = mServices > 0;
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
if (mServices & Service_Trade)
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sBarter")->getString());
mTopicsList->addItem(gmst.find("sBarter")->getString());
if (mServices & Service_BuySpells)
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpells")->getString());
mTopicsList->addItem(gmst.find("sSpells")->getString());
if (mServices & Service_Travel)
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sTravel")->getString());
mTopicsList->addItem(gmst.find("sTravel")->getString());
if (mServices & Service_CreateSpells)
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpellmakingMenuTitle")->getString());
mTopicsList->addItem(gmst.find("sSpellmakingMenuTitle")->getString());
// if (mServices & Service_Enchant)
// mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sEnchanting")->getString());
// mTopicsList->addItem(gmst.find("sEnchanting")->getString());
if (mServices & Service_Training)
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sServiceTrainingTitle")->getString());
mTopicsList->addItem(gmst.find("sServiceTrainingTitle")->getString());
if (anyService)
mTopicsList->addSeparator();
@ -301,7 +307,7 @@ void DialogueWindow::updateOptions()
void DialogueWindow::goodbye()
{
mHistory->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGoodbye")->getString());
mHistory->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sGoodbye")->getString());
mTopicsList->setEnabled(false);
mEnabled = false;
}

@ -224,20 +224,20 @@ void RaceDialog::updateRaces()
{
mRaceList->removeAllItems();
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::Store<ESM::Race> &races =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>();
MWWorld::RecListT<ESM::Race>::MapType::const_iterator it = store.races.list.begin();
MWWorld::RecListT<ESM::Race>::MapType::const_iterator end = store.races.list.end();
int index = 0;
for (; it != end; ++it)
MWWorld::Store<ESM::Race>::iterator it = races.begin()
for (; it != races.end(); ++it)
{
const ESM::Race &race = it->second;
bool playable = race.mData.mFlags & ESM::Race::Playable;
bool playable = it->mData.mFlags & ESM::Race::Playable;
if (!playable) // Only display playable races
continue;
mRaceList->addItem(race.mName, it->first);
if (boost::iequals(it->first, mCurrentRaceId))
mRaceList->addItem(it->mName, it->mId);
if (boost::iequals(it->mId, mCurrentRaceId))
mRaceList->setIndexSelected(index);
++index;
}
@ -259,7 +259,7 @@ void RaceDialog::updateSkills()
MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18);
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(mCurrentRaceId);
const ESM::Race *race = store.get<ESM::Race>().find(mCurrentRaceId);
int count = sizeof(race->mData.mBonus)/sizeof(race->mData.mBonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
for (int i = 0; i < count; ++i)
{
@ -297,7 +297,7 @@ void RaceDialog::updateSpellPowers()
MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18);
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(mCurrentRaceId);
const ESM::Race *race = store.get<ESM::Race>().find(mCurrentRaceId);
std::vector<std::string>::const_iterator it = race->mPowers.mList.begin();
std::vector<std::string>::const_iterator end = race->mPowers.mList.end();

@ -108,7 +108,9 @@ void ReviewDialog::setPlayerName(const std::string &name)
void ReviewDialog::setRace(const std::string &raceId)
{
mRaceId = raceId;
const ESM::Race *race = MWBase::Environment::get().getWorld()->getStore().races.search(mRaceId);
const ESM::Race *race =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().search(mRaceId);
if (race)
{
ToolTips::createRaceToolTip(mRaceWidget, race);
@ -126,7 +128,9 @@ void ReviewDialog::setClass(const ESM::Class& class_)
void ReviewDialog::setBirthSign(const std::string& signId)
{
mBirthSignId = signId;
const ESM::BirthSign *sign = MWBase::Environment::get().getWorld()->getStore().birthSigns.search(mBirthSignId);
const ESM::BirthSign *sign =
MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().search(mBirthSignId);
if (sign)
{
mBirthSignWidget->setCaption(sign->mName);

@ -49,8 +49,12 @@ namespace MWGui
void SpellBuyingWindow::addSpell(const std::string& spellId)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
int price = spell->mData.mCost*MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fSpellValueMult")->getFloat();
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
const ESM::Spell* spell = store.get<ESM::Spell>().find(spellId);
int price = spell->mData.mCost*store.get<ESM::GameSetting>().find("fSpellValueMult")->getFloat();
MyGUI::Button* toAdd =
mSpellsView->createWidget<MyGUI::Button>(
@ -97,7 +101,8 @@ namespace MWGui
for (MWMechanics::Spells::TIterator iter = merchantSpells.begin(); iter!=merchantSpells.end(); ++iter)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find (*iter);
const ESM::Spell* spell =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find (*iter);
if (spell->mData.mType!=ESM::Spell::ST_Spell)
continue; // don't try to sell diseases, curses or powers

@ -228,8 +228,10 @@ void MWSpell::setSpellId(const std::string &spellId)
void MWSpell::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord, int flags)
{
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Spell *spell = store.spells.search(mId);
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
const ESM::Spell *spell = store.get<ESM::Spell>().search(mId);
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
MWSpellEffectPtr effect = nullptr;
@ -259,8 +261,10 @@ void MWSpell::updateWidgets()
{
if (mSpellNameWidget && mWindowManager)
{
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Spell *spell = store.spells.search(mId);
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
const ESM::Spell *spell = store.get<ESM::Spell>().search(mId);
if (spell)
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->mName);
else
@ -389,8 +393,11 @@ void MWSpellEffect::updateWidgets()
if (!mWindowManager)
return;
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::MagicEffect *magicEffect = store.magicEffects.search(mEffectParams.mEffectID);
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
const ESM::MagicEffect *magicEffect =
store.get<ESM::MagicEffect>().search(mEffectParams.mEffectID);
assert(magicEffect);
assert(mWindowManager);

@ -68,6 +68,17 @@ namespace MWWorld
std::map<int, StoreBase *> mStores;
public:
/// \todo replace with SharedIterator<StoreBase>
typedef std::map<int, StoreBase *>::const_iterator iterator;
iterator begin() const {
return mStores.begin();
}
iterator end() const {
return mStores.end();
}
// Look up the given ID in 'all'. Returns 0 if not found.
int find(const std::string &id) const
{

Loading…
Cancel
Save