diff options
author | STRWarrior <niels.breuker@hotmail.nl> | 2014-08-03 15:32:45 +0200 |
---|---|---|
committer | STRWarrior <niels.breuker@hotmail.nl> | 2014-08-03 15:32:45 +0200 |
commit | a24e960a894384a6161e71ddb0032707ab6bfdc0 (patch) | |
tree | 0700958027fbd2031c0bd54e369f5a02fbbda2a2 /src/Entities/Player.cpp | |
parent | VillageGen: Fixed a typo in comment (diff) | |
parent | Entity.cpp: Air timer comment fix (diff) | |
download | cuberite-a24e960a894384a6161e71ddb0032707ab6bfdc0.tar cuberite-a24e960a894384a6161e71ddb0032707ab6bfdc0.tar.gz cuberite-a24e960a894384a6161e71ddb0032707ab6bfdc0.tar.bz2 cuberite-a24e960a894384a6161e71ddb0032707ab6bfdc0.tar.lz cuberite-a24e960a894384a6161e71ddb0032707ab6bfdc0.tar.xz cuberite-a24e960a894384a6161e71ddb0032707ab6bfdc0.tar.zst cuberite-a24e960a894384a6161e71ddb0032707ab6bfdc0.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Player.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index ca3b1f367..d1d7349a6 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -527,7 +527,7 @@ void cPlayer::SetFoodLevel(int a_FoodLevel) void cPlayer::SetFoodSaturationLevel(double a_FoodSaturationLevel) { - m_FoodSaturationLevel = std::max(0.0, std::min(a_FoodSaturationLevel, (double)m_FoodLevel)); + m_FoodSaturationLevel = Clamp(a_FoodSaturationLevel, 0.0, (double) m_FoodLevel); } @@ -545,7 +545,7 @@ void cPlayer::SetFoodTickTimer(int a_FoodTickTimer) void cPlayer::SetFoodExhaustionLevel(double a_FoodExhaustionLevel) { - m_FoodExhaustionLevel = std::max(0.0, std::min(a_FoodExhaustionLevel, 40.0)); + m_FoodExhaustionLevel = Clamp(a_FoodExhaustionLevel, 0.0, 40.0); } @@ -580,15 +580,6 @@ void cPlayer::AddFoodExhaustion(double a_Exhaustion) -void cPlayer::FoodPoison(int a_NumTicks) -{ - AddEntityEffect(cEntityEffect::effHunger, a_NumTicks, 0, 1); -} - - - - - void cPlayer::StartEating(void) { // Set the timer: @@ -709,16 +700,13 @@ double cPlayer::GetMaxSpeed(void) const { return m_FlyingMaxSpeed; } + else if (m_IsSprinting) + { + return m_SprintingMaxSpeed; + } else { - if (m_IsSprinting) - { - return m_SprintingMaxSpeed; - } - else - { - return m_NormalMaxSpeed; - } + return m_NormalMaxSpeed; } } |