handleCommand_Breath mustn't update breath is player is dead. A dead player doesn't breath.

Add Player::isDead function to check player is dead
master
Loic Blot 2015-03-12 11:27:28 +01:00
parent 3067d78216
commit afb19f3a1f
2 changed files with 12 additions and 0 deletions

View File

@ -916,6 +916,15 @@ void Server::handleCommand_Breath(NetworkPacket* pkt)
return;
}
/*
* If player is dead, we don't need to update the breath
* He is dead !
*/
if (player->isDead()) {
return;
}
PlayerSAO *playersao = player->getPlayerSAO();
if (playersao == NULL) {
errorstream << "Server::ProcessData(): Cancelling: "

View File

@ -238,6 +238,9 @@ public:
inventory.setModified(x);
}
// Use a function, if isDead can be defined by other conditions
bool isDead() { return hp == 0; }
bool touching_ground;
// This oscillates so that the player jumps a bit above the surface
bool in_liquid;