handleCommand_Breath mustn't update breath is player is dead. A dead player doesn...
authorLoic Blot <loic.blot@unix-experience.fr>
Thu, 12 Mar 2015 10:27:28 +0000 (11:27 +0100)
committerLoic Blot <loic.blot@unix-experience.fr>
Thu, 12 Mar 2015 10:27:28 +0000 (11:27 +0100)
Add Player::isDead function to check player is dead

src/network/packethandlers/server.cpp
src/player.h

index d24e8df5b3f9e0431f92d382e7f2da0a1ebe850c..b188bb931ac3be6da049411e5a22671aac3d5813 100644 (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: "
index 4459b421a29477d2c1af770e8d040def196c6f34..def428847e35d5f90655869a360a15a950c4d8ff 100644 (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;