Skip to content

Commit

Permalink
Fix forgotten PlayerSAO cast in a90f2ef
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed May 21, 2019
1 parent 9d09c87 commit a2848c9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/script/lua_api/l_object.cpp
Expand Up @@ -759,16 +759,17 @@ int ObjectRef::l_set_properties(lua_State *L)

read_object_properties(L, 2, prop, getServer(L)->idef());

PlayerSAO *player = getplayersao(ref);

if (prop->hp_max < co->getHP()) {
PlayerHPChangeReason reason(PlayerHPChangeReason::SET_HP);
co->setHP(prop->hp_max, reason);
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER)
getServer(L)->SendPlayerHPOrDie((PlayerSAO *)co, reason);
if (player)
getServer(L)->SendPlayerHPOrDie(player, reason);
}

if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER &&
prop->breath_max < co->getBreath())
co->setBreath(prop->breath_max);
if (player && prop->breath_max < player->getBreath())
player->setBreath(prop->breath_max);

co->notifyObjectPropertiesModified();
return 0;
Expand Down

0 comments on commit a2848c9

Please sign in to comment.