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.

45 lines
953 B

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. #ifndef FUNFACTMGR_H
  3. #define FUNFACTMGR_H
  4. #ifdef _WIN32
  5. #pragma once
  6. #endif
  7. #include "GameEventListener.h"
  8. #include "funfact_cs.h"
  9. #include "utlmap.h"
  10. class FunFactEvaluator;
  11. class CCSFunFactMgr : public CAutoGameSystemPerFrame, public CGameEventListener
  12. {
  13. public:
  14. CCSFunFactMgr();
  15. ~CCSFunFactMgr();
  16. virtual bool Init();
  17. virtual void Shutdown();
  18. virtual void Update( float frametime );
  19. bool GetRoundEndFunFact( int iWinningTeam, int iRoundResult, FunFact& funfact );
  20. protected:
  21. float ScoreFunFact( const FunFact& funfact );
  22. void FireGameEvent( IGameEvent *event );
  23. private:
  24. float m_playerCooldown[MAX_PLAYERS]; // Weights for all players. Updated every round
  25. struct FunFactDatabaseEntry
  26. {
  27. const FunFactEvaluator* pEvaluator;
  28. int iOccurrences;
  29. float fCooldown;
  30. };
  31. CUtlMap<int, FunFactDatabaseEntry> m_funFactDatabase;
  32. int m_numRounds;
  33. };
  34. #endif