[8202] Replace raw array index values by enums.

This commit is contained in:
VladimirMangos 2009-07-19 04:01:34 +04:00
parent ce387187c1
commit e793f0eeab
3 changed files with 23 additions and 15 deletions

View file

@ -611,8 +611,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();
@ -1285,8 +1285,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;
}
@ -2377,7 +2377,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 ();
@ -13849,8 +13849,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();
@ -14346,8 +14346,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());
@ -15606,9 +15606,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);