1
0
Fork 0

added const correctness on some functions in cPlayer (#4999)

Co-authored-by: 12xx12 <12xx12100@gmail.com>
This commit is contained in:
12xx12 2020-10-15 20:18:32 +02:00 committed by GitHub
parent a145980795
commit c07ea7b9ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -527,7 +527,7 @@ int cPlayer::XpForLevel(int a_Level)
int cPlayer::GetXpLevel()
int cPlayer::GetXpLevel() const
{
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_XpBase = XpForLevel(currentLevel);

View File

@ -103,10 +103,10 @@ public:
inline int GetCurrentXp(void) { return m_CurrentXp; }
/** Gets the current level - XpLevel */
int GetXpLevel(void);
int GetXpLevel(void) const;
/** Gets the experience bar percentage - XpP */
float GetXpPercentage(void);
float GetXpPercentage(void) const;
/** Calculates the amount of XP needed for a given level
Ref: https://minecraft.gamepedia.com/XP
@ -222,6 +222,9 @@ public:
/** Returns the associated team, nullptr if none */
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 */
void SetTeam(cTeam * a_Team);