Skip to content
Permalink
Browse files

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
  • Loading branch information...
nerzhul committed Mar 12, 2015
1 parent 3067d78 commit afb19f3a1f73d36207b8b64e4eed5846e78f5a32
Showing with 12 additions and 0 deletions.
  1. +9 −0 src/network/packethandlers/server.cpp
  2. +3 −0 src/player.h
@@ -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: "
@@ -238,6 +238,9 @@ class Player
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;

0 comments on commit afb19f3

Please sign in to comment.
You can’t perform that action at this time.