Fix a warning introduced by c5b4e541749c50805519ce040d98a0a8e5e0ec03
authorLoic Blot <loic.blot@unix-experience.fr>
Thu, 29 Mar 2018 11:41:48 +0000 (13:41 +0200)
committerLoic Blot <loic.blot@unix-experience.fr>
Thu, 29 Mar 2018 11:54:44 +0000 (13:54 +0200)
src/content_sao.cpp
src/content_sao.h

index f2cd0ff11e0a6f19b9929017edd808008e194fed..4959ec569203e35758d5cc4d32ef09d2c227dbe4 100644 (file)
@@ -566,7 +566,8 @@ int LuaEntitySAO::punch(v3f dir,
 
        if (!damage_handled) {
                if (result.did_punch) {
-                       setHP(getHP() - result.damage);
+                       setHP(getHP() - result.damage,
+                               PlayerHPChangeReason(PlayerHPChangeReason::SET_HP));
 
                        if (result.damage > 0) {
                                std::string punchername = puncher ? puncher->getDescription() : "nil";
@@ -634,9 +635,10 @@ std::string LuaEntitySAO::getDescription()
        return os.str();
 }
 
-void LuaEntitySAO::setHP(s16 hp)
+void LuaEntitySAO::setHP(s16 hp, const PlayerHPChangeReason &reason)
 {
-       if(hp < 0) hp = 0;
+       if (hp < 0)
+               hp = 0;
        m_hp = hp;
 }
 
index 10630014c6f8499de794b2e3ad9d269953e0c5f1..509f477dde0f60bfbb2e7c66bcace82fb00edbd2 100644 (file)
@@ -117,7 +117,7 @@ public:
        void moveTo(v3f pos, bool continuous);
        float getMinimumSavedMovement();
        std::string getDescription();
-       void setHP(s16 hp);
+       void setHP(s16 hp, const PlayerHPChangeReason &reason);
        s16 getHP() const;
        /* LuaEntitySAO-specific */
        void setVelocity(v3f velocity);