mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 09:23:53 +00:00
Merged pull request #1951
This commit is contained in:
commit
503352e840
1 changed files with 16 additions and 19 deletions
|
@ -254,6 +254,8 @@ namespace MWGui
|
||||||
MyGUI::Gui::getInstance().destroyWidget(mSelected->button->getChildAt(0));
|
MyGUI::Gui::getInstance().destroyWidget(mSelected->button->getChildAt(0));
|
||||||
|
|
||||||
mSelected->type = Type_MagicItem;
|
mSelected->type = Type_MagicItem;
|
||||||
|
mSelected->id = item.getCellRef().getRefId();
|
||||||
|
mSelected->name = item.getClass().getName(item);
|
||||||
|
|
||||||
mSelected->button->setFrame("textures\\menu_icon_select_magic_magic.dds", MyGUI::IntCoord(2, 2, 40, 40));
|
mSelected->button->setFrame("textures\\menu_icon_select_magic_magic.dds", MyGUI::IntCoord(2, 2, 40, 40));
|
||||||
mSelected->button->setIcon(item);
|
mSelected->button->setIcon(item);
|
||||||
|
@ -271,20 +273,19 @@ namespace MWGui
|
||||||
while (mSelected->button->getChildCount()) // Destroy number label
|
while (mSelected->button->getChildCount()) // Destroy number label
|
||||||
MyGUI::Gui::getInstance().destroyWidget(mSelected->button->getChildAt(0));
|
MyGUI::Gui::getInstance().destroyWidget(mSelected->button->getChildAt(0));
|
||||||
|
|
||||||
|
const MWWorld::ESMStore &esmStore = MWBase::Environment::get().getWorld()->getStore();
|
||||||
|
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(spellId);
|
||||||
|
|
||||||
mSelected->type = Type_Magic;
|
mSelected->type = Type_Magic;
|
||||||
mSelected->id = spellId;
|
mSelected->id = spellId;
|
||||||
|
mSelected->name = spell->mName;
|
||||||
|
|
||||||
mSelected->button->setItem(MWWorld::Ptr());
|
mSelected->button->setItem(MWWorld::Ptr());
|
||||||
mSelected->button->setUserString("ToolTipType", "Spell");
|
mSelected->button->setUserString("ToolTipType", "Spell");
|
||||||
mSelected->button->setUserString("Spell", spellId);
|
mSelected->button->setUserString("Spell", spellId);
|
||||||
|
|
||||||
const MWWorld::ESMStore &esmStore = MWBase::Environment::get().getWorld()->getStore();
|
|
||||||
|
|
||||||
// use the icon of the first effect
|
// use the icon of the first effect
|
||||||
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(spellId);
|
const ESM::MagicEffect* effect = esmStore.get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mEffectID);
|
||||||
|
|
||||||
const ESM::MagicEffect* effect =
|
|
||||||
esmStore.get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mEffectID);
|
|
||||||
|
|
||||||
std::string path = effect->mIcon;
|
std::string path = effect->mIcon;
|
||||||
int slashPos = path.rfind('\\');
|
int slashPos = path.rfind('\\');
|
||||||
|
@ -423,9 +424,7 @@ namespace MWGui
|
||||||
|
|
||||||
if (!spells.hasSpell(spellId))
|
if (!spells.hasSpell(spellId))
|
||||||
{
|
{
|
||||||
const ESM::Spell* spell =
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sQuickMenu5} " + key->name);
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
|
||||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sQuickMenu5} " + spell->mName);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,28 +546,26 @@ namespace MWGui
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mSelected = &mKey[i];
|
mSelected = &mKey[i];
|
||||||
mSelected->type = (QuickKeysMenu::QuickKeyType) it->mType;
|
|
||||||
mSelected->id = it->mId;
|
|
||||||
|
|
||||||
switch (mSelected->type)
|
switch (it->mType)
|
||||||
{
|
{
|
||||||
case Type_Magic:
|
case Type_Magic:
|
||||||
if (MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(mSelected->id))
|
if (MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(it->mId))
|
||||||
onAssignMagic(mSelected->id);
|
onAssignMagic(it->mId);
|
||||||
break;
|
break;
|
||||||
case Type_Item:
|
case Type_Item:
|
||||||
case Type_MagicItem:
|
case Type_MagicItem:
|
||||||
{
|
{
|
||||||
// Find the item by id
|
// Find the item by id
|
||||||
MWWorld::Ptr item = store.findReplacement(mSelected->id);
|
MWWorld::Ptr item = store.findReplacement(it->mId);
|
||||||
|
|
||||||
if (item.isEmpty())
|
if (item.isEmpty())
|
||||||
unassign(&mKey[i]);
|
unassign(mSelected);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mSelected->type == Type_Item)
|
if (it->mType == Type_Item)
|
||||||
onAssignItem(item);
|
onAssignItem(item);
|
||||||
else if (mSelected->type == Type_MagicItem)
|
else // if (it->mType == Type_MagicItem)
|
||||||
onAssignMagicItem(item);
|
onAssignMagicItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +573,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
case Type_Unassigned:
|
case Type_Unassigned:
|
||||||
case Type_HandToHand:
|
case Type_HandToHand:
|
||||||
unassign(&mKey[i]);
|
unassign(mSelected);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue