core/HalfLife2.cpp
changeset 4195 f98029786a0e
parent 4156 319e80e8e97f
child 4230 45fe61058383
     1.1 --- a/core/HalfLife2.cpp	Mon Dec 30 20:21:33 2013 -0500
     1.2 +++ b/core/HalfLife2.cpp	Tue Jan 07 10:21:53 2014 -0500
     1.3 @@ -201,48 +201,40 @@
     1.4  
     1.5  void CHalfLife2::InitCommandLine()
     1.6  {
     1.7 -	char path[PLATFORM_MAX_PATH];
     1.8  	char error[256];
     1.9 -	
    1.10 -	g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "../bin/" TIER0_NAME);
    1.11 -
    1.12 -	if (!g_LibSys.IsPathFile(path))
    1.13 -	{
    1.14 -		g_Logger.LogError("Could not find path for: " TIER0_NAME);
    1.15 -		return;
    1.16 -	}
    1.17 -
    1.18 -	ke::AutoPtr<ILibrary> lib(g_LibSys.OpenLibrary(path, error, sizeof(error)));
    1.19 -	m_pGetCommandLine = lib->GetSymbolAddress("CommandLine_Tier0");
    1.20  
    1.21 -	/* '_Tier0' dropped on Alien Swarm version */
    1.22 -	if (m_pGetCommandLine == NULL)
    1.23 +	if (!is_original_engine)
    1.24  	{
    1.25 -		m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
    1.26 -	}
    1.27 -
    1.28 -	if (m_pGetCommandLine == NULL)
    1.29 -	{
    1.30 -		/* We probably have a Ship engine. */
    1.31 -		g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "../bin/" VSTDLIB_NAME);
    1.32 -		if (!g_LibSys.IsPathFile(path))
    1.33 +		ke::AutoPtr<ILibrary> lib(g_LibSys.OpenLibrary(TIER0_NAME, error, sizeof(error)));
    1.34 +		if (lib == NULL)
    1.35  		{
    1.36 -			g_Logger.LogError("Could not find path for: " VSTDLIB_NAME);
    1.37 +			g_Logger.LogError("Could not load %s: %s", TIER0_NAME, error);
    1.38  			return;
    1.39  		}
    1.40 +		
    1.41 +		m_pGetCommandLine = lib->GetSymbolAddress("CommandLine_Tier0");
    1.42  
    1.43 -		if ((lib = g_LibSys.OpenLibrary(path, error, sizeof(error))) == NULL)
    1.44 +		/* '_Tier0' dropped on Alien Swarm version */
    1.45 +		if (m_pGetCommandLine == NULL)
    1.46  		{
    1.47 -			g_Logger.LogError("Could not load %s: %s", path, error);
    1.48 +			m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
    1.49 +		}
    1.50 +	}
    1.51 +	else
    1.52 +	{
    1.53 +		ke::AutoPtr<ILibrary> lib(g_LibSys.OpenLibrary(VSTDLIB_NAME, error, sizeof(error)));
    1.54 +		if (lib == NULL)
    1.55 +		{
    1.56 +			g_Logger.LogError("Could not load %s: %s", VSTDLIB_NAME, error);
    1.57  			return;
    1.58  		}
    1.59  
    1.60  		m_pGetCommandLine = lib->GetSymbolAddress("CommandLine");
    1.61 -
    1.62 -		if (m_pGetCommandLine == NULL)
    1.63 -		{
    1.64 -			g_Logger.LogError("Could not locate any command line functionality");
    1.65 -		}
    1.66 +	}
    1.67 +	
    1.68 +	if (m_pGetCommandLine == NULL)
    1.69 +	{
    1.70 +		g_Logger.LogError("Could not locate any command line functionality");
    1.71  	}
    1.72  }
    1.73