sm-ext-sourcetvmanager/hltvclientwrapper.cpp

53 lines
1.1 KiB
C++
Raw Permalink Normal View History

#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.chars();
}
const char *HLTVClientWrapper::Password()
{
return m_Password.chars();
}
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);
}