From 085e5d198872e4f770716cd02bc15a5e6b863d8c Mon Sep 17 00:00:00 2001 From: Aussiemon Date: Sat, 19 Apr 2025 22:31:58 -0600 Subject: [PATCH 1/2] Calculate spell cost when building buying window --- apps/openmw/mwgui/spellbuyingwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/spellbuyingwindow.cpp b/apps/openmw/mwgui/spellbuyingwindow.cpp index 9fca86caba..778949d906 100644 --- a/apps/openmw/mwgui/spellbuyingwindow.cpp +++ b/apps/openmw/mwgui/spellbuyingwindow.cpp @@ -19,6 +19,7 @@ #include "../mwmechanics/actorutil.hpp" #include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/spells.hpp" +#include "../mwmechanics/spellutil.hpp" namespace MWGui { @@ -44,7 +45,7 @@ namespace MWGui int price = std::max(1, static_cast( - spell.mData.mCost * store.get().find("fSpellValueMult")->mValue.getFloat())); + MWMechanics::calcSpellCost(spell) * store.get().find("fSpellValueMult")->mValue.getFloat())); price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, price, true); MWWorld::Ptr player = MWMechanics::getPlayer(); From 22c01b22c1482b8a7fd10950d1f58e9d59c8b636 Mon Sep 17 00:00:00 2001 From: Aussiemon Date: Sat, 19 Apr 2025 23:06:30 -0600 Subject: [PATCH 2/2] Clang format --- apps/openmw/mwgui/spellbuyingwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/spellbuyingwindow.cpp b/apps/openmw/mwgui/spellbuyingwindow.cpp index 778949d906..d77fff88d2 100644 --- a/apps/openmw/mwgui/spellbuyingwindow.cpp +++ b/apps/openmw/mwgui/spellbuyingwindow.cpp @@ -44,8 +44,8 @@ namespace MWGui const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore(); int price = std::max(1, - static_cast( - MWMechanics::calcSpellCost(spell) * store.get().find("fSpellValueMult")->mValue.getFloat())); + static_cast(MWMechanics::calcSpellCost(spell) + * store.get().find("fSpellValueMult")->mValue.getFloat())); price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, price, true); MWWorld::Ptr player = MWMechanics::getPlayer();