summaryrefslogtreecommitdiff
path: root/game/server/cstrike/funfactmgr_cs.h
blob: aac715cd32f67084d830ccab86f7e7ded5ba79cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//========= Copyright Valve Corporation, All rights reserved. ============//
#ifndef FUNFACTMGR_H
#define FUNFACTMGR_H
#ifdef _WIN32
#pragma once
#endif

#include "GameEventListener.h"
#include "funfact_cs.h"
#include "utlmap.h"

class FunFactEvaluator;

class CCSFunFactMgr : public CAutoGameSystemPerFrame, public CGameEventListener
{
public:
	CCSFunFactMgr();
	~CCSFunFactMgr();

	virtual bool Init();
	virtual void Shutdown();
	virtual void Update( float frametime );

	bool GetRoundEndFunFact( int iWinningTeam, int iRoundResult, FunFact& funfact );

protected:
	float ScoreFunFact( const FunFact& funfact );
	void FireGameEvent( IGameEvent *event );

private:

	float m_playerCooldown[MAX_PLAYERS];	// Weights for all players.  Updated every round

	struct FunFactDatabaseEntry
	{
		const FunFactEvaluator* pEvaluator;
		int iOccurrences;
		float fCooldown;
	};
	CUtlMap<int, FunFactDatabaseEntry> m_funFactDatabase;
	int m_numRounds;
};

#endif