diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index 38eb728268..0b8c49cf4d 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -90,22 +90,17 @@ namespace MWWorld void Player::setWerewolfStats() { - const MWWorld::Store& gmst - = MWBase::Environment::get().getESMStore()->get(); + const auto& store = MWBase::Environment::get().getESMStore(); + const MWWorld::Store& gmst = store->get(); MWMechanics::CreatureStats& creatureStats = getPlayer().getClass().getCreatureStats(getPlayer()); MWMechanics::NpcStats& npcStats = getPlayer().getClass().getNpcStats(getPlayer()); MWMechanics::DynamicStat health = creatureStats.getDynamic(0); creatureStats.setHealth(health.getBase() * gmst.find("fWereWolfHealth")->mValue.getFloat()); - for (size_t i = 0; i < ESM::Attribute::Length; ++i) + for (const auto& attribute : store->get()) { - // Oh, Bethesda. It's "Intelligence". - std::string name = "fWerewolf" - + ((i == ESM::Attribute::Intelligence) ? std::string("Intellegence") - : ESM::Attribute::sAttributeNames[i]); - - MWMechanics::AttributeValue value = npcStats.getAttribute(i); - value.setModifier(gmst.find(name)->mValue.getFloat() - value.getModified()); - npcStats.setAttribute(i, value); + MWMechanics::AttributeValue value = npcStats.getAttribute(attribute.mId); + value.setModifier(gmst.find(attribute.mWerewolfGMST)->mValue.getFloat() - value.getModified()); + npcStats.setAttribute(attribute.mId, value); } for (size_t i = 0; i < ESM::Skill::Length; i++) diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index 92d2ff837f..56a8dcb39a 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -951,35 +951,44 @@ namespace MWWorld mStatic.push_back({ .mId = ESM::Attribute::Strength, .mName = "sAttributeStrength", .mDescription = "sStrDesc", - .mIcon = "icons\\k\\attribute_strength.dds" }); + .mIcon = "icons\\k\\attribute_strength.dds", + .mWerewolfGMST = "fWerewolfStrength" }); mStatic.push_back({ .mId = ESM::Attribute::Intelligence, .mName = "sAttributeIntelligence", .mDescription = "sIntDesc", - .mIcon = "icons\\k\\attribute_int.dds" }); + .mIcon = "icons\\k\\attribute_int.dds", + // Oh, Bethesda. It's "Intelligence". + .mWerewolfGMST = "fWerewolfIntellegence" }); mStatic.push_back({ .mId = ESM::Attribute::Willpower, .mName = "sAttributeWillpower", .mDescription = "sWilDesc", - .mIcon = "icons\\k\\attribute_wilpower.dds" }); + .mIcon = "icons\\k\\attribute_wilpower.dds", + .mWerewolfGMST = "fWerewolfWillpower" }); mStatic.push_back({ .mId = ESM::Attribute::Agility, .mName = "sAttributeAgility", .mDescription = "sAgiDesc", - .mIcon = "icons\\k\\attribute_agility.dds" }); + .mIcon = "icons\\k\\attribute_agility.dds", + .mWerewolfGMST = "fWerewolfAgility" }); mStatic.push_back({ .mId = ESM::Attribute::Speed, .mName = "sAttributeSpeed", .mDescription = "sSpdDesc", - .mIcon = "icons\\k\\attribute_speed.dds" }); + .mIcon = "icons\\k\\attribute_speed.dds", + .mWerewolfGMST = "fWerewolfSpeed" }); mStatic.push_back({ .mId = ESM::Attribute::Endurance, .mName = "sAttributeEndurance", .mDescription = "sEndDesc", - .mIcon = "icons\\k\\attribute_endurance.dds" }); + .mIcon = "icons\\k\\attribute_endurance.dds", + .mWerewolfGMST = "fWerewolfEndurance" }); mStatic.push_back({ .mId = ESM::Attribute::Personality, .mName = "sAttributePersonality", .mDescription = "sPerDesc", - .mIcon = "icons\\k\\attribute_personality.dds" }); + .mIcon = "icons\\k\\attribute_personality.dds", + .mWerewolfGMST = "fWerewolfPersonality" }); mStatic.push_back({ .mId = ESM::Attribute::Luck, .mName = "sAttributeLuck", .mDescription = "sLucDesc", - .mIcon = "icons\\k\\attribute_luck.dds" }); + .mIcon = "icons\\k\\attribute_luck.dds", + .mWerewolfGMST = "fWerewolfLuck" }); } size_t Store::getSize() const { diff --git a/components/esm/attr.hpp b/components/esm/attr.hpp index 9c0c4546d0..784042afc8 100644 --- a/components/esm/attr.hpp +++ b/components/esm/attr.hpp @@ -26,7 +26,7 @@ namespace ESM }; AttributeID mId; - std::string mName, mDescription, mIcon; + std::string mName, mDescription, mIcon, mWerewolfGMST; static const std::string sAttributeNames[Length];