Fix invalid cast exception in the spell creation dialog

actorid
scrawl 12 years ago
parent 599207a92d
commit 0223df4dfc

@ -454,10 +454,13 @@ namespace MWGui
mAvailableEffectsList->clear ();
int i=0;
for (std::vector<short>::const_iterator it = knownEffects.begin(); it != knownEffects.end(); ++it)
{
mAvailableEffectsList->addItem(MWBase::Environment::get().getWorld ()->getStore ().get<ESM::GameSetting>().find(
ESM::MagicEffect::effectIdToString (*it))->getString());
mButtonMapping[i] = *it;
++i;
}
mAvailableEffectsList->adjustSize ();
@ -466,7 +469,6 @@ namespace MWGui
std::string name = MWBase::Environment::get().getWorld ()->getStore ().get<ESM::GameSetting>().find(
ESM::MagicEffect::effectIdToString (*it))->getString();
MyGUI::Widget* w = mAvailableEffectsList->getItemWidget(name);
w->setUserData(*it);
ToolTips::createMagicEffectToolTip (w, *it);
}
@ -518,7 +520,8 @@ namespace MWGui
return;
}
short effectId = *sender->getUserData<short>();
int buttonId = *sender->getUserData<int>();
short effectId = mButtonMapping[buttonId];
for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
{

@ -88,6 +88,8 @@ namespace MWGui
protected:
std::map<int, short> mButtonMapping; // maps button ID to effect ID
Widgets::MWList* mAvailableEffectsList;
MyGUI::ScrollView* mUsedEffectsView;

Loading…
Cancel
Save