Fix build for ep1 and darkm.

This commit is contained in:
Nicholas Hastings 2015-07-02 15:22:33 -04:00
parent e0a83ff7b2
commit 1a5714c3ca
3 changed files with 9 additions and 0 deletions

View File

@ -1278,6 +1278,8 @@ bool CHalfLife2::IsMapValid(const char *map)
return FindMap(szTmp, sizeof(szTmp)) != SMFindMapResult::NotFound; 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) string_t CHalfLife2::AllocPooledString(const char *pszValue)
{ {
// This is admittedly a giant hack, but it's a relatively safe method for // 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; return newString;
} }
#endif

View File

@ -183,7 +183,9 @@ public: //IGameHelpers
const char *GetEntityClassname(CBaseEntity *pEntity); const char *GetEntityClassname(CBaseEntity *pEntity);
bool IsMapValid(const char *map); bool IsMapValid(const char *map);
SMFindMapResult FindMap(char *pMapName, int nMapNameMax); SMFindMapResult FindMap(char *pMapName, int nMapNameMax);
#if SOURCE_ENGINE >= SE_ORANGEBOX
string_t AllocPooledString(const char *pszValue); string_t AllocPooledString(const char *pszValue);
#endif
public: public:
void AddToFakeCliCmdQueue(int client, int userid, const char *cmd); void AddToFakeCliCmdQueue(int client, int userid, const char *cmd);
void ProcessFakeCliCmdQueue(); void ProcessFakeCliCmdQueue();

View File

@ -2127,8 +2127,12 @@ static cell_t SetEntPropString(IPluginContext *pContext, const cell_t *params)
if (bIsStringIndex) 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); *(string_t *) ((intptr_t) pEntity + offset) = g_HL2.AllocPooledString(src);
len = strlen(src); len = strlen(src);
#endif
} }
else else
{ {