Fix forgotten PlayerSAO cast in a90f2ef

master
SmallJoker 2019-05-21 21:37:47 +02:00
parent 9d09c87f13
commit a2848c9cde
1 changed files with 6 additions and 5 deletions

View File

@ -759,16 +759,17 @@ int ObjectRef::l_set_properties(lua_State *L)
read_object_properties(L, 2, prop, getServer(L)->idef()); read_object_properties(L, 2, prop, getServer(L)->idef());
PlayerSAO *player = getplayersao(ref);
if (prop->hp_max < co->getHP()) { if (prop->hp_max < co->getHP()) {
PlayerHPChangeReason reason(PlayerHPChangeReason::SET_HP); PlayerHPChangeReason reason(PlayerHPChangeReason::SET_HP);
co->setHP(prop->hp_max, reason); co->setHP(prop->hp_max, reason);
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER) if (player)
getServer(L)->SendPlayerHPOrDie((PlayerSAO *)co, reason); getServer(L)->SendPlayerHPOrDie(player, reason);
} }
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER && if (player && prop->breath_max < player->getBreath())
prop->breath_max < co->getBreath()) player->setBreath(prop->breath_max);
co->setBreath(prop->breath_max);
co->notifyObjectPropertiesModified(); co->notifyObjectPropertiesModified();
return 0; return 0;