1
0

resize clients

This commit is contained in:
Your Name 2023-04-15 15:23:42 +08:00
parent 23e421f714
commit 0e53ed004b
7 changed files with 23 additions and 22 deletions

View File

@ -460,7 +460,7 @@ void CFutureLogger::Log(const CLogMessage *pMessage)
return;
}
m_PendingLock.lock();
m_vPending.push_back(*pMessage);
m_vPending.emplace_back(*pMessage);
m_PendingLock.unlock();
}

View File

@ -1448,7 +1448,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
{
// wrong version
char aReason[256];
str_format(aReason, sizeof(aReason), "Wrong version. Server is running '%s' and client '%s'", GameServer()->NetVersion(), pVersion);
str_format(aReason, sizeof(aReason), "无效版本,服务器运行在 '%s' 和 '%s' 客户端", GameServer()->NetVersion(), pVersion);
m_NetServer.Drop(ClientID, aReason);
return;
}
@ -1461,14 +1461,14 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
if(Config()->m_Password[0] != 0 && str_comp(Config()->m_Password, pPassword) != 0)
{
// wrong password
m_NetServer.Drop(ClientID, "Wrong password");
m_NetServer.Drop(ClientID, "密码错误");
return;
}
// reserved slot
if(ClientID >= (Config()->m_SvMaxClients - Config()->m_SvReservedSlots) && Config()->m_SvReservedSlotsPass[0] != 0 && str_comp(Config()->m_SvReservedSlotsPass, pPassword) != 0)
{
m_NetServer.Drop(ClientID, "This server is full");
m_NetServer.Drop(ClientID, "此服务器已满");
return;
}
@ -1517,7 +1517,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
net_addr_str(m_NetServer.ClientAddr(ClientID), aAddrStr, sizeof(aAddrStr), true);
char aBuf[256];
str_format(aBuf, sizeof(aBuf), "player is ready. ClientID=%d addr=<{%s}> secure=%s", ClientID, aAddrStr, m_NetServer.HasSecurityToken(ClientID) ? "yes" : "no");
str_format(aBuf, sizeof(aBuf), "玩家准备就绪 ClientID=%d addr=<{%s}> secure=%s", ClientID, aAddrStr, m_NetServer.HasSecurityToken(ClientID) ? "yes" : "no");
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
void *pPersistentData = 0;

View File

