diff options
author | Daniel O'Brien <marmot.daniel@gmail.com> | 2013-11-13 21:02:53 +0100 |
---|---|---|
committer | Daniel O'Brien <marmot.daniel@gmail.com> | 2013-11-13 21:02:53 +0100 |
commit | 8c6bdca425a70fabaee6d3937685314dcaad04a6 (patch) | |
tree | 84175437c2aba4f4bd5ce0d741e31773114454e7 | |
parent | changed name convention (diff) | |
download | cuberite-8c6bdca425a70fabaee6d3937685314dcaad04a6.tar cuberite-8c6bdca425a70fabaee6d3937685314dcaad04a6.tar.gz cuberite-8c6bdca425a70fabaee6d3937685314dcaad04a6.tar.bz2 cuberite-8c6bdca425a70fabaee6d3937685314dcaad04a6.tar.lz cuberite-8c6bdca425a70fabaee6d3937685314dcaad04a6.tar.xz cuberite-8c6bdca425a70fabaee6d3937685314dcaad04a6.tar.zst cuberite-8c6bdca425a70fabaee6d3937685314dcaad04a6.zip |
-rw-r--r-- | source/Entities/Player.cpp | 10 | ||||
-rw-r--r-- | source/Entities/Player.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp index 470ed428f..88be5de56 100644 --- a/source/Entities/Player.cpp +++ b/source/Entities/Player.cpp @@ -267,7 +267,7 @@ int cPlayer::CalcLevelFromXp(int a_XpTotal) //level 0 to 15 if(a_XpTotal <= XP_TO_LEVEL15) { - return (int) a_XpTotal / XP_PER_LEVEL_TO15; + return a_XpTotal / XP_PER_LEVEL_TO15; } //level 30+ @@ -345,11 +345,11 @@ bool cPlayer::SetExperience(int a_XpTotal) int cPlayer::AddExperience(int a_Xp_delta) { - if(a_Xp_delta > MAX_EXPERIENCE_ORB_SIZE || a_Xp_delta < 0) + if(a_Xp_delta < 0) { - //value was too large or negative, abort and report - LOGWARNING("Attempt was made to increment Xp by %d, max is %d and must be positive", - a_Xp_delta, MAX_EXPERIENCE_ORB_SIZE); + //value was negative, abort and report + LOGWARNING("Attempt was made to increment Xp by %d, must be positive", + a_Xp_delta); return -1; //should we instead just return the current Xp? } diff --git a/source/Entities/Player.h b/source/Entities/Player.h index d998c47bb..3623617f2 100644 --- a/source/Entities/Player.h +++ b/source/Entities/Player.h @@ -70,7 +70,7 @@ public: */ bool SetExperience(int a_XpTotal); - /* Adds Xp, will not inc more than MAX_EXPERIENCE_ORB_SIZE! + /* Adds Xp, "should" not inc more than MAX_EXPERIENCE_ORB_SIZE unless you're a plugin being funny, *cough* cheating Returns the new total experience, -1 on error */ int AddExperience(int a_Xp_delta); |