From 71d670541b7643eab006a658b42cb57141fd5b6c Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 14 Jan 2017 19:00:57 +0700 Subject: [PATCH] Add more info about API dependencies. --- README.md | 2 +- reapi/src/mods/mod_regamedll_api.cpp | 19 ++++++++++++++++--- reapi/src/mods/mod_rehlds_api.cpp | 18 ++++++++++++++++-- reapi/src/mods/mod_reunion_api.cpp | 24 ++++++++++++++++++++---- reapi/src/mods/mod_vtc_api.cpp | 24 ++++++++++++++++++++---- 5 files changed, 73 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 25584b8..033b0ef 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# Reapi [![Build Status](http://teamcity.rehlds.org/app/rest/builds/buildType:(id:Reapi_Publish)/statusIcon)](http://teamcity.rehlds.org/viewType.html?buildTypeId=Reapi_Publish&guest=1) [![Download](http://rehlds.ru/version/reapi/)](http://teamcity.rehlds.org/guestAuth/downloadArtifacts.html?buildTypeId=Reapi_Publish&buildId=lastSuccessful) +# Reapi [![Build Status](http://teamcity.rehlds.org/app/rest/builds/buildType:(id:Reapi_Publish)/statusIcon)](http://teamcity.rehlds.org/viewType.html?buildTypeId=Reapi_Publish&guest=1) [![Download](https://camo.githubusercontent.com/a3ac64aab91dcea4e0f3dfd611808ad61cc05798/687474703a2f2f7265686c64732e6f72672f76657273696f6e2f72656170692e737667)](http://teamcity.rehlds.org/guestAuth/downloadArtifacts.html?buildTypeId=Reapi_Publish&buildId=lastSuccessful) AMX Mod X module, using API regamedll & rehlds diff --git a/reapi/src/mods/mod_regamedll_api.cpp b/reapi/src/mods/mod_regamedll_api.cpp index 7ddacb6..bcab076 100644 --- a/reapi/src/mods/mod_regamedll_api.cpp +++ b/reapi/src/mods/mod_regamedll_api.cpp @@ -21,7 +21,6 @@ bool RegamedllApi_Init() int retCode = 0; g_ReGameApi = (IReGameApi *)ifaceFactory(VRE_GAMEDLL_API_VERSION, &retCode); - if (!g_ReGameApi) { return false; @@ -32,13 +31,27 @@ bool RegamedllApi_Init() if (majorVersion != REGAMEDLL_API_VERSION_MAJOR) { - UTIL_ServerPrint("[%s]: ReGameDLL Api major version mismatch; expected %d, real %d\n", Plugin_info.logtag, REGAMEDLL_API_VERSION_MAJOR, majorVersion); + UTIL_ServerPrint("[%s]: ReGameDLL API major version mismatch; expected %d, real %d\n", Plugin_info.logtag, REGAMEDLL_API_VERSION_MAJOR, majorVersion); + + // need to notify that it is necessary to update the ReGameDLL. + if (majorVersion < REGAMEDLL_API_VERSION_MAJOR) + { + UTIL_ServerPrint("[%s]: Please update the ReGameDLL up to a major version API >= %d\n", Plugin_info.logtag, REGAMEDLL_API_VERSION_MAJOR); + } + + // need to notify that it is necessary to update the module. + else if (majorVersion > REGAMEDLL_API_VERSION_MAJOR) + { + UTIL_ServerPrint("[%s]: Please update the %s up to a major version API >= %d\n", Plugin_info.logtag, Plugin_info.logtag, majorVersion); + } + return false; } if (minorVersion < REGAMEDLL_API_VERSION_MINOR) { - UTIL_ServerPrint("[%s]: ReGameDLL Api minor version mismatch; expected at least %d, real %d\n", Plugin_info.logtag, REGAMEDLL_API_VERSION_MINOR, minorVersion); + UTIL_ServerPrint("[%s]: ReGameDLL API minor version mismatch; expected at least %d, real %d\n", Plugin_info.logtag, REGAMEDLL_API_VERSION_MINOR, minorVersion); + UTIL_ServerPrint("[%s]: Please update the ReGameDLL up to a minor version API >= %d\n", Plugin_info.logtag, REGAMEDLL_API_VERSION_MINOR); return false; } diff --git a/reapi/src/mods/mod_rehlds_api.cpp b/reapi/src/mods/mod_rehlds_api.cpp index 7bb624b..6d96be9 100644 --- a/reapi/src/mods/mod_rehlds_api.cpp +++ b/reapi/src/mods/mod_rehlds_api.cpp @@ -32,13 +32,27 @@ bool RehldsApi_Init() if (majorVersion != REHLDS_API_VERSION_MAJOR) { - UTIL_ServerPrint("[%s]: ReHLDS Api major version mismatch; expected %d, real %d\n", Plugin_info.logtag, REHLDS_API_VERSION_MAJOR, majorVersion); + UTIL_ServerPrint("[%s]: ReHLDS API major version mismatch; expected %d, real %d\n", Plugin_info.logtag, REHLDS_API_VERSION_MAJOR, majorVersion); + + // need to notify that it is necessary to update the ReHLDS. + if (majorVersion < REHLDS_API_VERSION_MAJOR) + { + UTIL_ServerPrint("[%s]: Please update the ReHLDS up to a major version API >= %d\n", Plugin_info.logtag, REHLDS_API_VERSION_MAJOR); + } + + // need to notify that it is necessary to update the module. + else if (majorVersion > REHLDS_API_VERSION_MAJOR) + { + UTIL_ServerPrint("[%s]: Please update the %s up to a major version API >= %d\n", Plugin_info.logtag, Plugin_info.logtag, majorVersion); + } + return false; } if (minorVersion < REHLDS_API_VERSION_MINOR) { - UTIL_ServerPrint("[%s]: ReHLDS Api minor version mismatch; expected at least %d, real %d\n", Plugin_info.logtag, REHLDS_API_VERSION_MINOR, minorVersion); + UTIL_ServerPrint("[%s]: ReHLDS API minor version mismatch; expected at least %d, real %d\n", Plugin_info.logtag, REHLDS_API_VERSION_MINOR, minorVersion); + UTIL_ServerPrint("[%s]: Please update the ReHLDS up to a minor version API >= %d\n", Plugin_info.logtag, REHLDS_API_VERSION_MINOR); return false; } diff --git a/reapi/src/mods/mod_reunion_api.cpp b/reapi/src/mods/mod_reunion_api.cpp index 17a5381..0001666 100644 --- a/reapi/src/mods/mod_reunion_api.cpp +++ b/reapi/src/mods/mod_reunion_api.cpp @@ -12,13 +12,29 @@ bool ReunionApi_Init() if (!g_ReunionApi) return false; - if (g_ReunionApi->version_major != REUNION_API_VERSION_MAJOR) { - UTIL_ServerPrint("[%s]: Reunion Api major version mismatch; expected %d, real %d\n", Plugin_info.logtag, REUNION_API_VERSION_MAJOR, g_ReunionApi->version_major); + if (g_ReunionApi->version_major != REUNION_API_VERSION_MAJOR) + { + UTIL_ServerPrint("[%s]: Reunion API major version mismatch; expected %d, real %d\n", Plugin_info.logtag, REUNION_API_VERSION_MAJOR, g_ReunionApi->version_major); + + // need to notify that it is necessary to update the Reunion. + if (g_ReunionApi->version_major < REUNION_API_VERSION_MAJOR) + { + UTIL_ServerPrint("[%s]: Please update the Reunion up to a major version API >= %d\n", Plugin_info.logtag, REUNION_API_VERSION_MAJOR); + } + + // need to notify that it is necessary to update the module. + else if (g_ReunionApi->version_major > REUNION_API_VERSION_MAJOR) + { + UTIL_ServerPrint("[%s]: Please update the %s up to a major version API >= %d\n", Plugin_info.logtag, Plugin_info.logtag, g_ReunionApi->version_major); + } + return false; } - if (g_ReunionApi->version_minor < REUNION_API_VERSION_MINOR) { - UTIL_ServerPrint("[%s]: Reunion Api minor version mismatch; expected at least %d, real %d\n", Plugin_info.logtag, REUNION_API_VERSION_MINOR, g_ReunionApi->version_minor); + if (g_ReunionApi->version_minor < REUNION_API_VERSION_MINOR) + { + UTIL_ServerPrint("[%s]: Reunion API minor version mismatch; expected at least %d, real %d\n", Plugin_info.logtag, REUNION_API_VERSION_MINOR, g_ReunionApi->version_minor); + UTIL_ServerPrint("[%s]: Please update the Reunion up to a minor version API >= %d\n", Plugin_info.logtag, REUNION_API_VERSION_MINOR); return false; } diff --git a/reapi/src/mods/mod_vtc_api.cpp b/reapi/src/mods/mod_vtc_api.cpp index ae826a6..ed2e678 100644 --- a/reapi/src/mods/mod_vtc_api.cpp +++ b/reapi/src/mods/mod_vtc_api.cpp @@ -15,13 +15,29 @@ bool VTC_Api_Init() int majorVersion = g_pVoiceTranscoderApi->GetMajorVersion(); int minorVersion = g_pVoiceTranscoderApi->GetMinorVersion(); - if (majorVersion != VOICETRANSCODER_API_VERSION_MAJOR) { - UTIL_ServerPrint("[%s]: VTC Api major version mismatch; expected %d, real %d\n", Plugin_info.logtag, VOICETRANSCODER_API_VERSION_MAJOR, majorVersion); + if (majorVersion != VOICETRANSCODER_API_VERSION_MAJOR) + { + UTIL_ServerPrint("[%s]: VTC API major version mismatch; expected %d, real %d\n", Plugin_info.logtag, VOICETRANSCODER_API_VERSION_MAJOR, majorVersion); + + // need to notify that it is necessary to update the VTC. + if (majorVersion < VOICETRANSCODER_API_VERSION_MAJOR) + { + UTIL_ServerPrint("[%s]: Please update the VTC up to a major version API >= %d\n", Plugin_info.logtag, VOICETRANSCODER_API_VERSION_MAJOR); + } + + // need to notify that it is necessary to update the module. + else if (majorVersion > VOICETRANSCODER_API_VERSION_MAJOR) + { + UTIL_ServerPrint("[%s]: Please update the %s up to a major version API >= %d\n", Plugin_info.logtag, Plugin_info.logtag, majorVersion); + } + return false; } - if (minorVersion < VOICETRANSCODER_API_VERSION_MINOR) { - UTIL_ServerPrint("[%s]: VTC Api minor version mismatch; expected at least %d, real %d\n", Plugin_info.logtag, VOICETRANSCODER_API_VERSION_MINOR, minorVersion); + if (minorVersion < VOICETRANSCODER_API_VERSION_MINOR) + { + UTIL_ServerPrint("[%s]: VTC API minor version mismatch; expected at least %d, real %d\n", Plugin_info.logtag, VOICETRANSCODER_API_VERSION_MINOR, minorVersion); + UTIL_ServerPrint("[%s]: Please update the VTC up to a minor version API >= %d\n", Plugin_info.logtag, VOICETRANSCODER_API_VERSION_MINOR); return false; }