diff --git a/core/HalfLife2.cpp b/core/HalfLife2.cpp index 83efe985..2e0c9f8b 100644 --- a/core/HalfLife2.cpp +++ b/core/HalfLife2.cpp @@ -1278,6 +1278,8 @@ bool CHalfLife2::IsMapValid(const char *map) return FindMap(szTmp, sizeof(szTmp)) != SMFindMapResult::NotFound; } +// TODO: Add ep1 support for this. (No IServerTools available there) +#if SOURCE_ENGINE >= SE_ORANGEBOX string_t CHalfLife2::AllocPooledString(const char *pszValue) { // This is admittedly a giant hack, but it's a relatively safe method for @@ -1311,3 +1313,4 @@ string_t CHalfLife2::AllocPooledString(const char *pszValue) return newString; } +#endif diff --git a/core/HalfLife2.h b/core/HalfLife2.h index a4abd4ff..2e871d45 100644 --- a/core/HalfLife2.h +++ b/core/HalfLife2.h @@ -183,7 +183,9 @@ public: //IGameHelpers const char *GetEntityClassname(CBaseEntity *pEntity); bool IsMapValid(const char *map); SMFindMapResult FindMap(char *pMapName, int nMapNameMax); +#if SOURCE_ENGINE >= SE_ORANGEBOX string_t AllocPooledString(const char *pszValue); +#endif public: void AddToFakeCliCmdQueue(int client, int userid, const char *cmd); void ProcessFakeCliCmdQueue(); diff --git a/core/smn_entities.cpp b/core/smn_entities.cpp index edcc2ad8..0b8c3bc9 100644 --- a/core/smn_entities.cpp +++ b/core/smn_entities.cpp @@ -2127,8 +2127,12 @@ static cell_t SetEntPropString(IPluginContext *pContext, const cell_t *params) if (bIsStringIndex) { +#if SOURCE_ENGINE < SE_ORANGEBOX + return pContext->ThrowNativeError("Cannot set %s. Setting string_t values not supported on this game.", prop); +#else *(string_t *) ((intptr_t) pEntity + offset) = g_HL2.AllocPooledString(src); len = strlen(src); +#endif } else {