Skip to content

Commit

Permalink
handleCommand_Breath mustn't update breath is player is dead. A dead …
Browse files Browse the repository at this point in the history
…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 afb19f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/network/packethandlers/server.cpp
Expand Up @@ -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: "
Expand Down
3 changes: 3 additions & 0 deletions src/player.h
Expand Up @@ -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;
Expand Down

0 comments on commit afb19f3

Please sign in to comment.