Give full breath after death
authorSmallJoker <mk939@ymail.com>
Wed, 4 Feb 2015 08:00:34 +0000 (09:00 +0100)
committerCraig Robbins <kde.psych@gmail.com>
Thu, 5 Feb 2015 07:33:08 +0000 (17:33 +1000)
src/constants.h
src/player.cpp
src/server.cpp

index 6969b4d81b49a0bb2c805735224b4a532e51a353..9a7bb9d86215d66ac140d429542443c5b511e828 100644 (file)
@@ -89,6 +89,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 // Maximum hit points of a player
 #define PLAYER_MAX_HP 20
 
+// Maximal breath of a player
+#define PLAYER_MAX_BREATH 11
+
 // Number of different files to try to save a player to if the first fails
 // (because of a case-insensitive filesystem)
 // TODO: Use case-insensitive player names instead of this hack.
index 64c138d02682111b1cea145055db40d344c8f4d9..0da761eedef27549505913453100d387e98d01dd 100644 (file)
@@ -47,7 +47,7 @@ Player::Player(IGameDef *gamedef, const char *name):
        keyPressed(0),
 // protected
        m_gamedef(gamedef),
-       m_breath(-1),
+       m_breath(PLAYER_MAX_BREATH),
        m_pitch(0),
        m_yaw(0),
        m_speed(0,0,0),
@@ -213,12 +213,12 @@ void Player::deSerialize(std::istream &is, std::string playername)
        try{
                hp = args.getS32("hp");
        }catch(SettingNotFoundException &e) {
-               hp = 20;
+               hp = PLAYER_MAX_HP;
        }
        try{
                m_breath = args.getS32("breath");
        }catch(SettingNotFoundException &e) {
-               m_breath = 11;
+               m_breath = PLAYER_MAX_BREATH;
        }
 
        inventory.deSerialize(is);
index 31b5041ed550c278cd9c3e630c010101fe40522a..399c41b70afe5ac10321e9237ff2c8b6cf462e0a 100644 (file)
@@ -4294,6 +4294,7 @@ void Server::RespawnPlayer(u16 peer_id)
                        <<" respawns"<<std::endl;
 
        playersao->setHP(PLAYER_MAX_HP);
+       playersao->setBreath(PLAYER_MAX_BREATH);
 
        bool repositioned = m_script->on_respawnplayer(playersao);
        if(!repositioned){