summaryrefslogtreecommitdiffstats
path: root/source/Entities/Player.cpp
diff options
context:
space:
mode:
authorDaniel O'Brien <marmot.daniel@gmail.com>2013-11-14 15:46:41 +0100
committerDaniel O'Brien <marmot.daniel@gmail.com>2013-11-14 15:46:41 +0100
commitea778c70278aa4032565c1c7a450f345a38c1105 (patch)
tree47168bfb3c2069e09ab5209d602bb79c9ad05b40 /source/Entities/Player.cpp
parentMerge pull request #344 from marmot21/playerxp (diff)
downloadcuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar
cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar.gz
cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar.bz2
cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar.lz
cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar.xz
cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.tar.zst
cuberite-ea778c70278aa4032565c1c7a450f345a38c1105.zip
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);
}