Fix usage of CBaseHandle for tf2 + Update compilation flags for clang (#2466)

This commit is contained in:
Benoist
2026-05-23 15:47:21 +02:00
committed by GitHub
parent 5acd8c77c9
commit 047dd0dec1
3 changed files with 15 additions and 2 deletions
+1
View File
@@ -246,6 +246,7 @@ class SMConfig(object):
'-Wno-array-bounds',
'-Wno-unknown-pragmas',
'-Wno-dangling-else',
'-Wno-uninitialized-const-pointer',
'-fvisibility=hidden',
]
if cxx.target.arch in ['x86', 'x86_64']:
+13 -1
View File
@@ -994,7 +994,11 @@ CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
{
/* Proper ent reference */
int hndlValue = entRef & ~ENTREF_MASK;
#if SOURCE_ENGINE == SE_TF2
auto hndl = CBaseHandle::UnsafeFromIndex(hndlValue);
#else
CBaseHandle hndl(hndlValue);
#endif
pInfo = LookupEntity(hndl.GetEntryIndex());
if (!pInfo || pInfo->m_SerialNumber != hndl.GetSerialNumber())
@@ -1098,7 +1102,11 @@ int CHalfLife2::ReferenceToIndex(cell_t entRef)
{
/* Proper ent reference */
int hndlValue = entRef & ~ENTREF_MASK;
#if SOURCE_ENGINE == SE_TF2
auto hndl = CBaseHandle::UnsafeFromIndex(hndlValue);
#else
CBaseHandle hndl(hndlValue);
#endif
CEntInfo *pInfo = LookupEntity(hndl.GetEntryIndex());
@@ -1141,7 +1149,7 @@ cell_t CHalfLife2::EntityToBCompatRef(CBaseEntity *pEntity)
IServerUnknown *pUnknown = (IServerUnknown *)pEntity;
CBaseHandle hndl = pUnknown->GetRefEHandle();
if (hndl == INVALID_EHANDLE_INDEX)
if (!hndl.IsValid())
{
return INVALID_EHANDLE_INDEX;
}
@@ -1164,7 +1172,11 @@ cell_t CHalfLife2::ReferenceToBCompatRef(cell_t entRef)
}
int hndlValue = entRef & ~ENTREF_MASK;
#if SOURCE_ENGINE == SE_TF2
auto hndl = CBaseHandle::UnsafeFromIndex(hndlValue);
#else
CBaseHandle hndl(hndlValue);
#endif
if (hndl.GetEntryIndex() < MAX_EDICTS)
{