Fix bots not being able to see ghoster behind smoke#1998
Conversation
|
To test,
|
| return assert_cast<CNEO_Player*>(pEntity); | ||
| } | ||
|
|
||
| inline const CNEO_Player *ToNEOPlayer(const CBaseEntity *pEntity) |
There was a problem hiding this comment.
We already have ToNEOPlayer in c_neo_player.h, maybe keep the declaration here and move both definitions to neo_player_shared.cpp?
There was a problem hiding this comment.
To be honest I looked into this, and I'm not exactly sure what you mean by the relation with c_neo_player.h
I just needed the const for const CNEO_Player *, so that I can get a const pointer for my use case here.
I also wasn't sure how moving both definitions to neo_player_shared.cpp actually made things clearer, because with how I understand this, it would involve defining branches around #ifdef CLIENT_DLL, which I'm not sure is actually more readable, e.g.:
In neo_player_shared.h:
#ifdef CLIENT_DLL
class C_BaseEntity;
class C_NEO_Player;
C_NEO_Player *ToNEOPlayer(C_BaseEntity *pEntity);
#else
class CBaseEntity;
class CNEO_Player;
CNEO_Player *ToNEOPlayer(CBaseEntity *pEntity);
const CNEO_Player *ToNEOPlayer(const CBaseEntity *pEntity);
#endifand in neo_player_shared.cpp:
#ifdef CLIENT_DLL
C_NEO_Player *ToNEOPlayer(C_BaseEntity *pEntity)
{
if (!pEntity || !pEntity->IsPlayer())
{
return nullptr;
}
#if _DEBUG
Assert(dynamic_cast<C_NEO_Player*>(pEntity));
#endif
return static_cast<C_NEO_Player*>(pEntity);
}
#else
CNEO_Player *ToNEOPlayer(CBaseEntity *pEntity)
{
if (!pEntity || !pEntity->IsPlayer())
{
return nullptr;
}
return assert_cast<CNEO_Player*>(pEntity);
}
const CNEO_Player *ToNEOPlayer(const CBaseEntity *pEntity)
{
if (!pEntity || !pEntity->IsPlayer())
{
return nullptr;
}
return assert_cast<const CNEO_Player*>(pEntity);
}
#endif... if it's okay, maybe we can go with the original PR approach?
b3a0335 to
d06e900
Compare
Description
Fixes bots not being able to see a ghost carrier from behind smoke despite the apparent glowing beacon visible by human players.
Toolchain