added const correctness on some functions in cPlayer (#4999)
Co-authored-by: 12xx12 <12xx12100@gmail.com>
This commit is contained in:
parent
a145980795
commit
c07ea7b9ab
@ -527,7 +527,7 @@ int cPlayer::XpForLevel(int a_Level)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int cPlayer::GetXpLevel()
|
int cPlayer::GetXpLevel() const
|
||||||
{
|
{
|
||||||
return CalcLevelFromXp(m_CurrentXp);
|
return CalcLevelFromXp(m_CurrentXp);
|
||||||
}
|
}
|
||||||
@ -536,7 +536,7 @@ int cPlayer::GetXpLevel()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
float cPlayer::GetXpPercentage()
|
float cPlayer::GetXpPercentage() const
|
||||||
{
|
{
|
||||||
int currentLevel = CalcLevelFromXp(m_CurrentXp);
|
int currentLevel = CalcLevelFromXp(m_CurrentXp);
|
||||||
int currentLevel_XpBase = XpForLevel(currentLevel);
|
int currentLevel_XpBase = XpForLevel(currentLevel);
|
||||||
|
@ -103,10 +103,10 @@ public:
|
|||||||
inline int GetCurrentXp(void) { return m_CurrentXp; }
|
inline int GetCurrentXp(void) { return m_CurrentXp; }
|
||||||
|
|
||||||
/** Gets the current level - XpLevel */
|
/** Gets the current level - XpLevel */
|
||||||
int GetXpLevel(void);
|
int GetXpLevel(void) const;
|
||||||
|
|
||||||
/** Gets the experience bar percentage - XpP */
|
/** Gets the experience bar percentage - XpP */
|
||||||
float GetXpPercentage(void);
|
float GetXpPercentage(void) const;
|
||||||
|
|
||||||
/** Calculates the amount of XP needed for a given level
|
/** Calculates the amount of XP needed for a given level
|
||||||
Ref: https://minecraft.gamepedia.com/XP
|
Ref: https://minecraft.gamepedia.com/XP
|
||||||
@ -222,6 +222,9 @@ public:
|
|||||||
/** Returns the associated team, nullptr if none */
|
/** Returns the associated team, nullptr if none */
|
||||||
cTeam * GetTeam(void) { return m_Team; } // tolua_export
|
cTeam * GetTeam(void) { return m_Team; } // tolua_export
|
||||||
|
|
||||||
|
/** Returns the associated team, nullptr if none */
|
||||||
|
const cTeam * GetTeam(void) const { return m_Team; }
|
||||||
|
|
||||||
/** Sets the player team, nullptr if none */
|
/** Sets the player team, nullptr if none */
|
||||||
void SetTeam(cTeam * a_Team);
|
void SetTeam(cTeam * a_Team);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user