diff options
author | Mattes D <github@xoft.cz> | 2014-08-11 08:28:31 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-08-11 08:28:31 +0200 |
commit | 06cc5c22eff96fa47228bb8f2416ab2535abcf60 (patch) | |
tree | 0ec1f380753b062ed17af28b2e5911975869d7f1 /src/Entities/Player.cpp | |
parent | Merge pull request #1311 from mc-server/CMakeFix (diff) | |
parent | Fixed tolua error with static initialization (diff) | |
download | cuberite-06cc5c22eff96fa47228bb8f2416ab2535abcf60.tar cuberite-06cc5c22eff96fa47228bb8f2416ab2535abcf60.tar.gz cuberite-06cc5c22eff96fa47228bb8f2416ab2535abcf60.tar.bz2 cuberite-06cc5c22eff96fa47228bb8f2416ab2535abcf60.tar.lz cuberite-06cc5c22eff96fa47228bb8f2416ab2535abcf60.tar.xz cuberite-06cc5c22eff96fa47228bb8f2416ab2535abcf60.tar.zst cuberite-06cc5c22eff96fa47228bb8f2416ab2535abcf60.zip |
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r-- | src/Entities/Player.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 608316e9a..4398a5bf3 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -33,6 +33,15 @@ +const int cPlayer::MAX_HEALTH = 20; + +const int cPlayer::MAX_FOOD_LEVEL = 20; + +/** Number of ticks it takes to eat an item */ +const int cPlayer::EATING_TICKS = 30; + + + cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) : @@ -509,7 +518,7 @@ void cPlayer::Heal(int a_Health) void cPlayer::SetFoodLevel(int a_FoodLevel) { - int FoodLevel = std::max(0, std::min(a_FoodLevel, (int)MAX_FOOD_LEVEL)); + int FoodLevel = Clamp(a_FoodLevel, 0, MAX_FOOD_LEVEL); if (cRoot::Get()->GetPluginManager()->CallHookPlayerFoodLevelChange(*this, FoodLevel)) { |