@ -691,19 +691,19 @@ void CConsole::ConCommandAccess(IResult *pResult, void *pUser)
if(pResult->NumArguments() == 2)
{
pCommand->SetAccessLevel(pResult->GetInteger(1));
str_format(aBuf, sizeof(aBuf), "版主使用 '%s' 权限 %s", pResult->GetString(0), pCommand->GetAccessLevel() ? "已启用" : "已禁用");
str_format(aBuf, sizeof(aBuf), "版主访问 '%s' 权限 %s", pResult->GetString(0), pCommand->GetAccessLevel() ? "已启用" : "已禁用");
pConsole->Print(OUTPUT_LEVEL_STANDARD, "console", aBuf);
str_format(aBuf, sizeof(aBuf), "助手使用 '%s' 权限 %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_HELPER ? "已启用" : "已禁用");
str_format(aBuf, sizeof(aBuf), "助手访问 '%s' 权限 %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_HELPER ? "已启用" : "已禁用");
pConsole->Print(OUTPUT_LEVEL_STANDARD, "console", aBuf);
str_format(aBuf, sizeof(aBuf), "用户使用 '%s' 权限 %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_USER ? "已启用" : "已禁用");
str_format(aBuf, sizeof(aBuf), "用户访问 '%s' 权限 %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_USER ? "已启用" : "已禁用");
}
else
{
str_format(aBuf, sizeof(aBuf), "版主使用 '%s' %s", pResult->GetString(0), pCommand->GetAccessLevel() ? "已启用" : "已禁用");
str_format(aBuf, sizeof(aBuf), "版主访问 '%s' %s", pResult->GetString(0), pCommand->GetAccessLevel() ? "已启用" : "已禁用");
pConsole->Print(OUTPUT_LEVEL_STANDARD, "console", aBuf);
str_format(aBuf, sizeof(aBuf), "助手使用 '%s' %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_HELPER ? "已启用" : "已禁用");
str_format(aBuf, sizeof(aBuf), "助手访问 '%s' %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_HELPER ? "已启用" : "已禁用");
pConsole->Print(OUTPUT_LEVEL_STANDARD, "console", aBuf);
str_format(aBuf, sizeof(aBuf), "用户使用 '%s' %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_USER ? "已启用" : "已禁用");
str_format(aBuf, sizeof(aBuf), "用户访问 '%s' %s", pResult->GetString(0), pCommand->GetAccessLevel() >= ACCESS_LEVEL_USER ? "已启用" : "已禁用");
}
}
else

View File

@ -59,7 +59,7 @@ enum
NET_MAX_PAYLOAD = NET_MAX_PACKETSIZE - 6,
NET_MAX_CHUNKHEADERSIZE = 5,
NET_PACKETHEADERSIZE = 3,
NET_MAX_CLIENTS = 15000,
NET_MAX_CLIENTS = 255,
NET_MAX_CONSOLE_CLIENTS = 4,
NET_MAX_SEQUENCE = 1 << 10,
NET_SEQUENCE_MASK = NET_MAX_SEQUENCE - 1,

View File

@ -5,6 +5,7 @@
#include <bitset>
/*
Connection diagram - How the initialization works.
@ -84,8 +85,8 @@ enum
MAX_SERVER_ADDRESSES = 16,
SERVERINFO_MAX_CLIENTS = 128,
MAX_CLIENTS = 15000,
VANILLA_MAX_CLIENTS = 255,
MAX_CLIENTS = 255,
VANILLA_MAX_CLIENTS = 64,
MAX_CHECKPOINTS = 25,
MIN_TICK = 0,
MAX_TICK = 0x6FFFFFFF,

View File

@ -514,7 +514,7 @@ void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText, in
char aBuf[256], aText[256];
str_copy(aText, pText, sizeof(aText));
if(ChatterClientID >= 0 && ChatterClientID < MAX_CLIENTS)
str_format(aBuf, sizeof(aBuf), "%d:%d:%s: %s", ChatterClientID, Team, Server()->ClientName(ChatterClientID), aText);
str_format(aBuf, sizeof(aBuf), "[%d:%d:%s]: %s", ChatterClientID, Team, Server()->ClientName(ChatterClientID), aText);
else if(ChatterClientID == -2)
{
str_format(aBuf, sizeof(aBuf), "### %s", aText);
@ -562,7 +562,7 @@ void CGameContext::SendChat(int ChatterClientID, int Team, const char *pText, in
// pack one for the recording only
if(g_Config.m_SvDemoChat)
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NOSEND, SERVER_DEMO_CLIENT);
// send to the clients
for(int i = 0; i < Server()->MaxClients(); i++)
{
@ -1086,7 +1086,7 @@ void CGameContext::OnTick()
Console()->ExecuteLine(m_aVoteCommand);
Server()->SetRconCID(IServer::RCON_CID_SERV);
EndVote();
SendChat(-1, CGameContext::CHAT_ALL, "Vote passed", -1, CHAT_SIX);
SendChat(-1, CGameContext::CHAT_ALL, "投票通过", -1, CHAT_SIX);
if(m_apPlayers[m_VoteCreator] && !IsKickVote() && !IsSpecVote())
m_apPlayers[m_VoteCreator]->m_LastVoteCall = 0;
@ -1109,7 +1109,7 @@ void CGameContext::OnTick()
if(VetoStop || (m_VoteWillPass && Veto))
SendChat(-1, CGameContext::CHAT_ALL, "Vote failed because of veto. Find an empty server instead", -1, CHAT_SIX);
else
SendChat(-1, CGameContext::CHAT_ALL, "Vote failed", -1, CHAT_SIX);
SendChat(-1, CGameContext::CHAT_ALL, "投票失败", -1, CHAT_SIX);
}
else if(m_VoteUpdate)
{

View File

@ -410,12 +410,12 @@ void IGameController::OnPlayerDisconnect(class CPlayer *pPlayer, const char *pRe
{
char aBuf[512];
if(pReason && *pReason)
str_format(aBuf, sizeof(aBuf), "'%s' has left the game (%s)", Server()->ClientName(ClientID), pReason);
str_format(aBuf, sizeof(aBuf), "'%s' 离开了游戏 (%s)", Server()->ClientName(ClientID), pReason);
else
str_format(aBuf, sizeof(aBuf), "'%s' has left the game", Server()->ClientName(ClientID));
str_format(aBuf, sizeof(aBuf), "'%s' 离开了游戏", Server()->ClientName(ClientID));
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf, -1, CGameContext::CHAT_SIX);
str_format(aBuf, sizeof(aBuf), "leave player='%d:%s'", ClientID, Server()->ClientName(ClientID));
str_format(aBuf, sizeof(aBuf), "玩家离开='%d:%s'", ClientID, Server()->ClientName(ClientID));
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "game", aBuf);
}
}
@ -740,7 +740,7 @@ void IGameController::DoTeamChange(CPlayer *pPlayer, int Team, bool DoChatMsg)
DoChatMsg = false;
if(DoChatMsg)
{
str_format(aBuf, sizeof(aBuf), "'%s' joined the %s", Server()->ClientName(ClientID), GameServer()->m_pController->GetTeamName(Team));
str_format(aBuf, sizeof(aBuf), "'%s' 已加入 %s", Server()->ClientName(ClientID), GameServer()->m_pController->GetTeamName(Team));
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf);
}