From d563c6576da959657b334063824e0e404ce7fb58 Mon Sep 17 00:00:00 2001 From: stfx Date: Sat, 7 Jul 2012 13:18:56 +0200 Subject: [PATCH] [12037] Use enum for rest state --- src/game/Player.cpp | 10 +++++----- src/game/Player.h | 7 +++++++ src/shared/revision_nr.h | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 1b8903039..a3ecd749e 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -672,7 +672,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 SetByteValue(PLAYER_BYTES, 3, hairColor); SetByteValue(PLAYER_BYTES_2, 0, facialHair); - SetByteValue(PLAYER_BYTES_2, 3, 0x02); // rest state = normal + SetByteValue(PLAYER_BYTES_2, 3, REST_STATE_NORMAL); SetUInt16Value(PLAYER_BYTES_3, 0, gender); // only GENDER_MALE/GENDER_FEMALE (1 bit) allowed, drunk state = 0 SetByteValue(PLAYER_BYTES_3, 3, 0); // BattlefieldArenaFaction (0 or 1) @@ -18834,10 +18834,10 @@ void Player::SetRestBonus (float rest_bonus_new) m_rest_bonus = rest_bonus_new; // update data for client - if(m_rest_bonus>10) - SetByteValue(PLAYER_BYTES_2, 3, 0x01); // Set Reststate = Rested - else if(m_rest_bonus<=1) - SetByteValue(PLAYER_BYTES_2, 3, 0x02); // Set Reststate = Normal + if (m_rest_bonus > 10) + SetByteValue(PLAYER_BYTES_2, 3, REST_STATE_RESTED); + else if (m_rest_bonus <= 1) + SetByteValue(PLAYER_BYTES_2, 3, REST_STATE_NORMAL); //RestTickUpdate SetUInt32Value(PLAYER_REST_STATE_EXPERIENCE, uint32(m_rest_bonus)); diff --git a/src/game/Player.h b/src/game/Player.h index 6001082db..38826ed3d 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -870,6 +870,13 @@ struct InstancePlayerBind InstancePlayerBind() : state(NULL), perm(false) {} }; +enum PlayerRestState +{ + REST_STATE_RESTED = 0x01, + REST_STATE_NORMAL = 0x02, + REST_STATE_RAF_LINKED = 0x04 // Exact use unknown +}; + class MANGOS_DLL_SPEC PlayerTaxi { public: diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1f494c0dd..b324c346d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12036" + #define REVISION_NR "12037" #endif // __REVISION_NR_H__