mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add ability to swap without a name when team only has 2 players.
This commit is contained in:
parent
cd37c2d5b3
commit
992a26c7ca
|
@ -708,14 +708,31 @@ void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
|
||||||
}
|
}
|
||||||
|
|
||||||
int TargetClientId = -1;
|
int TargetClientId = -1;
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
if(pResult->NumArguments() == 1)
|
||||||
{
|
{
|
||||||
if(pSelf->m_apPlayers[i] && !str_comp(pName, pSelf->Server()->ClientName(i)))
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
TargetClientId = i;
|
if(pSelf->m_apPlayers[i] && !str_comp(pName, pSelf->Server()->ClientName(i)))
|
||||||
break;
|
{
|
||||||
|
TargetClientId = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int TeamSize = 0;
|
||||||
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
|
{
|
||||||
|
if(pSelf->m_apPlayers[i] && Teams.m_Core.Team(i) == Team && i != pResult->m_ClientID)
|
||||||
|
{
|
||||||
|
TargetClientId = i;
|
||||||
|
TeamSize++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(TeamSize > 1)
|
||||||
|
TargetClientId = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if(TargetClientId < 0)
|
if(TargetClientId < 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue