summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.cpp2
-rw-r--r--src/Entities/Player.h13
2 files changed, 8 insertions, 7 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 608316e9a..91bcddca3 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -509,7 +509,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))
{
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index e26808bfc..f345a0207 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -29,12 +29,13 @@ class cPlayer :
typedef cPawn super;
public:
- enum
- {
- MAX_HEALTH = 20,
- MAX_FOOD_LEVEL = 20,
- EATING_TICKS = 30, ///< Number of ticks it takes to eat an item
- } ;
+ static const int MAX_HEALTH = 20;
+
+ static const int MAX_FOOD_LEVEL = 20;
+
+ /** Number of ticks it takes to eat an item */
+ static const int EATING_TICKS = 30;
+
// tolua_end
CLASS_PROTODEF(cPlayer)