Fix a warning introduced by c5b4e541749c50805519ce040d98a0a8e5e0ec03

This commit is contained in:
Loic Blot 2018-03-29 13:41:48 +02:00
parent ef979ee2e9
commit 0396717256
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
2 changed files with 6 additions and 4 deletions

@ -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;
}

@ -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);