diff --git a/Source/player.cpp b/Source/player.cpp index a93bf67bc..5afd23f1d 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -2553,14 +2553,12 @@ void CreatePlayer(int playerId, HeroClass c) int CalcStatDiff(PlayerStruct &player) { - return player.GetMaximumAttributeValue(CharacterAttribute::Strength) - - player._pBaseStr - + player.GetMaximumAttributeValue(CharacterAttribute::Magic) - - player._pBaseMag - + player.GetMaximumAttributeValue(CharacterAttribute::Dexterity) - - player._pBaseDex - + player.GetMaximumAttributeValue(CharacterAttribute::Vitality) - - player._pBaseVit; + int diff = 0; + for (auto attribute : enum_values()) { + diff += player.GetMaximumAttributeValue(attribute); + diff -= player.GetBaseAttributeValue(attribute); + } + return diff; } void NextPlrLevel(int pnum)