blob: c57a494fbbffe23aaf0753cb3546e12b587c2137 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef ENGINESINGLEUSERFILTER_H
#define ENGINESINGLEUSERFILTER_H
#ifdef _WIN32
#pragma once
#endif
#include "irecipientfilter.h"
#include "bitvec.h"
#include "utlvector.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CEngineRecipientFilter : public IRecipientFilter
{
public: // IRecipientFilter interface:
CEngineRecipientFilter();
virtual int GetRecipientCount( void ) const;
virtual int GetRecipientIndex( int slot ) const;
virtual bool IsReliable( void ) const { return m_bReliable; };
virtual bool IsInitMessage( void ) const { return m_bInit; };
public:
void Reset( void );
void MakeInitMessage( void );
void MakeReliable( void );
void AddAllPlayers( void );
void AddRecipientsByPVS( const Vector& origin );
void AddRecipientsByPAS( const Vector& origin );
void AddPlayersFromBitMask( CBitVec< ABSOLUTE_PLAYER_LIMIT >& playerbits );
void AddPlayersFromFilter( const IRecipientFilter *filter );
void AddRecipient( int playerindex );
void RemoveRecipient( int playerindex );
bool IncludesPlayer(int playerindex);
private:
bool m_bInit;
bool m_bReliable;
CUtlVector< int > m_Recipients;
};
//-----------------------------------------------------------------------------
// Purpose: Simple filter for doing MSG_ONE type stuff directly in engine
//-----------------------------------------------------------------------------
class CEngineSingleUserFilter : public IRecipientFilter
{
public:
CEngineSingleUserFilter( int clientindex, bool bReliable = false )
{
m_nClientIndex = clientindex;
m_bReliable = bReliable;
}
virtual bool IsReliable( void ) const
{
return m_bReliable;
}
virtual int GetRecipientCount( void ) const
{
return 1;
}
virtual int GetRecipientIndex( int slot ) const
{
return m_nClientIndex;
}
virtual bool IsBroadcastMessage( void ) const
{
return false;
}
virtual bool IsInitMessage( void ) const
{
return false;
}
private:
int m_nClientIndex;
bool m_bReliable;
};
#endif // ENGINESINGLEUSERFILTER_H
|