summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-07 21:59:45 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-07 21:59:45 +0200
commit3292a0118fe4dddf65693d7b40cff7db920a3fc5 (patch)
tree33aea0e0e2da5468d4c73d7b74ae2a6d0c795684
parentReplaced MIN / MAX with std::min and std::max (diff)
downloadcuberite-3292a0118fe4dddf65693d7b40cff7db920a3fc5.tar
cuberite-3292a0118fe4dddf65693d7b40cff7db920a3fc5.tar.gz
cuberite-3292a0118fe4dddf65693d7b40cff7db920a3fc5.tar.bz2
cuberite-3292a0118fe4dddf65693d7b40cff7db920a3fc5.tar.lz
cuberite-3292a0118fe4dddf65693d7b40cff7db920a3fc5.tar.xz
cuberite-3292a0118fe4dddf65693d7b40cff7db920a3fc5.tar.zst
cuberite-3292a0118fe4dddf65693d7b40cff7db920a3fc5.zip
Diffstat (limited to '')
-rw-r--r--source/Player.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/source/Player.cpp b/source/Player.cpp
index 544503e5e..1af1acdff 100644
--- a/source/Player.cpp
+++ b/source/Player.cpp
@@ -207,7 +207,7 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
}
else
{
- m_FoodLevel = MAX(m_FoodLevel - 1, 0);
+ m_FoodLevel = std::max(m_FoodLevel - 1, 0);
}
SendHealth();
@@ -278,13 +278,11 @@ void cPlayer::SetTouchGround(bool a_bTouchGround)
-void cPlayer::Heal( int a_Health )
+void cPlayer::Heal(int a_Health)
{
- if( m_Health < GetMaxHealth() )
+ if (m_Health < GetMaxHealth())
{
- m_Health = (short) MIN(a_Health + m_Health, GetMaxHealth());
-
-
+ m_Health = (short)std::min((int)a_Health + m_Health, (int)GetMaxHealth());
SendHealth();
}
}
@@ -300,8 +298,8 @@ bool cPlayer::Feed(short a_Food, float a_Saturation)
return false;
}
- m_FoodLevel = MIN(a_Food + m_FoodLevel, GetMaxFoodLevel());
- m_FoodSaturationLevel = MIN(m_FoodSaturationLevel + a_Saturation, GetMaxFoodSaturationLevel());
+ m_FoodLevel = std::min((short)(a_Food + m_FoodLevel), GetMaxFoodLevel());
+ m_FoodSaturationLevel = std::min(m_FoodSaturationLevel + a_Saturation, GetMaxFoodSaturationLevel());
SendHealth();
return true;
@@ -774,7 +772,7 @@ void cPlayer::TossItem(
if (!Item.IsEmpty())
{
char OriginalItemAmount = Item.m_ItemCount;
- Item.m_ItemCount = MIN(OriginalItemAmount, a_Amount);
+ Item.m_ItemCount = std::min(OriginalItemAmount, a_Amount);
Drops.push_back(Item);
if (OriginalItemAmount > a_Amount)
{