mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[8202] Replace raw array index values by enums.
This commit is contained in:
parent
ce387187c1
commit
e793f0eeab
3 changed files with 23 additions and 15 deletions
|
|
@ -611,8 +611,8 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
|
||||||
|
|
||||||
// Played time
|
// Played time
|
||||||
m_Last_tick = time(NULL);
|
m_Last_tick = time(NULL);
|
||||||
m_Played_time[0] = 0;
|
m_Played_time[PLAYED_TIME_TOTAL] = 0;
|
||||||
m_Played_time[1] = 0;
|
m_Played_time[PLAYED_TIME_LEVEL] = 0;
|
||||||
|
|
||||||
// base stats and related field values
|
// base stats and related field values
|
||||||
InitStatsForLevel();
|
InitStatsForLevel();
|
||||||
|
|
@ -1285,8 +1285,8 @@ void Player::Update( uint32 p_time )
|
||||||
if (now > m_Last_tick)
|
if (now > m_Last_tick)
|
||||||
{
|
{
|
||||||
uint32 elapsed = uint32(now - m_Last_tick);
|
uint32 elapsed = uint32(now - m_Last_tick);
|
||||||
m_Played_time[0] += elapsed; // Total played time
|
m_Played_time[PLAYED_TIME_TOTAL] += elapsed; // Total played time
|
||||||
m_Played_time[1] += elapsed; // Level played time
|
m_Played_time[PLAYED_TIME_LEVEL] += elapsed; // Level played time
|
||||||
m_Last_tick = now;
|
m_Last_tick = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2377,7 +2377,7 @@ void Player::GiveLevel(uint32 level)
|
||||||
|
|
||||||
//update level, max level of skills
|
//update level, max level of skills
|
||||||
if(getLevel()!= level)
|
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);
|
SetLevel(level);
|
||||||
UpdateSkillsForLevel ();
|
UpdateSkillsForLevel ();
|
||||||
|
|
||||||
|
|
@ -13849,8 +13849,8 @@ bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
|
||||||
|
|
||||||
// the instance id is not needed at character enum
|
// the instance id is not needed at character enum
|
||||||
|
|
||||||
m_Played_time[0] = fields[7].GetUInt32();
|
m_Played_time[PLAYED_TIME_TOTAL] = fields[7].GetUInt32();
|
||||||
m_Played_time[1] = fields[8].GetUInt32();
|
m_Played_time[PLAYED_TIME_LEVEL] = fields[8].GetUInt32();
|
||||||
|
|
||||||
m_atLoginFlags = fields[9].GetUInt32();
|
m_atLoginFlags = fields[9].GetUInt32();
|
||||||
|
|
||||||
|
|
@ -14346,8 +14346,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cinematic = fields[19].GetUInt32();
|
m_cinematic = fields[19].GetUInt32();
|
||||||
m_Played_time[0]= fields[20].GetUInt32();
|
m_Played_time[PLAYED_TIME_TOTAL]= fields[20].GetUInt32();
|
||||||
m_Played_time[1]= fields[21].GetUInt32();
|
m_Played_time[PLAYED_TIME_LEVEL]= fields[21].GetUInt32();
|
||||||
|
|
||||||
m_resetTalentsCost = fields[25].GetUInt32();
|
m_resetTalentsCost = fields[25].GetUInt32();
|
||||||
m_resetTalentsTime = time_t(fields[26].GetUInt64());
|
m_resetTalentsTime = time_t(fields[26].GetUInt64());
|
||||||
|
|
@ -15606,9 +15606,9 @@ void Player::SaveToDB()
|
||||||
ss << m_cinematic;
|
ss << m_cinematic;
|
||||||
|
|
||||||
ss << ", ";
|
ss << ", ";
|
||||||
ss << m_Played_time[0];
|
ss << m_Played_time[PLAYED_TIME_TOTAL];
|
||||||
ss << ", ";
|
ss << ", ";
|
||||||
ss << m_Played_time[1];
|
ss << m_Played_time[PLAYED_TIME_LEVEL];
|
||||||
|
|
||||||
ss << ", ";
|
ss << ", ";
|
||||||
ss << finiteAlways(m_rest_bonus);
|
ss << finiteAlways(m_rest_bonus);
|
||||||
|
|
|
||||||
|
|
@ -833,6 +833,14 @@ enum EnviromentalDamage
|
||||||
DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss
|
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
|
// used at player loading query list preparing, and later result selection
|
||||||
enum PlayerLoginQueryIndex
|
enum PlayerLoginQueryIndex
|
||||||
{
|
{
|
||||||
|
|
@ -1028,9 +1036,9 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
// Played Time Stuff
|
// Played Time Stuff
|
||||||
time_t m_logintime;
|
time_t m_logintime;
|
||||||
time_t m_Last_tick;
|
time_t m_Last_tick;
|
||||||
uint32 m_Played_time[2];
|
uint32 m_Played_time[MAX_PLAYED_TIME_INDEX];
|
||||||
uint32 GetTotalPlayedTime() { return m_Played_time[0]; };
|
uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; };
|
||||||
uint32 GetLevelPlayedTime() { return m_Played_time[1]; };
|
uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; };
|
||||||
|
|
||||||
void setDeathState(DeathState s); // overwrite Unit::setDeathState
|
void setDeathState(DeathState s); // overwrite Unit::setDeathState
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8201"
|
#define REVISION_NR "8202"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue