forked from teamnwah/openmw-tes3coop
Fix invalid cast exception in the spell creation dialog
This commit is contained in:
parent
599207a92d
commit
0223df4dfc
2 changed files with 7 additions and 2 deletions
|
@ -454,10 +454,13 @@ namespace MWGui
|
||||||
|
|
||||||
mAvailableEffectsList->clear ();
|
mAvailableEffectsList->clear ();
|
||||||
|
|
||||||
|
int i=0;
|
||||||
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 ().get<ESM::GameSetting>().find(
|
mAvailableEffectsList->addItem(MWBase::Environment::get().getWorld ()->getStore ().get<ESM::GameSetting>().find(
|
||||||
ESM::MagicEffect::effectIdToString (*it))->getString());
|
ESM::MagicEffect::effectIdToString (*it))->getString());
|
||||||
|
mButtonMapping[i] = *it;
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
mAvailableEffectsList->adjustSize ();
|
mAvailableEffectsList->adjustSize ();
|
||||||
|
|
||||||
|
@ -466,7 +469,6 @@ namespace MWGui
|
||||||
std::string name = MWBase::Environment::get().getWorld ()->getStore ().get<ESM::GameSetting>().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);
|
|
||||||
|
|
||||||
ToolTips::createMagicEffectToolTip (w, *it);
|
ToolTips::createMagicEffectToolTip (w, *it);
|
||||||
}
|
}
|
||||||
|
@ -518,7 +520,8 @@ namespace MWGui
|
||||||
return;
|
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)
|
for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,6 +88,8 @@ namespace MWGui
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
std::map<int, short> mButtonMapping; // maps button ID to effect ID
|
||||||
|
|
||||||
Widgets::MWList* mAvailableEffectsList;
|
Widgets::MWList* mAvailableEffectsList;
|
||||||
MyGUI::ScrollView* mUsedEffectsView;
|
MyGUI::ScrollView* mUsedEffectsView;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue