From 1a5714c3ca96d1dbb62b0d6da1b9eef99a183ef5 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Thu, 2 Jul 2015 15:22:33 -0400 Subject: [PATCH] Fix build for ep1 and darkm. --- core/HalfLife2.cpp | 3 +++ core/HalfLife2.h | 2 ++ core/smn_entities.cpp | 4 ++++ 3 files changed, 9 insertions(+) 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 {