diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Player.cpp | 22 | ||||
-rw-r--r-- | src/game/Player.h | 14 |
2 files changed, 22 insertions, 14 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 729899ec69d..55815e4acf4 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -669,8 +669,8 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 // Played time m_Last_tick = time(NULL); - m_Played_time[0] = 0; - m_Played_time[1] = 0; + m_Played_time[PLAYED_TIME_TOTAL] = 0; + m_Played_time[PLAYED_TIME_LEVEL] = 0; // base stats and related field values InitStatsForLevel(); @@ -1340,8 +1340,8 @@ void Player::Update( uint32 p_time ) if (now > m_Last_tick) { uint32 elapsed = uint32(now - m_Last_tick); - m_Played_time[0] += elapsed; // Total played time - m_Played_time[1] += elapsed; // Level played time + m_Played_time[PLAYED_TIME_TOTAL] += elapsed; // Total played time + m_Played_time[PLAYED_TIME_LEVEL] += elapsed; // Level played time m_Last_tick = now; } @@ -2461,7 +2461,7 @@ void Player::GiveLevel(uint32 level) //update level, max level of skills if(getLevel()!= level) - m_Played_time[1] = 0; // Level Played Time reset + m_Played_time[PLAYED_TIME_LEVEL] = 0; // Level Played Time reset SetLevel(level); UpdateSkillsForLevel (); @@ -14262,8 +14262,8 @@ bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid ) // the instance id is not needed at character enum - m_Played_time[0] = fields[7].GetUInt32(); - m_Played_time[1] = fields[8].GetUInt32(); + m_Played_time[PLAYED_TIME_TOTAL] = fields[7].GetUInt32(); + m_Played_time[PLAYED_TIME_LEVEL] = fields[8].GetUInt32(); m_atLoginFlags = fields[9].GetUInt32(); @@ -14834,8 +14834,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) } m_cinematic = fields[19].GetUInt32(); - m_Played_time[0]= fields[20].GetUInt32(); - m_Played_time[1]= fields[21].GetUInt32(); + m_Played_time[PLAYED_TIME_TOTAL]= fields[20].GetUInt32(); + m_Played_time[PLAYED_TIME_LEVEL]= fields[21].GetUInt32(); m_resetTalentsCost = fields[25].GetUInt32(); m_resetTalentsTime = time_t(fields[26].GetUInt64()); @@ -16177,9 +16177,9 @@ void Player::SaveToDB() ss << m_cinematic; ss << ", "; - ss << m_Played_time[0]; + ss << m_Played_time[PLAYED_TIME_TOTAL]; ss << ", "; - ss << m_Played_time[1]; + ss << m_Played_time[PLAYED_TIME_LEVEL]; ss << ", "; ss << finiteAlways(m_rest_bonus); diff --git a/src/game/Player.h b/src/game/Player.h index d834ceaee15..d99d4966362 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -755,6 +755,14 @@ enum EnviromentalDamage DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss }; +enum PlayedTimeIndex +{ + PLAYED_TIME_TOTAL = 0, + PLAYED_TIME_LEVEL = 1 +}; + +#define MAX_PLAYED_TIME_INDEX 2 + // used at player loading query list preparing, and later result selection enum PlayerLoginQueryIndex { @@ -964,9 +972,9 @@ class TRINITY_DLL_SPEC Player : public Unit // Played Time Stuff time_t m_logintime; time_t m_Last_tick; - uint32 m_Played_time[2]; - uint32 GetTotalPlayedTime() { return m_Played_time[0]; }; - uint32 GetLevelPlayedTime() { return m_Played_time[1]; }; + uint32 m_Played_time[MAX_PLAYED_TIME_INDEX]; + uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; }; + uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; }; void setDeathState(DeathState s); // overwrite Unit::setDeathState |