Merge pull request #7476 from ChillerDragon/pr_const_char

Overload GetCharacter with const version
This commit is contained in:
heinrich5991 2023-11-19 03:08:03 +00:00 committed by GitHub
commit 9b024fcf97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -578,6 +578,13 @@ CCharacter *CPlayer::GetCharacter()
return 0;
}
const CCharacter *CPlayer::GetCharacter() const
{
if(m_pCharacter && m_pCharacter->IsAlive())
return m_pCharacter;
return 0;
}
void CPlayer::KillCharacter(int Weapon, bool SendKillMsg)
{
if(m_pCharacter)

View file

@ -64,6 +64,7 @@ public:
void KillCharacter(int Weapon = WEAPON_GAME, bool SendKillMsg = true);
CCharacter *GetCharacter();
const CCharacter *GetCharacter() const;
void SpectatePlayerName(const char *pName);