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.

71 lines
1.3 KiB

  1. #ifndef INCLUDED_funfact_cs
  2. #define INCLUDED_funfact_cs
  3. #pragma once
  4. #include "cs_shareddefs.h"
  5. struct FunFact
  6. {
  7. FunFact() :
  8. id(-1),
  9. szLocalizationToken(NULL),
  10. iPlayer(0),
  11. iData1(0),
  12. iData2(0),
  13. iData3(0),
  14. fMagnitude(0.0f)
  15. {}
  16. int id;
  17. const char* szLocalizationToken;
  18. int iPlayer;
  19. int iData1;
  20. int iData2;
  21. int iData3;
  22. float fMagnitude;
  23. };
  24. typedef CUtlVector<FunFact> FunFactVector;
  25. class FunFactEvaluator
  26. {
  27. DECLARE_CLASS_NOBASE( FunFactEvaluator );
  28. public:
  29. FunFactEvaluator( int id, const char* szLocalizationToken, float fCoolness ) :
  30. m_id(id),
  31. m_pLocalizationToken(szLocalizationToken),
  32. m_fCoolness(fCoolness)
  33. {}
  34. virtual ~FunFactEvaluator() {}
  35. int GetId() const { return m_id; }
  36. const char* GetLocalizationToken() const { return m_pLocalizationToken; }
  37. float GetCoolness() const { return m_fCoolness; }
  38. virtual bool Evaluate( e_RoundEndReason iRoundResult, FunFactVector& results ) const = 0;
  39. private:
  40. int m_id;
  41. const char* m_pLocalizationToken;
  42. float m_fCoolness;
  43. };
  44. typedef FunFactEvaluator* (*funfactCreateFunc) (void);
  45. class CFunFactHelper
  46. {
  47. public:
  48. CFunFactHelper ( funfactCreateFunc createFunc )
  49. {
  50. m_pfnCreate = createFunc;
  51. m_pNext = s_pFirst;
  52. s_pFirst = this;
  53. }
  54. funfactCreateFunc m_pfnCreate;
  55. CFunFactHelper *m_pNext;
  56. static CFunFactHelper *s_pFirst;
  57. };
  58. #endif // INCLUDED_funfact_cs