core/sourcemm_api.cpp
changeset 1581 2562512b4a44
parent 1541 e46ad208b9b4
child 1582 6f18465dd9f9
     1.1 --- a/core/sourcemm_api.cpp	Mon Oct 15 21:12:52 2007 +0000
     1.2 +++ b/core/sourcemm_api.cpp	Mon Oct 15 22:15:22 2007 +0000
     1.3 @@ -50,6 +50,8 @@
     1.4  IBaseFileSystem *basefilesystem = NULL;
     1.5  IEngineSound *enginesound = NULL;
     1.6  IServerPluginHelpers *serverpluginhelpers = NULL;
     1.7 +IServerPluginCallbacks *vsp_interface = NULL;
     1.8 +int vsp_version = 0;
     1.9  
    1.10  PLUGIN_EXPOSE(SourceMod, g_SourceMod_Core);
    1.11  
    1.12 @@ -82,7 +84,13 @@
    1.13  	gpGlobals = ismm->GetCGlobals();
    1.14  	
    1.15  	ismm->AddListener(this, this);
    1.16 -	ismm->EnableVSPListener();
    1.17 +
    1.18 +#if defined METAMOD_PLAPI_VERSION
    1.19 +	if ((vsp_interface = g_SMAPI->GetVSPInfo(&vsp_version)) == NULL)
    1.20 +#endif
    1.21 +	{
    1.22 +		g_SMAPI->EnableVSPListener();
    1.23 +	}
    1.24  
    1.25  	return g_SourceMod.InitializeSourceMod(error, maxlen, late);
    1.26  }
    1.27 @@ -153,15 +161,44 @@
    1.28  	/* This shouldn't happen */
    1.29  	if (!iface)
    1.30  	{
    1.31 -		g_Logger.LogFatal("Metamod:Source version is out of date. SourceMod requires 1.4 or greater.");
    1.32 +		g_Logger.LogFatal("Metamod:Source version is out of date. SourceMod requires 1.4.2 or greater.");
    1.33 +		return;
    1.34 +	}
    1.35 +
    1.36 +	if (vsp_interface == NULL)
    1.37 +	{
    1.38 +		vsp_interface = iface;
    1.39 +	}
    1.40 +
    1.41 +	if (!g_Loaded)
    1.42 +	{
    1.43  		return;
    1.44  	}
    1.45  
    1.46 +#if defined METAMOD_PLAPI_VERSION
    1.47 +	if (vsp_version == 0)
    1.48 +	{
    1.49 +		g_SMAPI->GetVSPInfo(&vsp_version);
    1.50 +	}
    1.51 +#else
    1.52 +	if (vsp_version == 0)
    1.53 +	{
    1.54 +		if (strcmp(g_SourceMod.GetGameFolderName(), "ship") == 0)
    1.55 +		{
    1.56 +			vsp_version = 1;
    1.57 +		}
    1.58 +		else
    1.59 +		{
    1.60 +			vsp_version = 2;
    1.61 +		}
    1.62 +	}
    1.63 +#endif
    1.64 +
    1.65  	/* Notify! */
    1.66  	SMGlobalClass *pBase = SMGlobalClass::head;
    1.67  	while (pBase)
    1.68  	{
    1.69 -		pBase->OnSourceModVSPReceived(iface);
    1.70 +		pBase->OnSourceModVSPReceived();
    1.71  		pBase = pBase->m_pGlobalClassNext;
    1.72  	}
    1.73  }