summaryrefslogtreecommitdiffstats
path: root/source/Entities
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/Entities/Player.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp
index 098417dc5..f5c28b326 100644
--- a/source/Entities/Player.cpp
+++ b/source/Entities/Player.cpp
@@ -318,8 +318,10 @@ int cPlayer::XpGetLevel()
float cPlayer::XpGetPercentage()
{
int currentLevel = CalcLevelFromXp(m_XpTotal);
+ int currentLevel_XpBase = XpForLevel(currentLevel);
- return (float)m_XpTotal / (float)XpForLevel(1+currentLevel);
+ return (float)(m_XpTotal - currentLevel_XpBase) /
+ (float)(XpForLevel(1+currentLevel) - currentLevel_XpBase);
}