Merge pull request #1804 from akortunov/guifixes

Show magic items count in spells window (feature #4509)
pull/460/head
Bret Curtis 7 years ago committed by GitHub
commit e7e3dab130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -79,6 +79,7 @@
Feature #4444: Per-group KF-animation files support Feature #4444: Per-group KF-animation files support
Feature #4466: Editor: Add option to ignore "Base" records when running verifier Feature #4466: Editor: Add option to ignore "Base" records when running verifier
Feature #4012: Editor: Write a log file if OpenCS crashes Feature #4012: Editor: Write a log file if OpenCS crashes
Feature #4509: Show count of enchanted items in stack in the spells list
Feature #4512: Editor: Use markers for lights and creatures levelled lists Feature #4512: Editor: Use markers for lights and creatures levelled lists
Task #2490: Don't open command prompt window on Release-mode builds automatically Task #2490: Don't open command prompt window on Release-mode builds automatically

@ -80,6 +80,7 @@ namespace MWGui
newSpell.mSelected = (MWBase::Environment::get().getWindowManager()->getSelectedSpell() == spell->mId); newSpell.mSelected = (MWBase::Environment::get().getWindowManager()->getSelectedSpell() == spell->mId);
newSpell.mActive = true; newSpell.mActive = true;
newSpell.mCount = 1;
mSpells.push_back(newSpell); mSpells.push_back(newSpell);
} }
@ -109,6 +110,7 @@ namespace MWGui
newSpell.mItem = item; newSpell.mItem = item;
newSpell.mId = item.getCellRef().getRefId(); newSpell.mId = item.getCellRef().getRefId();
newSpell.mName = item.getClass().getName(item); newSpell.mName = item.getClass().getName(item);
newSpell.mCount = item.getRefData().getCount();
newSpell.mType = Spell::Type_EnchantedItem; newSpell.mType = Spell::Type_EnchantedItem;
newSpell.mSelected = invStore.getSelectedEnchantItem() == it; newSpell.mSelected = invStore.getSelectedEnchantItem() == it;

@ -20,6 +20,7 @@ namespace MWGui
std::string mCostColumn; // Cost/chance or Cost/charge std::string mCostColumn; // Cost/chance or Cost/charge
std::string mId; // Item ID or spell ID std::string mId; // Item ID or spell ID
MWWorld::Ptr mItem; // Only for Type_EnchantedItem MWWorld::Ptr mItem; // Only for Type_EnchantedItem
int mCount; // Only for Type_EnchantedItem
bool mSelected; // Is this the currently selected spell/item (only one can be selected at a time) bool mSelected; // Is this the currently selected spell/item (only one can be selected at a time)
bool mActive; // (Items only) is the item equipped? bool mActive; // (Items only) is the item equipped?

@ -7,6 +7,8 @@
#include <components/widgets/sharedstatebutton.hpp> #include <components/widgets/sharedstatebutton.hpp>
#include "tooltips.hpp"
namespace MWGui namespace MWGui
{ {
@ -103,11 +105,12 @@ namespace MWGui
} }
const std::string skin = spell.mActive ? "SandTextButton" : "SpellTextUnequipped"; const std::string skin = spell.mActive ? "SandTextButton" : "SpellTextUnequipped";
const std::string captionSuffix = MWGui::ToolTips::getCountString(spell.mCount);
Gui::SharedStateButton* t = mScrollView->createWidget<Gui::SharedStateButton>(skin, Gui::SharedStateButton* t = mScrollView->createWidget<Gui::SharedStateButton>(skin,
MyGUI::IntCoord(0, 0, 0, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top); MyGUI::IntCoord(0, 0, 0, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setNeedKeyFocus(true); t->setNeedKeyFocus(true);
t->setCaption(spell.mName); t->setCaption(spell.mName + captionSuffix);
t->setTextAlign(MyGUI::Align::Left); t->setTextAlign(MyGUI::Align::Left);
adjustSpellWidget(spell, i, t); adjustSpellWidget(spell, i, t);
@ -163,7 +166,8 @@ namespace MWGui
// more checking for major change. // more checking for major change.
const Spell& spell = mModel->getItem(spellIndex); const Spell& spell = mModel->getItem(spellIndex);
if (nameButton->getCaption() != spell.mName) const std::string captionSuffix = MWGui::ToolTips::getCountString(spell.mCount);
if (nameButton->getCaption() != (spell.mName + captionSuffix))
{ {
fullUpdateRequired = true; fullUpdateRequired = true;
break; break;

Loading…
Cancel
Save