Remove duplicate plugin interface version string literal

This commit is contained in:
Kawe Mazidjatari 2023-07-02 22:23:20 +02:00
parent a0419eec11
commit 5032644b7f
3 changed files with 5 additions and 6 deletions

View File

@ -28,7 +28,6 @@ CPluginSDK::CPluginSDK(const char* pszSelfModule) : m_FactoryInstance(nullptr),
//---------------------------------------------------------------------------------
CPluginSDK::~CPluginSDK()
{
}
//---------------------------------------------------------------------------------
@ -54,12 +53,12 @@ bool CPluginSDK::InitSDK()
return false;
// Let's make sure the SDK version matches with the PluginSystem, else we unload
bool isPluginVersionOk = strcmp(m_FactoryInstance->GetFactoryFullName("VPluginSystem"), PLUGINSDK_CLASS_VERSION) == 0;
bool isPluginVersionOk = strcmp(m_FactoryInstance->GetFactoryFullName("VPluginSystem"), INTERFACEVERSION_PLUGINSYSTEM) == 0;
Assert(isPluginVersionOk, "Version mismatch between CPluginSDK and CPluginSystem.");
if (!isPluginVersionOk)
return false;
m_PluginSystem = m_FactoryInstance->GetFactoryPtr(PLUGINSDK_CLASS_VERSION, false).RCast<IPluginSystem*>();
m_PluginSystem = m_FactoryInstance->GetFactoryPtr(INTERFACEVERSION_PLUGINSYSTEM, false).RCast<IPluginSystem*>();
Assert(m_PluginSystem, "m_PluginSystem was nullptr.");
if (!m_PluginSystem)
return false;

View File

@ -21,5 +21,5 @@ private:
CModule m_GameModule;
CModule m_SDKModule;
};
constexpr const char* PLUGINSDK_CLASS_VERSION = "VPluginSystem001";
extern CPluginSDK* g_pPluginSDK;

View File

@ -1,5 +1,7 @@
#pragma once
#define INTERFACEVERSION_PLUGINSYSTEM "VPluginSystem001"
struct PluginHelpWithAnything_t
{
enum class ePluginHelp : int16_t
@ -26,5 +28,3 @@ abstract_class IPluginSystem
public:
virtual void* HelpWithAnything(PluginHelpWithAnything_t * help) = 0;
};
constexpr auto INTERFACEVERSION_PLUGINSYSTEM = "VPluginSystem001";