Fix crash related to KeyValues for sdk2013/2025 games (#2588)

This commit is contained in:
Benoist
2026-10-02 09:07:21 -04:00
committed by GitHub
parent c8d4fab7d9
commit b9c639620c
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -51,6 +51,10 @@
#include <vietnam_usermessages.pb.h>
#endif
#if SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_CSS
#define SE_SDK2013_2025
#endif
typedef ICommandLine *(*FakeGetCommandLine)();
#define TIER0_NAME FORMAT_SOURCE_BIN_NAME("tier0")
@@ -1065,7 +1069,7 @@ CBaseEntity *CHalfLife2::ReferenceToEntity(cell_t entRef)
{
/* Proper ent reference */
int hndlValue = entRef & ~ENTREF_MASK;
#if SOURCE_ENGINE == SE_TF2
#if defined(SE_SDK2013_2025)
auto hndl = CBaseHandle::UnsafeFromIndex(hndlValue);
#else
CBaseHandle hndl(hndlValue);
@@ -1173,7 +1177,7 @@ int CHalfLife2::ReferenceToIndex(cell_t entRef)
{
/* Proper ent reference */
int hndlValue = entRef & ~ENTREF_MASK;
#if SOURCE_ENGINE == SE_TF2
#if defined(SE_SDK2013_2025)
auto hndl = CBaseHandle::UnsafeFromIndex(hndlValue);
#else
CBaseHandle hndl(hndlValue);
@@ -1243,7 +1247,7 @@ cell_t CHalfLife2::ReferenceToBCompatRef(cell_t entRef)
}
int hndlValue = entRef & ~ENTREF_MASK;
#if SOURCE_ENGINE == SE_TF2
#if defined(SE_SDK2013_2025)
auto hndl = CBaseHandle::UnsafeFromIndex(hndlValue);
#else
CBaseHandle hndl(hndlValue);