core/NextMap.cpp
changeset 2400 76b7b4575e21
parent 2205 2e628fb36eef
child 2583 d3b2571c378b
     1.1 --- a/core/NextMap.cpp	Fri Nov 14 03:38:59 2008 -0600
     1.2 +++ b/core/NextMap.cpp	Fri Nov 14 09:18:30 2008 -0600
     1.3 @@ -40,7 +40,7 @@
     1.4  
     1.5  SH_DECL_HOOK2_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, const char *);
     1.6  
     1.7 -#if defined ORANGEBOX_BUILD
     1.8 +#if SOURCE_ENGINE >= SE_ORANGEBOX
     1.9  SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
    1.10  #else
    1.11  extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
    1.12 @@ -55,30 +55,13 @@
    1.13  
    1.14  void NextMapManager::OnSourceModAllInitialized_Post()
    1.15  {
    1.16 -#if defined ORANGEBOX_BUILD
    1.17 +#if SOURCE_ENGINE >= SE_ORANGEBOX
    1.18  	SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
    1.19  #else
    1.20  	SH_ADD_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
    1.21  #endif
    1.22  
    1.23 -	ConCommandBase *pBase = icvar->GetCommands();
    1.24 -	ConCommand *pCmd = NULL;
    1.25 -	while (pBase)
    1.26 -	{
    1.27 -		if (strcmp(pBase->GetName(), "changelevel") == 0)
    1.28 -		{
    1.29 -			/* Don't want to return convar with same name */
    1.30 -			if (!pBase->IsCommand())
    1.31 -			{
    1.32 -				break;
    1.33 -			}
    1.34 -
    1.35 -			pCmd = (ConCommand *)pBase;
    1.36 -			break;
    1.37 -		}
    1.38 -		pBase = const_cast<ConCommandBase *>(pBase->GetNext());
    1.39 -	}
    1.40 -
    1.41 +	ConCommand *pCmd = FindCommand("changelevel");
    1.42  	if (pCmd != NULL)
    1.43  	{
    1.44  		SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CmdChangeLevelCallback, false);
    1.45 @@ -88,7 +71,7 @@
    1.46  
    1.47  void NextMapManager::OnSourceModShutdown()
    1.48  {
    1.49 -#if defined ORANGEBOX_BUILD
    1.50 +#if SOURCE_ENGINE >= SE_ORANGEBOX
    1.51  	SH_REMOVE_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
    1.52  #else
    1.53  	SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
    1.54 @@ -203,7 +186,7 @@
    1.55  	m_mapHistory = SourceHook::List<MapChangeData *>();
    1.56  }
    1.57  
    1.58 -#if defined ORANGEBOX_BUILD
    1.59 +#if SOURCE_ENGINE >= SE_ORANGEBOX
    1.60  void CmdChangeLevelCallback(const CCommand &command)
    1.61  {
    1.62  #else