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.

50 lines
1.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Events that are available to all NPCs.
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "ai_basenpc.h"
  8. #include "eventlist.h"
  9. #include "stringregistry.h"
  10. // memdbgon must be the last include file in a .cpp file!!!
  11. #include "tier0/memdbgon.h"
  12. //=============================================================================
  13. // Init static variables
  14. //=============================================================================
  15. CStringRegistry* CAI_BaseNPC::m_pEventSR = NULL;
  16. int CAI_BaseNPC::m_iNumEvents = 0;
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Add an activity to the activity string registry and increment
  19. // the acitivty counter
  20. //-----------------------------------------------------------------------------
  21. void CAI_BaseNPC::AddEventToSR(const char *eventName, int eventID)
  22. {
  23. MEM_ALLOC_CREDIT();
  24. Assert( m_pEventSR );
  25. m_pEventSR->AddString( eventName, eventID );
  26. m_iNumEvents++;
  27. }
  28. //-----------------------------------------------------------------------------
  29. // Purpose: Given and activity ID, return the activity name
  30. //-----------------------------------------------------------------------------
  31. const char *CAI_BaseNPC::GetEventName(int eventID)
  32. {
  33. const char *name = m_pEventSR->GetStringText( eventID );
  34. return name;
  35. }
  36. //-----------------------------------------------------------------------------
  37. // Purpose: Given and activity name, return the activity ID
  38. //-----------------------------------------------------------------------------
  39. int CAI_BaseNPC::GetEventID(const char* eventName)
  40. {
  41. return m_pEventSR->GetStringID( eventName );
  42. }