mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Remove invite system entirely since no one wants to fix it
This commit is contained in:
parent
8dcad29138
commit
99cc9d2c0b
|
@ -766,49 +766,6 @@ void CGameContext::ConLockTeam(IConsole::IResult *pResult, void *pUserData)
|
|||
"This team can't be locked");
|
||||
}
|
||||
|
||||
void CGameContext::ConInviteTeam(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
CGameControllerDDRace *pController = (CGameControllerDDRace *)pSelf->m_pController;
|
||||
const char *pName = pResult->GetString(0);
|
||||
|
||||
int Team = pController->m_Teams.m_Core.Team(pResult->m_ClientID);
|
||||
if(Team > TEAM_FLOCK && Team < TEAM_SUPER)
|
||||
{
|
||||
int Target = -1;
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(!str_comp(pName, pSelf->Server()->ClientName(i)))
|
||||
{
|
||||
Target = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(Target < 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "invite", "Player not found");
|
||||
return;
|
||||
}
|
||||
|
||||
if(pController->m_Teams.IsInvited(Team, Target))
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "invite", "Player already invited");
|
||||
return;
|
||||
}
|
||||
|
||||
pController->m_Teams.SetClientInvited(Team, Target, true);
|
||||
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof aBuf, "'%s' invited you to team %d.", pSelf->Server()->ClientName(pResult->m_ClientID), Team);
|
||||
pSelf->SendChatTarget(Target, aBuf);
|
||||
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "invite", "Player has been notified");
|
||||
}
|
||||
else
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "invite", "Can't invite players to this team");
|
||||
}
|
||||
|
||||
void CGameContext::ConJoinTeam(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *) pUserData;
|
||||
|
@ -860,10 +817,10 @@ void CGameContext::ConJoinTeam(IConsole::IResult *pResult, void *pUserData)
|
|||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join",
|
||||
"You can\'t change teams that fast!");
|
||||
}
|
||||
else if(pResult->GetInteger(0) > 0 && pResult->GetInteger(0) < MAX_CLIENTS && pController->m_Teams.TeamLocked(pResult->GetInteger(0)) && !pController->m_Teams.IsInvited(pResult->GetInteger(0), pResult->m_ClientID))
|
||||
else if(pResult->GetInteger(0) > 0 && pResult->GetInteger(0) < MAX_CLIENTS && pController->m_Teams.TeamLocked(pResult->GetInteger(0)))
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "join",
|
||||
"This team is locked using /lock. Only members of the team can invite you or unlock it using /lock.");
|
||||
"This team is locked using /lock.");
|
||||
}
|
||||
else if(pResult->GetInteger(0) > 0 && pResult->GetInteger(0) < MAX_CLIENTS && pController->m_Teams.Count(pResult->GetInteger(0)) >= g_Config.m_SvTeamMaxSize)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,6 @@ CHAT_COMMAND("rank", "?r[playername]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConRank, thi
|
|||
CHAT_COMMAND("rules", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConRules, this, "Shows the server rules")
|
||||
CHAT_COMMAND("team", "?i[id]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConJoinTeam, this, "Lets you join team i (shows your team if left blank)")
|
||||
CHAT_COMMAND("lock", "?i['0'|'1']", CFGFLAG_CHAT|CFGFLAG_SERVER, ConLockTeam, this, "Lock team so no-one else can join it")
|
||||
CHAT_COMMAND("invite", "r[player name]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConInviteTeam, this, "Invite a person to a locked team")
|
||||
CHAT_COMMAND("top5team", "?i[rank to start with]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTeamTop5, this, "Shows five team ranks of the ladder beginning with rank i (1 by default)")
|
||||
CHAT_COMMAND("teamtop5", "?i[rank to start with]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTeamTop5, this, "Shows five team ranks of the ladder beginning with rank i (1 by default)")
|
||||
CHAT_COMMAND("top5", "?i[rank to start with]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConTop5, this, "Shows five ranks of the ladder beginning with rank i (1 by default)")
|
||||
|
|
|
@ -298,7 +298,6 @@ private:
|
|||
static void ConBroadTime(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConJoinTeam(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConLockTeam(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConInviteTeam(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConMe(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConWhisper(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConConverse(IConsole::IResult *pResult, void *pUserData);
|
||||
|
|
|
@ -20,7 +20,6 @@ void CGameTeams::Reset()
|
|||
m_LastChat[i] = 0;
|
||||
m_TeamLocked[i] = false;
|
||||
m_IsSaving[i] = false;
|
||||
m_Invited[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -647,30 +646,7 @@ void CGameTeams::OnCharacterDeath(int ClientID, int Weapon)
|
|||
void CGameTeams::SetTeamLock(int Team, bool Lock)
|
||||
{
|
||||
if(Team > TEAM_FLOCK && Team < TEAM_SUPER)
|
||||
{
|
||||
if(!m_TeamLocked[Team] && Lock)
|
||||
ResetInvited(Team);
|
||||
m_TeamLocked[Team] = Lock;
|
||||
}
|
||||
}
|
||||
|
||||
void CGameTeams::ResetInvited(int Team)
|
||||
{
|
||||
m_Invited[Team] = 0;
|
||||
for (int i = 0; i < MAX_CLIENTS; i++)
|
||||
if(m_Core.Team(i) == Team && GameServer()->m_apPlayers[i])
|
||||
m_Invited[Team] |= 1ULL << i;
|
||||
}
|
||||
|
||||
void CGameTeams::SetClientInvited(int Team, int ClientID, bool Invited)
|
||||
{
|
||||
if(Team > TEAM_FLOCK && Team < TEAM_SUPER)
|
||||
{
|
||||
if(Invited)
|
||||
m_Invited[Team] |= 1ULL << ClientID;
|
||||
else
|
||||
m_Invited[Team] &= ~(1ULL << ClientID);
|
||||
}
|
||||
}
|
||||
|
||||
void CGameTeams::KillSavedTeam(int Team)
|
||||
|
|
|
@ -12,7 +12,6 @@ class CGameTeams
|
|||
bool m_TeeFinished[MAX_CLIENTS];
|
||||
bool m_TeamLocked[MAX_CLIENTS];
|
||||
bool m_IsSaving[MAX_CLIENTS];
|
||||
uint64_t m_Invited[MAX_CLIENTS];
|
||||
|
||||
class CGameContext * m_pGameContext;
|
||||
|
||||
|
@ -70,8 +69,6 @@ public:
|
|||
|
||||
void SendTeamsState(int Cid);
|
||||
void SetTeamLock(int Team, bool Lock);
|
||||
void ResetInvited(int Team);
|
||||
void SetClientInvited(int Team, int ClientID, bool Invited);
|
||||
|
||||
int m_LastChat[MAX_CLIENTS];
|
||||
|
||||
|
@ -104,11 +101,6 @@ public:
|
|||
return m_TeamLocked[Team];
|
||||
}
|
||||
|
||||
bool IsInvited(int Team, int ClientID)
|
||||
{
|
||||
return m_Invited[Team] & 1LL << ClientID;
|
||||
}
|
||||
|
||||
void SetFinished(int ClientID, bool finished)
|
||||
{
|
||||
m_TeeFinished[ClientID] = finished;
|
||||
|
|
Loading…
Reference in a new issue