mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #4475
4475: Enable swapping in team 0 r=heinrich5991 a=def- <!-- What is the motivation for the changes of this pull request --> ## Checklist - [x] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [x] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [x] Considered possible null pointers and out of bounds array indexing - [x] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
fbbc8baa8d
|
@ -697,7 +697,7 @@ void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
|
|||
|
||||
int Team = Teams.m_Core.Team(pResult->m_ClientID);
|
||||
|
||||
if(Team < TEAM_FLOCK || (Team == TEAM_FLOCK && g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO) || Team >= TEAM_SUPER)
|
||||
if(Team < TEAM_FLOCK || Team >= TEAM_SUPER)
|
||||
{
|
||||
pSelf->Console()->Print(
|
||||
IConsole::OUTPUT_LEVEL_STANDARD,
|
||||
|
@ -735,14 +735,23 @@ void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
|
|||
return;
|
||||
}
|
||||
|
||||
if(!Teams.IsStarted(Team))
|
||||
CPlayer *pSwapPlayer = pSelf->m_apPlayers[TargetClientId];
|
||||
if(Team == TEAM_FLOCK && g_Config.m_SvTeam != 3)
|
||||
{
|
||||
CCharacter *pChr = pPlayer->GetCharacter();
|
||||
CCharacter *pSwapChr = pSwapPlayer->GetCharacter();
|
||||
if(!pChr || !pSwapChr || pChr->m_DDRaceState != DDRACE_STARTED || pSwapChr->m_DDRaceState != DDRACE_STARTED)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "swap", "You and other player need to have started the map");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(!Teams.IsStarted(Team))
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "swap", "Need to have started the map to swap with a player.");
|
||||
return;
|
||||
}
|
||||
|
||||
CPlayer *pSwapPlayer = pSelf->m_apPlayers[TargetClientId];
|
||||
|
||||
bool SwapPending = pSwapPlayer->m_SwapTargetsClientID != pResult->m_ClientID;
|
||||
if(SwapPending)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue