Skip to content

Commit a2848c9

Browse files
committedMay 21, 2019
Fix forgotten PlayerSAO cast in a90f2ef
1 parent 9d09c87 commit a2848c9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎src/script/lua_api/l_object.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -759,16 +759,17 @@ int ObjectRef::l_set_properties(lua_State *L)
759759

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

762+
PlayerSAO *player = getplayersao(ref);
763+
762764
if (prop->hp_max < co->getHP()) {
763765
PlayerHPChangeReason reason(PlayerHPChangeReason::SET_HP);
764766
co->setHP(prop->hp_max, reason);
765-
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER)
766-
getServer(L)->SendPlayerHPOrDie((PlayerSAO *)co, reason);
767+
if (player)
768+
getServer(L)->SendPlayerHPOrDie(player, reason);
767769
}
768770

769-
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER &&
770-
prop->breath_max < co->getBreath())
771-
co->setBreath(prop->breath_max);
771+
if (player && prop->breath_max < player->getBreath())
772+
player->setBreath(prop->breath_max);
772773

773774
co->notifyObjectPropertiesModified();
774775
return 0;

0 commit comments

Comments
 (0)
Please sign in to comment.