sourcemm/metamod.cpp
branchsourcemm-1.6.0
changeset 366 cbfac4e86a2a
parent 365 afdf36dee1a6
child 367 fc76472b980f
     1.1 --- a/sourcemm/metamod.cpp	Sat Sep 29 15:01:32 2007 +0000
     1.2 +++ b/sourcemm/metamod.cpp	Sat Sep 29 15:35:59 2007 +0000
     1.3 @@ -80,6 +80,7 @@
     1.4  SourceHook::ISourceHook *g_SHPtr = &g_SourceHook;
     1.5  PluginId g_PLID = Pl_Console;
     1.6  META_RES last_meta_res;
     1.7 +IServerPluginCallbacks *vsp_callbacks = NULL;
     1.8  
     1.9  MetamodSource g_Metamod;
    1.10  
    1.11 @@ -187,19 +188,19 @@
    1.12  
    1.13  	if (strncmp(iface, "ISERVERPLUGINCALLBACKS", 22) == 0)
    1.14  	{
    1.15 -		IServerPluginCallbacks *pCallbacks = provider->GetVSPCallbacks(iface);
    1.16 +		vsp_callbacks = provider->GetVSPCallbacks(iface);
    1.17  
    1.18 -		if (pCallbacks && vsp_version == 0)
    1.19 +		if (vsp_callbacks != NULL && vsp_version == 0)
    1.20  		{
    1.21  			vsp_version = atoi(&iface[22]);
    1.22  		}
    1.23  
    1.24 -		if (pCallbacks && ret)
    1.25 +		if (ret)
    1.26  		{
    1.27 -			*ret = pCallbacks ? IFACE_OK : IFACE_FAILED;
    1.28 +			*ret = (vsp_callbacks != NULL) ? IFACE_OK : IFACE_FAILED;
    1.29  		}
    1.30  
    1.31 -		return pCallbacks;
    1.32 +		return vsp_callbacks;
    1.33  	}
    1.34  
    1.35  	if (!parsed_game_info)
    1.36 @@ -221,6 +222,15 @@
    1.37  		/* Get value of -game from command line, defaulting to hl2 as engine seems to do */
    1.38  		game_dir = provider->GetCommandLineValue("-game", "hl2");
    1.39  
    1.40 +		if (strcasecmp(game_dir, "ship") == 0)
    1.41 +		{
    1.42 +			engine_build = SOURCE_ENGINE_ORIGINAL;
    1.43 +		}
    1.44 +		else
    1.45 +		{
    1.46 +			engine_build = SOURCE_ENGINE_EPISODEONE;
    1.47 +		}
    1.48 +
    1.49  		/* Get absolute path */
    1.50  		abspath(game_path, game_dir);
    1.51  		mod_path.assign(game_path);
    1.52 @@ -1203,3 +1213,19 @@
    1.53  {
    1.54  	return engine_build;
    1.55  }
    1.56 +
    1.57 +void MetamodSource::NotifyVSPListening(IServerPluginCallbacks *callbacks)
    1.58 +{
    1.59 +	ITER_EVENT(OnVSPListening, (callbacks));
    1.60 +}
    1.61 +
    1.62 +IServerPluginCallbacks *MetamodSource::GetVSPInfo(int *pVersion)
    1.63 +{
    1.64 +	if (pVersion)
    1.65 +	{
    1.66 +		*pVersion = vsp_version;
    1.67 +	}
    1.68 +
    1.69 +	return vsp_callbacks;
    1.70 +}
    1.71 +