- a few minor fixes.

This commit is contained in:
Christoph Oelckers 2019-02-01 12:31:08 +01:00
commit 2903025268
5 changed files with 29 additions and 17 deletions

View file

@ -1040,22 +1040,25 @@ bool AActor::IsInsideVisibleAngles() const
//
// Returns true if this actor should be seen by the console player.
//
// Not that even for secondary maps this must check the real player!
//
//============================================================================
bool AActor::IsVisibleToPlayer() const
{
auto &p = players[consoleplayer];
// [BB] Safety check. This should never be NULL. Nevertheless, we return true to leave the default ZDoom behavior unaltered.
if ( players[consoleplayer].camera == NULL )
if ( p.camera == nullptr )
return true;
if (VisibleToTeam != 0 && teamplay &&
(signed)(VisibleToTeam-1) != players[consoleplayer].userinfo.GetTeam() )
(signed)(VisibleToTeam-1) != p.userinfo.GetTeam() )
return false;
auto &vis = GetInfo()->VisibleToPlayerClass;
if (vis.Size() == 0) return true; // early out for the most common case.
const player_t* pPlayer = players[consoleplayer].camera->player;
const player_t* pPlayer = p.camera->player;
if (pPlayer)
{