1
0

Replaced MIN / MAX with std::min and std::max (pt 2)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1456 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-05-07 19:59:45 +00:00
parent 959797dbcf
commit 3292a0118f

View File

@ -207,7 +207,7 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
} }
else else
{ {
m_FoodLevel = MAX(m_FoodLevel - 1, 0); m_FoodLevel = std::max(m_FoodLevel - 1, 0);
} }
SendHealth(); SendHealth();
@ -282,9 +282,7 @@ 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(); SendHealth();
} }
} }
@ -300,8 +298,8 @@ bool cPlayer::Feed(short a_Food, float a_Saturation)
return false; return false;
} }
m_FoodLevel = MIN(a_Food + m_FoodLevel, GetMaxFoodLevel()); m_FoodLevel = std::min((short)(a_Food + m_FoodLevel), GetMaxFoodLevel());
m_FoodSaturationLevel = MIN(m_FoodSaturationLevel + a_Saturation, GetMaxFoodSaturationLevel()); m_FoodSaturationLevel = std::min(m_FoodSaturationLevel + a_Saturation, GetMaxFoodSaturationLevel());
SendHealth(); SendHealth();
return true; return true;
@ -774,7 +772,7 @@ void cPlayer::TossItem(
if (!Item.IsEmpty()) if (!Item.IsEmpty())
{ {
char OriginalItemAmount = Item.m_ItemCount; char OriginalItemAmount = Item.m_ItemCount;
Item.m_ItemCount = MIN(OriginalItemAmount, a_Amount); Item.m_ItemCount = std::min(OriginalItemAmount, a_Amount);
Drops.push_back(Item); Drops.push_back(Item);
if (OriginalItemAmount > a_Amount) if (OriginalItemAmount > a_Amount)
{ {