diff --git a/core/ConVarManager.cpp b/core/ConVarManager.cpp index f32c9a20..04aa6416 100644 --- a/core/ConVarManager.cpp +++ b/core/ConVarManager.cpp @@ -182,7 +182,7 @@ void ConVarManager::OnSourceModVSPReceived() } /* For later MM:S versions, use the updated API, since it's cleaner. */ -#if defined METAMOD_PLAPI_VERSION +#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 int engine = g_SMAPI->GetSourceEngineBuild(); if (engine == SOURCE_ENGINE_ORIGINAL || vsp_version < 2) { diff --git a/core/HalfLife2.cpp b/core/HalfLife2.cpp index e7432118..d9c6e88c 100644 --- a/core/HalfLife2.cpp +++ b/core/HalfLife2.cpp @@ -96,14 +96,16 @@ CHalfLife2::~CHalfLife2() CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL; #endif +#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11 bool is_original_engine = false; +#endif void CHalfLife2::OnSourceModStartup(bool late) { #if SOURCE_ENGINE != SE_DARKMESSIAH /* The Ship currently is the only known game to use an older version of the engine */ -#if defined METAMOD_PLAPI_VERSION +#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL) #else if (strcasecmp(g_SourceMod.GetGameFolderName(), "ship") == 0) @@ -172,7 +174,7 @@ void CHalfLife2::OnSourceModAllInitialized_Post() } } -#if !defined METAMOD_PLAPI_VERSION +#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11 bool CHalfLife2::IsOriginalEngine() { return is_original_engine; @@ -543,7 +545,7 @@ bool CHalfLife2::IsLANServer() bool CHalfLife2::KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID) { -#if defined METAMOD_PLAPI_VERSION +#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL) #else if (strcasecmp(g_SourceMod.GetGameFolderName(), "ship") == 0) diff --git a/core/HalfLife2.h b/core/HalfLife2.h index f42a40ee..1cceaba0 100644 --- a/core/HalfLife2.h +++ b/core/HalfLife2.h @@ -145,7 +145,7 @@ public: const char *CurrentCommandName(); void AddDelayedKick(int client, int userid, const char *msg); void ProcessDelayedKicks(); -#if !defined METAMOD_PLAPI_VERSION +#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11 bool IsOriginalEngine(); #endif private: diff --git a/core/smn_halflife.cpp b/core/smn_halflife.cpp index 0e98237d..e02aa9f6 100644 --- a/core/smn_halflife.cpp +++ b/core/smn_halflife.cpp @@ -438,28 +438,25 @@ static cell_t smn_IsPlayerAlive(IPluginContext *pContext, const cell_t *params) static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params) { -#if defined METAMOD_PLAPI_VERSION +#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 int version = g_SMAPI->GetSourceEngineBuild(); - if (version == SOURCE_ENGINE_ORIGINAL) + switch (version) { + case SOURCE_ENGINE_ORIGINAL: return 10; - } - else if (version == SOURCE_ENGINE_DARKMESSIAH) - { - return 15; - } - else if (version == SOURCE_ENGINE_EPISODEONE) - { + case SOURCE_ENGINE_EPISODEONE: return 20; - } - else if (version == SOURCE_ENGINE_ORANGEBOX) - { + +# if defined METAMOD_PLAPI_VERISON + /* Newer games. */ + case SOURCE_ENGINE_DARKMESSIAH: + return 15; + case SOURCE_ENGINE_ORANGEBOX: return 30; - } - else if (version == SOURCE_ENGINE_LEFT4DEAD) - { + case SOURCE_ENGINE_LEFT4DEAD: return 40; +# endif } #else if (g_HL2.IsOriginalEngine())