summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.cpp4
-rw-r--r--src/Entities/Player.h7
2 files changed, 7 insertions, 4 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 6d92eff6a..888792773 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -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);
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index 791b583bd..a16a8d0d6 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -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);