Navigation Menu

Skip to content

Commit

Permalink
Fix a warning introduced by c5b4e54
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzhul committed Mar 29, 2018
1 parent ef979ee commit 0396717
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/content_sao.cpp
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/content_sao.h
Expand Up @@ -117,7 +117,7 @@ class LuaEntitySAO : public UnitSAO
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);
Expand Down

0 comments on commit 0396717

Please sign in to comment.