Team Fortress 2 Source Code as on 22/4/2020
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.4 KiB

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