Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.6 KiB

  1. //========= Copyright � 1996-2008, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: See memorylog.h
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "memorylog.h"
  8. // memdbgon must be the last include file in a .cpp file!!!
  9. #include "tier0/memdbgon.h"
  10. #if !defined( _CERT )
  11. // Memory log auto game system instantiation
  12. CMemoryLog g_MemoryLog;
  13. const char *GetMapName( void )
  14. {
  15. static char mapName[32];
  16. mapName[0] = 0;
  17. if ( gpGlobals->mapname.ToCStr() )
  18. V_strncpy( mapName, gpGlobals->mapname.ToCStr(), sizeof( mapName ) );
  19. if ( !mapName[ 0 ] )
  20. V_strncpy( mapName, "none", sizeof( mapName ) );
  21. return mapName;
  22. }
  23. void CMemoryLog::LevelInitPostEntity( void )
  24. {
  25. //#include "entitylist.h"
  26. #if defined( PORTAL2 )
  27. const char *mapName = GetMapName();
  28. if ( V_stristr( mapName, "sp_" ) == mapName )
  29. {
  30. // In order to ensure that the map loop never fails, spawn a script entity with the transition script if none exists in the map:
  31. for ( CBaseEntity *pEnt = gEntList.FindEntityByClassname( NULL, "logic_script" ); pEnt; pEnt = gEntList.FindEntityByClassname( pEnt, "logic_script" ) )
  32. {
  33. if ( pEnt && V_stristr( pEnt->GetEntityNameAsCStr(), "transition_script" ) )
  34. return;
  35. }
  36. CBaseEntity *pScriptEntity = (CBaseEntity *)CreateEntityByName( "logic_script" );
  37. pScriptEntity->SetName( MAKE_STRING( "failsafe_transition_script" ) );
  38. pScriptEntity->KeyValue( "thinkfunction", "Think" );
  39. pScriptEntity->KeyValue( "vscripts", "transitions/sp_transition_list.nut" );
  40. DispatchSpawn( pScriptEntity );
  41. }
  42. #endif
  43. }
  44. #endif // !defined( _CERT )