Spellpower list is now fetched from the ESM store.

This commit is contained in:
Jan Borsodi 2010-09-14 14:30:12 +02:00
parent 8f6d24bea4
commit cb98bd1a79

View file

@ -215,26 +215,29 @@ void RaceDialog::updateSpellPowers()
} }
spellPowerItems.clear(); spellPowerItems.clear();
MyGUI::StaticTextPtr spellPowerName; if (currentRace.empty())
return;
MyGUI::StaticTextPtr spellPowerWidget;
const int lineHeight = 18; const int lineHeight = 18;
MyGUI::IntCoord coord(0, 0, spellPowerList->getWidth(), 18); MyGUI::IntCoord coord(0, 0, spellPowerList->getWidth(), 18);
const char *inputList[] = { ESMS::ESMStore &store = environment.mWorld->getStore();
"Depth Perception", const ESM::Race *race = store.races.find(currentRace);
"Resist Fire",
"Ancestor Guardian",
0
};
for (int i = 0; inputList[i]; ++i) std::vector<std::string>::const_iterator it = race->powers.list.begin();
std::vector<std::string>::const_iterator end = race->powers.list.end();
for (int i = 0; it != end; ++it)
{ {
std::ostringstream name; const std::string &spellpower = *it;
name << std::string("SpellPowerName") << i; const ESM::Spell *spell = store.spells.find(spellpower);
spellPowerName = spellPowerList->createWidget<MyGUI::StaticText>("SandText", coord, MyGUI::Align::Default, name.str()); assert(spell);
spellPowerName->setCaption(inputList[i]); spellPowerWidget = spellPowerList->createWidget<MyGUI::StaticText>("SandText", coord, MyGUI::Align::Default, std::string("SpellPowerName") + boost::lexical_cast<std::string>(i));
spellPowerWidget->setCaption(spell->name);
spellPowerItems.push_back(spellPowerName); spellPowerItems.push_back(spellPowerWidget);
coord.top += lineHeight; coord.top += lineHeight;
++i;
} }
} }