forked from peace-maker/sourcetvmanager
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhltvclientwrapper.cpp
52 lines (43 loc) · 1.07 KB
/
hltvclientwrapper.cpp
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
#include "hltvclientwrapper.h"
HLTVClientWrapper::HLTVClientWrapper()
{
m_Client = nullptr;
}
void HLTVClientWrapper::Initialize(const char *ip, const char *password, IClient *client)
{
m_Ip = ip;
m_Password = password;
m_Client = client;
}
const char *HLTVClientWrapper::Name()
{
return m_Client->GetClientName();
}
const char *HLTVClientWrapper::Ip()
{
return m_Ip.c_str();
}
const char *HLTVClientWrapper::Password()
{
return m_Password.c_str();
}
unsigned int HLTVClientWrapper::GetLanguageId()
{
// TODO expose natives to override spectator client language and remove native ifdefs
unsigned int langid = translator->GetServerLanguage();
translator->GetLanguageByName(m_Client->GetUserSetting("cl_language"), &langid);
return langid;
}
bool HLTVClientWrapper::IsConnected()
{
return m_Client && m_Client->IsConnected();
}
IClient *HLTVClientWrapper::BaseClient()
{
return m_Client;
}
void HLTVClientWrapper::Kick(const char *reason)
{
// Go this route due to different IClient::Disconnect signatures in games..
m_Client->GetServer()->DisconnectClient(m_Client, reason);
}