mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add /team -1
This commit is contained in:
parent
1ee4f0117c
commit
1cf43b48ae
|
@ -1034,6 +1034,9 @@ void CGameContext::ConJoinTeam(IConsole::IResult *pResult, void *pUserData)
|
|||
{
|
||||
int Team = pResult->GetInteger(0);
|
||||
|
||||
if(Team < 0 || Team >= MAX_CLIENTS )
|
||||
Team = pController->m_Teams.GetFirstEmptyTeam();
|
||||
|
||||
if(pPlayer->m_Last_Team + (int64_t)pSelf->Server()->TickSpeed() * g_Config.m_SvTeamChangeDelay > pSelf->Server()->Tick())
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join",
|
||||
|
|
|
@ -1072,3 +1072,11 @@ void CGameTeams::ResetSavedTeam(int ClientID, int Team)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
int CGameTeams::GetFirstEmptyTeam()
|
||||
{
|
||||
for(int i = 1; i < MAX_CLIENTS; i++)
|
||||
if(m_TeamState[i] == TEAMSTATE_EMPTY)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -111,6 +111,8 @@ public:
|
|||
void SwapTeamCharacters(CPlayer *pPlayer, CPlayer *pTargetPlayer, int Team);
|
||||
void ProcessSaveTeam();
|
||||
|
||||
int GetFirstEmptyTeam() const;
|
||||
|
||||
bool TeeStarted(int ClientID)
|
||||
{
|
||||
return m_TeeStarted[ClientID];
|
||||
|
|
Loading…
Reference in a new issue