Merge branch 'theimpossibletrap' into 'master'

Don't use ESM::Spell::mData::mCost directly

See merge request OpenMW/openmw!4854
This commit is contained in:
psi29a 2025-08-18 19:26:33 +00:00
commit 792e494335
3 changed files with 4 additions and 4 deletions

View File

@ -78,7 +78,7 @@ namespace MWGui
toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel);
toAdd->setUserString("ToolTipType", "Spell");
toAdd->setUserString("Spell", spell.mId.serialize());
toAdd->setUserString("SpellCost", std::to_string(spell.mData.mCost));
toAdd->setUserString("SpellCost", "true");
toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onSpellButtonClick);
mSpellsWidgetMap.insert(std::make_pair(toAdd, spell.mId));
if (price <= playerGold)

View File

@ -248,8 +248,7 @@ namespace MWGui
info.text = "#{sSchool}: " + MyGUI::TextIterator::toTagsString(school->mName).asUTF8();
}
}
auto cost = focus->getUserString("SpellCost");
if (!cost.empty() && cost != "0")
if (focus->getUserString("SpellCost") == "true")
info.text
+= MWGui::ToolTips::getValueString(MWMechanics::calcSpellCost(*spell), "#{sCastCost}");
info.effects = std::move(effects);

View File

@ -11,6 +11,7 @@
#include "../mwbase/world.hpp"
#include "creaturestats.hpp"
#include "spellutil.hpp"
namespace MWMechanics
{
@ -89,7 +90,7 @@ namespace MWMechanics
const ESM::Spell* trapSpell
= MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(trap.getCellRef().getTrap());
int trapSpellPoints = trapSpell->mData.mCost;
int trapSpellPoints = MWMechanics::calcSpellCost(*trapSpell);
float fTrapCostMult = MWBase::Environment::get()
.getESMStore()