From a556475fae2f1d32dbdc86c49eb465e5b60a49bf Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 13 Mar 2017 02:47:52 +0100 Subject: [PATCH] Explicitely set the user data type to avoid const/non-const mismatch --- apps/openmw/mwgui/alchemywindow.cpp | 6 +++--- apps/openmw/mwgui/enchantingdialog.cpp | 4 ++-- apps/openmw/mwgui/hud.cpp | 4 ++-- apps/openmw/mwgui/itemchargeview.cpp | 2 +- apps/openmw/mwgui/merchantrepair.cpp | 2 +- apps/openmw/mwgui/quickkeysmenu.cpp | 6 +++--- apps/openmw/mwgui/recharge.cpp | 2 +- apps/openmw/mwgui/repair.cpp | 2 +- apps/openmw/mwgui/spellview.cpp | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp index 385010ac5..1d758cccf 100644 --- a/apps/openmw/mwgui/alchemywindow.cpp +++ b/apps/openmw/mwgui/alchemywindow.cpp @@ -122,7 +122,7 @@ namespace MWGui if (!iter->isEmpty()) { mApparatus.at (index)->setUserString ("ToolTipType", "ItemPtr"); - mApparatus.at (index)->setUserData (*iter); + mApparatus.at (index)->setUserData (MWWorld::Ptr(*iter)); } } @@ -190,9 +190,9 @@ namespace MWGui continue; ingredient->setUserString("ToolTipType", "ItemPtr"); - ingredient->setUserData(item); + ingredient->setUserData(MWWorld::Ptr(item)); - ingredient->setCount(ingredient->getUserData()->getRefData().getCount()); + ingredient->setCount(item.getRefData().getCount()); } mItemView->update(); diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index c182a0a52..e22891c9d 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -79,7 +79,7 @@ namespace MWGui { mSoulBox->setItem(gem); mSoulBox->setUserString ("ToolTipType", "ItemPtr"); - mSoulBox->setUserData(gem); + mSoulBox->setUserData(MWWorld::Ptr(gem)); mEnchanting.setSoulGem(gem); } } @@ -97,7 +97,7 @@ namespace MWGui mName->setCaption(item.getClass().getName(item)); mItemBox->setItem(item); mItemBox->setUserString ("ToolTipType", "ItemPtr"); - mItemBox->setUserData(item); + mItemBox->setUserData(MWWorld::Ptr(item)); mEnchanting.setOldItem(item); } } diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index b5c8dc8bb..19e032ff4 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -417,7 +417,7 @@ namespace MWGui mSpellStatus->setProgressPosition(chargePercent); mSpellBox->setUserString("ToolTipType", "ItemPtr"); - mSpellBox->setUserData(item); + mSpellBox->setUserData(MWWorld::Ptr(item)); mSpellImage->setItem(item); } @@ -435,7 +435,7 @@ namespace MWGui mWeapBox->clearUserStrings(); mWeapBox->setUserString("ToolTipType", "ItemPtr"); - mWeapBox->setUserData(item); + mWeapBox->setUserData(MWWorld::Ptr(item)); mWeapStatus->setProgressRange(100); mWeapStatus->setProgressPosition(durabilityPercent); diff --git a/apps/openmw/mwgui/itemchargeview.cpp b/apps/openmw/mwgui/itemchargeview.cpp index 522acca26..3001b9ef2 100644 --- a/apps/openmw/mwgui/itemchargeview.cpp +++ b/apps/openmw/mwgui/itemchargeview.cpp @@ -97,7 +97,7 @@ namespace MWGui line.mIcon = mScrollView->createWidget("MW_ItemIconSmall", MyGUI::IntCoord(), MyGUI::Align::Default); line.mIcon->setItem(line.mItemPtr); line.mIcon->setUserString("ToolTipType", "ItemPtr"); - line.mIcon->setUserData(line.mItemPtr); + line.mIcon->setUserData(MWWorld::Ptr(line.mItemPtr)); line.mIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemChargeView::onIconClicked); line.mIcon->eventMouseWheel += MyGUI::newDelegate(this, &ItemChargeView::onMouseWheelMoved); diff --git a/apps/openmw/mwgui/merchantrepair.cpp b/apps/openmw/mwgui/merchantrepair.cpp index b96873983..c4639d602 100644 --- a/apps/openmw/mwgui/merchantrepair.cpp +++ b/apps/openmw/mwgui/merchantrepair.cpp @@ -86,7 +86,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor) currentY += 18; button->setUserString("Price", MyGUI::utility::toString(price)); - button->setUserData(*iter); + button->setUserData(MWWorld::Ptr(*iter)); button->setCaptionWithReplacing(name); button->setSize(button->getTextSize().width,18); button->eventMouseWheel += MyGUI::newDelegate(this, &MerchantRepair::onMouseWheel); diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp index 061ac9eb6..63cc14d98 100644 --- a/apps/openmw/mwgui/quickkeysmenu.cpp +++ b/apps/openmw/mwgui/quickkeysmenu.cpp @@ -185,7 +185,7 @@ namespace MWGui button->setItem(item, ItemWidget::Barter); button->setUserString ("ToolTipType", "ItemPtr"); - button->setUserData(item); + button->setUserData(MWWorld::Ptr(item)); if (mItemSelectionDialog) mItemSelectionDialog->setVisible(false); @@ -209,7 +209,7 @@ namespace MWGui button->setIcon(item); button->setUserString ("ToolTipType", "ItemPtr"); - button->setUserData(item); + button->setUserData(MWWorld::Ptr(item)); if (mMagicSelectionDialog) mMagicSelectionDialog->setVisible(false); @@ -278,7 +278,7 @@ namespace MWGui if (Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), id)) { item = *it; - button->setUserData(item); + button->setUserData(MWWorld::Ptr(item)); break; } } diff --git a/apps/openmw/mwgui/recharge.cpp b/apps/openmw/mwgui/recharge.cpp index 66d29bd59..990e4468b 100644 --- a/apps/openmw/mwgui/recharge.cpp +++ b/apps/openmw/mwgui/recharge.cpp @@ -68,7 +68,7 @@ void Recharge::start (const MWWorld::Ptr &item) { mGemIcon->setItem(item); mGemIcon->setUserString("ToolTipType", "ItemPtr"); - mGemIcon->setUserData(item); + mGemIcon->setUserData(MWWorld::Ptr(item)); updateView(); } diff --git a/apps/openmw/mwgui/repair.cpp b/apps/openmw/mwgui/repair.cpp index 07fd6520c..15a4a64d7 100644 --- a/apps/openmw/mwgui/repair.cpp +++ b/apps/openmw/mwgui/repair.cpp @@ -66,7 +66,7 @@ void Repair::startRepairItem(const MWWorld::Ptr &item) mToolIcon->setItem(item); mToolIcon->setUserString("ToolTipType", "ItemPtr"); - mToolIcon->setUserData(item); + mToolIcon->setUserData(MWWorld::Ptr(item)); updateRepairView(); } diff --git a/apps/openmw/mwgui/spellview.cpp b/apps/openmw/mwgui/spellview.cpp index 06809bb49..9932cddfa 100644 --- a/apps/openmw/mwgui/spellview.cpp +++ b/apps/openmw/mwgui/spellview.cpp @@ -278,7 +278,7 @@ namespace MWGui { if (spell.mType == Spell::Type_EnchantedItem) { - widget->setUserData(spell.mItem); + widget->setUserData(MWWorld::Ptr(spell.mItem)); widget->setUserString("ToolTipType", "ItemPtr"); } else