diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index 165d49bac..69aeccbd7 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -143,9 +143,9 @@ void CGameContext::ConSettings(IConsole::IResult *pResult, void *pUserData) if(str_comp(pArg, "teams") == 0) { str_format(aBuf, sizeof(aBuf), "%s %s", - g_Config.m_SvTeam == 1 ? + g_Config.m_SvTeam == SV_TEAM_ALLOWED ? "Teams are available on this server" : - (g_Config.m_SvTeam == 0 || g_Config.m_SvTeam == 3) ? + (g_Config.m_SvTeam == SV_TEAM_FORBIDDEN || g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) ? "Teams are not available on this server" : "You have to be in a team to play on this server", /*g_Config.m_SvTeamStrict ? "and if you die in a team all of you die" : */ "and all of your team will die if the team is locked"); @@ -618,7 +618,7 @@ void CGameContext::ConPractice(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 != 3) || Team >= TEAM_SUPER) + if(Team < TEAM_FLOCK || (Team == TEAM_FLOCK && g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO) || Team >= TEAM_SUPER) { pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, @@ -695,7 +695,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 != 3) || Team >= TEAM_SUPER) + if(Team < TEAM_FLOCK || (Team == TEAM_FLOCK && g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO) || Team >= TEAM_SUPER) { pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, @@ -839,7 +839,7 @@ void CGameContext::ConLockTeam(IConsole::IResult *pResult, void *pUserData) if(!CheckClientID(pResult->m_ClientID)) return; - if(g_Config.m_SvTeam == 0 || g_Config.m_SvTeam == 3) + if(g_Config.m_SvTeam == SV_TEAM_FORBIDDEN || g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "lock", "Teams are disabled"); @@ -885,7 +885,7 @@ void CGameContext::ConUnlockTeam(IConsole::IResult *pResult, void *pUserData) if(!CheckClientID(pResult->m_ClientID)) return; - if(g_Config.m_SvTeam == 0 || g_Config.m_SvTeam == 3) + if(g_Config.m_SvTeam == SV_TEAM_FORBIDDEN || g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "unlock", "Teams are disabled"); @@ -918,7 +918,7 @@ void CGameContext::ConInviteTeam(IConsole::IResult *pResult, void *pUserData) CGameControllerDDRace *pController = (CGameControllerDDRace *)pSelf->m_pController; const char *pName = pResult->GetString(0); - if(g_Config.m_SvTeam == 0 || g_Config.m_SvTeam == 3) + if(g_Config.m_SvTeam == SV_TEAM_FORBIDDEN || g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join", "Teams are disabled"); @@ -995,13 +995,13 @@ void CGameContext::ConJoinTeam(IConsole::IResult *pResult, void *pUserData) "You are running a vote please try again after the vote is done!"); return; } - else if(g_Config.m_SvTeam == 0 || g_Config.m_SvTeam == 3) + else if(g_Config.m_SvTeam == SV_TEAM_FORBIDDEN || g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join", "Teams are disabled"); return; } - else if(g_Config.m_SvTeam == 2 && pResult->GetInteger(0) == 0 && pPlayer->GetCharacter() && pPlayer->GetCharacter()->m_LastStartWarning < pSelf->Server()->Tick() - 3 * pSelf->Server()->TickSpeed()) + else if(g_Config.m_SvTeam == SV_TEAM_MANDATORY && pResult->GetInteger(0) == 0 && pPlayer->GetCharacter() && pPlayer->GetCharacter()->m_LastStartWarning < pSelf->Server()->Tick() - 3 * pSelf->Server()->TickSpeed()) { pSelf->Console()->Print( IConsole::OUTPUT_LEVEL_STANDARD, diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index 1d711b114..d2de73cbf 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -707,7 +707,7 @@ void CGameContext::ConSetDDRTeam(IConsole::IResult *pResult, void *pUserData) CGameContext *pSelf = (CGameContext *)pUserData; CGameControllerDDRace *pController = (CGameControllerDDRace *)pSelf->m_pController; - if(g_Config.m_SvTeam == 0 || g_Config.m_SvTeam == 3) + if(g_Config.m_SvTeam == SV_TEAM_FORBIDDEN || g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) { pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join", "Teams are disabled"); diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 11ad6ce93..7725d6898 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -1816,7 +1816,7 @@ void CCharacter::HandleTiles(int Index) m_StartTime -= (min * 60 + sec) * Server()->TickSpeed(); - if((g_Config.m_SvTeam == 3 || Team != TEAM_FLOCK) && Team != TEAM_SUPER) + if((g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO || Team != TEAM_FLOCK) && Team != TEAM_SUPER) { for(int i = 0; i < MAX_CLIENTS; i++) { @@ -1842,7 +1842,7 @@ void CCharacter::HandleTiles(int Index) if(m_StartTime > Server()->Tick()) m_StartTime = Server()->Tick(); - if((g_Config.m_SvTeam == 3 || Team != TEAM_FLOCK) && Team != TEAM_SUPER) + if((g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO || Team != TEAM_FLOCK) && Team != TEAM_SUPER) { for(int i = 0; i < MAX_CLIENTS; i++) { @@ -2082,7 +2082,7 @@ void CCharacter::DDRaceTick() HandleTuneLayer(); // need this before coretick // look for save position for rescue feature - if(g_Config.m_SvRescue || ((g_Config.m_SvTeam == 3 || Team() > TEAM_FLOCK) && Team() >= TEAM_FLOCK && Team() < TEAM_SUPER)) + if(g_Config.m_SvRescue || ((g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO || Team() > TEAM_FLOCK) && Team() >= TEAM_FLOCK && Team() < TEAM_SUPER)) { int Index = GameServer()->Collision()->GetPureMapIndex(m_Pos); const int aTiles[] = { @@ -2319,7 +2319,7 @@ void CCharacter::DDRaceInit() } } - if(g_Config.m_SvTeam == 2 && Team == TEAM_FLOCK) + if(g_Config.m_SvTeam == SV_TEAM_MANDATORY && Team == TEAM_FLOCK) { GameServer()->SendStartWarning(GetPlayer()->GetCID(), "Please join a team before you start"); } diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index fdefefc0e..7082dcc01 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -3192,7 +3192,7 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/) g_Config.m_SvOldTeleportHook = 0; g_Config.m_SvOldTeleportWeapons = 0; g_Config.m_SvTeleportHoldHook = 0; - g_Config.m_SvTeam = 1; + g_Config.m_SvTeam = SV_TEAM_ALLOWED; g_Config.m_SvShowOthersDefault = 0; if(Collision()->m_NumSwitchers > 0) @@ -3208,7 +3208,7 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/) if(g_Config.m_SvSoloServer) { - g_Config.m_SvTeam = 3; + g_Config.m_SvTeam = SV_TEAM_FORCED_SOLO; g_Config.m_SvShowOthersDefault = 1; Tuning()->Set("player_collision", 0); diff --git a/src/game/server/gamemodes/DDRace.cpp b/src/game/server/gamemodes/DDRace.cpp index cf65bc0ca..2cc972c8c 100644 --- a/src/game/server/gamemodes/DDRace.cpp +++ b/src/game/server/gamemodes/DDRace.cpp @@ -70,13 +70,13 @@ void CGameControllerDDRace::HandleCharacterTiles(CCharacter *pChr, int MapIndex) pChr->Die(ClientID, WEAPON_WORLD); return; } - if(g_Config.m_SvTeam == 2 && (Team == TEAM_FLOCK || m_Teams.Count(Team) <= 1)) + if(g_Config.m_SvTeam == SV_TEAM_MANDATORY && (Team == TEAM_FLOCK || m_Teams.Count(Team) <= 1)) { GameServer()->SendStartWarning(ClientID, "You have to be in a team with other tees to start"); pChr->Die(ClientID, WEAPON_WORLD); return; } - if(g_Config.m_SvTeam != 3 && Team > TEAM_FLOCK && Team < TEAM_SUPER && m_Teams.Count(Team) < g_Config.m_SvMinTeamSize) + if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && Team > TEAM_FLOCK && Team < TEAM_SUPER && m_Teams.Count(Team) < g_Config.m_SvMinTeamSize) { char aBuf[128]; str_format(aBuf, sizeof(aBuf), "Your team has fewer than %d players, so your team rank won't count", g_Config.m_SvMinTeamSize); @@ -149,7 +149,7 @@ void CGameControllerDDRace::OnPlayerDisconnect(CPlayer *pPlayer, const char *pRe if(!GameServer()->PlayerModerating() && WasModerator) GameServer()->SendChat(-1, CGameContext::CHAT_ALL, "Server kick/spec votes are no longer actively moderated."); - if(g_Config.m_SvTeam != 3) + if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO) m_Teams.SetForceCharacterTeam(ClientID, TEAM_FLOCK); } @@ -179,7 +179,7 @@ void CGameControllerDDRace::DoTeamChange(class CPlayer *pPlayer, int Team, bool if(Team == TEAM_SPECTATORS) { - if(g_Config.m_SvTeam != 3 && pCharacter) + if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && pCharacter) { // Joining spectators should not kill a locked team, but should still // check if the team finished by you leaving it. diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 129ca6142..9c523ad9e 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -702,7 +702,7 @@ void CPlayer::TryRespawn() m_pCharacter->Spawn(this, SpawnPos); GameServer()->CreatePlayerSpawn(SpawnPos, GameServer()->m_pController->GetMaskForPlayerWorldEvent(m_ClientID)); - if(g_Config.m_SvTeam == 3) + if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) m_pCharacter->SetSolo(true); } diff --git a/src/game/server/save.cpp b/src/game/server/save.cpp index 52517e4d0..4636bfb09 100644 --- a/src/game/server/save.cpp +++ b/src/game/server/save.cpp @@ -430,7 +430,7 @@ CSaveTeam::~CSaveTeam() int CSaveTeam::Save(int Team) { - if(g_Config.m_SvTeam == 3 || (Team > 0 && Team < MAX_CLIENTS)) + if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO || (Team > 0 && Team < MAX_CLIENTS)) { CGameTeams *Teams = &(((CGameControllerDDRace *)m_pController)->m_Teams); diff --git a/src/game/server/score.cpp b/src/game/server/score.cpp index baaa85c16..729a00223 100644 --- a/src/game/server/score.cpp +++ b/src/game/server/score.cpp @@ -309,7 +309,7 @@ void CScore::LoadTeam(const char *Code, int ClientID) int Team = pController->m_Teams.m_Core.Team(ClientID); if(pController->m_Teams.GetSaving(Team)) return; - if(Team < TEAM_FLOCK || Team >= MAX_CLIENTS || (g_Config.m_SvTeam != 3 && Team == TEAM_FLOCK)) + if(Team < TEAM_FLOCK || Team >= MAX_CLIENTS || (g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && Team == TEAM_FLOCK)) { GameServer()->SendChatTarget(ClientID, "You have to be in a team (from 1-63)"); return; diff --git a/src/game/server/teams.cpp b/src/game/server/teams.cpp index e15043f02..51d485052 100644 --- a/src/game/server/teams.cpp +++ b/src/game/server/teams.cpp @@ -76,11 +76,11 @@ void CGameTeams::OnCharacterStart(int ClientID) CCharacter *pStartingChar = Character(ClientID); if(!pStartingChar) return; - if(g_Config.m_SvTeam == 3 && pStartingChar->m_DDRaceState == DDRACE_STARTED) + if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO && pStartingChar->m_DDRaceState == DDRACE_STARTED) return; - if((g_Config.m_SvTeam == 3 || m_Core.Team(ClientID) != TEAM_FLOCK) && pStartingChar->m_DDRaceState == DDRACE_FINISHED) + if((g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO || m_Core.Team(ClientID) != TEAM_FLOCK) && pStartingChar->m_DDRaceState == DDRACE_FINISHED) return; - if(g_Config.m_SvTeam != 3 && + if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && (m_Core.Team(ClientID) == TEAM_FLOCK || m_Core.Team(ClientID) == TEAM_SUPER)) { m_TeeStarted[ClientID] = true; @@ -171,7 +171,7 @@ void CGameTeams::OnCharacterStart(int ClientID) } } - if(g_Config.m_SvTeam < 3 && 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) { @@ -187,7 +187,7 @@ void CGameTeams::OnCharacterStart(int ClientID) void CGameTeams::OnCharacterFinish(int ClientID) { - if((m_Core.Team(ClientID) == TEAM_FLOCK && g_Config.m_SvTeam != 3) || m_Core.Team(ClientID) == TEAM_SUPER) + if((m_Core.Team(ClientID) == TEAM_FLOCK && g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO) || m_Core.Team(ClientID) == TEAM_SUPER) { CPlayer *pPlayer = GetPlayer(ClientID); if(pPlayer && pPlayer->IsPlaying()) @@ -391,7 +391,7 @@ void CGameTeams::SetForceCharacterTeam(int ClientID, int Team) m_TeeFinished[ClientID] = false; int OldTeam = m_Core.Team(ClientID); - if(Team != OldTeam && (OldTeam != TEAM_FLOCK || g_Config.m_SvTeam == 3) && OldTeam != TEAM_SUPER && m_TeamState[OldTeam] != TEAMSTATE_EMPTY) + if(Team != OldTeam && (OldTeam != TEAM_FLOCK || g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) && OldTeam != TEAM_SUPER && m_TeamState[OldTeam] != TEAMSTATE_EMPTY) { bool NoElseInOldTeam = Count(OldTeam) <= 1; if(NoElseInOldTeam) @@ -553,7 +553,7 @@ int64_t CGameTeams::TeamMask(int Team, int ExceptID, int Asker) void CGameTeams::SendTeamsState(int ClientID) { - if(g_Config.m_SvTeam == 3) + if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) return; if(!m_pGameContext->m_apPlayers[ClientID]) @@ -647,7 +647,7 @@ void CGameTeams::OnTeamFinish(CPlayer **Players, unsigned int Size, float Time, { PlayerCIDs[i] = Players[i]->GetCID(); - if(g_Config.m_SvRejoinTeam0 && g_Config.m_SvTeam != 3 && (m_Core.Team(Players[i]->GetCID()) >= TEAM_SUPER || !m_TeamLocked[m_Core.Team(Players[i]->GetCID())])) + if(g_Config.m_SvRejoinTeam0 && g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && (m_Core.Team(Players[i]->GetCID()) >= TEAM_SUPER || !m_TeamLocked[m_Core.Team(Players[i]->GetCID())])) { SetForceCharacterTeam(Players[i]->GetCID(), TEAM_FLOCK); char aBuf[512]; @@ -989,7 +989,7 @@ void CGameTeams::OnCharacterSpawn(int ClientID) if(m_Core.Team(ClientID) >= TEAM_SUPER || !m_TeamLocked[Team]) { - if(g_Config.m_SvTeam != 3) + if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO) SetForceCharacterTeam(ClientID, TEAM_FLOCK); else SetForceCharacterTeam(ClientID, ClientID); // initialize team @@ -1006,7 +1006,7 @@ void CGameTeams::OnCharacterDeath(int ClientID, int Weapon) return; bool Locked = TeamLocked(Team) && Weapon != WEAPON_GAME; - if(g_Config.m_SvTeam == 3 && Team != TEAM_SUPER) + if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO && Team != TEAM_SUPER) { ChangeTeamState(Team, CGameTeams::TEAMSTATE_OPEN); ResetRoundState(Team); @@ -1077,7 +1077,7 @@ void CGameTeams::KillSavedTeam(int ClientID, int Team) void CGameTeams::ResetSavedTeam(int ClientID, int Team) { - if(g_Config.m_SvTeam == 3) + if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) { ChangeTeamState(Team, CGameTeams::TEAMSTATE_OPEN); ResetRoundState(Team); diff --git a/src/game/server/teams.h b/src/game/server/teams.h index fdf2b528b..d44a4892c 100644 --- a/src/game/server/teams.h +++ b/src/game/server/teams.h @@ -177,7 +177,7 @@ public: { if(TeamID < TEAM_FLOCK || TeamID >= TEAM_SUPER) return false; - if(g_Config.m_SvTeam != 3 && TeamID == TEAM_FLOCK) + if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && TeamID == TEAM_FLOCK) return false; return m_pSaveTeamResult[TeamID] != nullptr; @@ -187,7 +187,7 @@ public: { if(Team < TEAM_FLOCK || Team >= TEAM_SUPER) return; - if(g_Config.m_SvTeam != 3 && Team == TEAM_FLOCK) + if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && Team == TEAM_FLOCK) return; m_Practice[Team] = true; @@ -197,7 +197,7 @@ public: { if(Team < TEAM_FLOCK || Team >= TEAM_SUPER) return false; - if(g_Config.m_SvTeam != 3 && Team == TEAM_FLOCK) + if(g_Config.m_SvTeam != SV_TEAM_FORCED_SOLO && Team == TEAM_FLOCK) return false; return m_Practice[Team]; diff --git a/src/game/teamscore.cpp b/src/game/teamscore.cpp index 2bb66bc27..65d7389c2 100644 --- a/src/game/teamscore.cpp +++ b/src/game/teamscore.cpp @@ -46,7 +46,7 @@ void CTeamsCore::Reset() for(int i = 0; i < MAX_CLIENTS; ++i) { - if(g_Config.m_SvTeam == 3) + if(g_Config.m_SvTeam == SV_TEAM_FORCED_SOLO) m_Team[i] = i; else m_Team[i] = TEAM_FLOCK; diff --git a/src/game/teamscore.h b/src/game/teamscore.h index 70efc0f45..e54570445 100644 --- a/src/game/teamscore.h +++ b/src/game/teamscore.h @@ -12,6 +12,14 @@ enum VANILLA_TEAM_SUPER = VANILLA_MAX_CLIENTS }; +enum +{ + SV_TEAM_FORBIDDEN, + SV_TEAM_ALLOWED, + SV_TEAM_MANDATORY, + SV_TEAM_FORCED_SOLO +}; + class CTeamsCore { int m_Team[MAX_CLIENTS];