mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge pull request #7227 from furo321/swap-without-name
Add ability to swap without a name when team only has 2 players.
This commit is contained in:
commit
774d32713d
|
@ -708,14 +708,31 @@ void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
|
|||
}
|
||||
|
||||
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;
|
||||
break;
|
||||
if(pSelf->m_apPlayers[i] && !str_comp(pName, pSelf->Server()->ClientName(i)))
|
||||
{
|
||||
TargetClientId = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int TeamSize = 1;
|
||||
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 != 2)
|
||||
TargetClientId = -1;
|
||||
}
|
||||
|
||||
if(TargetClientId < 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue