Skip to content

Commit

Permalink
Whoops
Browse files Browse the repository at this point in the history
  • Loading branch information
PazerOP committed Nov 19, 2016
1 parent 3c6cfd2 commit 8b786d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CastingEssentials/PluginBase/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,15 @@ bool Player::IsValidIndex(int entIndex)
return true;
}

Player* Player::GetLocalPlayer()
{
const auto localPlayerIndex = Interfaces::GetEngineClient()->GetLocalPlayer();
if (!IsValidIndex(localPlayerIndex))
return nullptr;

return GetPlayer(localPlayerIndex, __FUNCSIG__);
}

Player* Player::GetPlayer(int entIndex, const char* functionName)
{
if (!IsValidIndex(entIndex))
Expand Down
1 change: 1 addition & 0 deletions CastingEssentials/PluginBase/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Player final
static Player* AsPlayer(IClientEntity* entity);
static Player* GetPlayer(int entIndex, const char* functionName = nullptr);
static bool IsValidIndex(int entIndex);
static Player* GetLocalPlayer();

static bool CheckDependencies();
static bool IsNameRetrievalAvailable() { return s_NameRetrievalAvailable; }
Expand Down

0 comments on commit 8b786d0

Please sign in to comment.