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.

49 lines
1.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Some macros for the raytraces-in-think-function-counter.
  4. // They're in a header because they're included in a bunch of
  5. // places, but on some cases they need to define files and in
  6. // others only extern them.
  7. //
  8. //=============================================================================//
  9. #ifndef THINK_TRACE_COUNTER_H
  10. #define THINK_TRACE_COUNTER_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #define THINK_TRACE_COUNTER_COMPILED 1 // without this, all the code is elided.
  15. #ifdef THINK_TRACE_COUNTER_COMPILED
  16. // create a macro that is true if we are allowed to debug traces during thinks, and compiles out to nothing otherwise.
  17. #if defined( _GAMECONSOLE ) || defined( NO_STEAM )
  18. #define DEBUG_THINK_TRACE_COUNTER_ALLOWED() (!IsCert())
  19. #else
  20. #ifdef THINK_TRACE_COUNTER_COMPILE_FUNCTIONS_ENGINE
  21. bool DEBUG_THINK_TRACE_COUNTER_ALLOWED()
  22. {
  23. // done as a static var to defer initialization until Steam is ready,
  24. // but also to have the fastest check at runtime (rather than calling through
  25. // the API each time)
  26. static bool bIsPublic = GetSteamUniverse() == k_EUniversePublic;
  27. return !bIsPublic;
  28. }
  29. #elif defined( THINK_TRACE_COUNTER_COMPILE_FUNCTIONS_SERVER )
  30. bool DEBUG_THINK_TRACE_COUNTER_ALLOWED()
  31. {
  32. // done as a static var to defer initialization until Steam is ready,
  33. // but also to have the fastest check at runtime (rather than calling through
  34. // the API each time)
  35. static bool bIsPublic = steamapicontext->SteamUtils() != NULL && steamapicontext->SteamUtils()->GetConnectedUniverse() == k_EUniversePublic;
  36. return !bIsPublic;
  37. }
  38. #else
  39. extern bool DEBUG_THINK_TRACE_COUNTER_ALLOWED();
  40. #endif
  41. #endif
  42. #endif
  43. #endif // THINK_TRACE_COUNTER_H