Skip to content

Commit

Permalink
Merge pull request ddnet#8673 from Robyt3/Server-Swap-Solo-Message
Browse files Browse the repository at this point in the history
Add error message when trying to `/swap` on forced solo server, minor cleanup
  • Loading branch information
def- authored Aug 1, 2024
2 parents 44ff68a + 7930eb9 commit c532aba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/game/server/ddracechat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,15 @@ void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
return;
}

if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO)
{
pSelf->Console()->Print(
IConsole::OUTPUT_LEVEL_STANDARD,
"chatresp",
"Swap is not available on forced solo servers.");
return;
}

CGameTeams &Teams = pSelf->m_pController->Teams();

int Team = Teams.m_Core.Team(pResult->m_ClientId);
Expand Down Expand Up @@ -804,7 +813,7 @@ void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
}

CPlayer *pSwapPlayer = pSelf->m_apPlayers[TargetClientId];
if((Team == TEAM_FLOCK || Teams.TeamFlock(Team)) && g_Config.m_SvTeam != 3)
if(Team == TEAM_FLOCK || Teams.TeamFlock(Team))
{
CCharacter *pChr = pPlayer->GetCharacter();
CCharacter *pSwapChr = pSwapPlayer->GetCharacter();
Expand Down
2 changes: 1 addition & 1 deletion src/game/server/teams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void CGameTeams::OnCharacterStart(int ClientId)
}
}

if(g_Config.m_SvTeam < SV_TEAM_FORCED_SOLO && g_Config.m_SvMaxTeamSize != 2 && g_Config.m_SvPauseable)
if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && g_Config.m_SvMaxTeamSize != 2 && g_Config.m_SvPauseable)
{
for(int i = 0; i < MAX_CLIENTS; ++i)
{
Expand Down

0 comments on commit c532aba

Please sign in to comment.