mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 14:08:19 +00:00
Merge pull request #8030 from dobrykafe/pr-chat-command-args
Make chat command arguments case-insensitive when possible
This commit is contained in:
commit
61e6714e33
|
@ -151,7 +151,7 @@ void CGameContext::ConSettings(IConsole::IResult *pResult, void *pUserData)
|
|||
float HookTemp;
|
||||
pSelf->m_Tuning.Get("player_collision", &ColTemp);
|
||||
pSelf->m_Tuning.Get("player_hooking", &HookTemp);
|
||||
if(str_comp(pArg, "teams") == 0)
|
||||
if(str_comp_nocase(pArg, "teams") == 0)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%s %s",
|
||||
g_Config.m_SvTeam == SV_TEAM_ALLOWED ?
|
||||
|
@ -162,61 +162,61 @@ void CGameContext::ConSettings(IConsole::IResult *pResult, void *pUserData)
|
|||
"and all of your team will die if the team is locked");
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp", aBuf);
|
||||
}
|
||||
else if(str_comp(pArg, "cheats") == 0)
|
||||
else if(str_comp_nocase(pArg, "cheats") == 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp",
|
||||
g_Config.m_SvTestingCommands ?
|
||||
"Cheats are enabled on this server" :
|
||||
"Cheats are disabled on this server");
|
||||
}
|
||||
else if(str_comp(pArg, "collision") == 0)
|
||||
else if(str_comp_nocase(pArg, "collision") == 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp",
|
||||
ColTemp ?
|
||||
"Players can collide on this server" :
|
||||
"Players can't collide on this server");
|
||||
}
|
||||
else if(str_comp(pArg, "hooking") == 0)
|
||||
else if(str_comp_nocase(pArg, "hooking") == 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp",
|
||||
HookTemp ?
|
||||
"Players can hook each other on this server" :
|
||||
"Players can't hook each other on this server");
|
||||
}
|
||||
else if(str_comp(pArg, "endlesshooking") == 0)
|
||||
else if(str_comp_nocase(pArg, "endlesshooking") == 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp",
|
||||
g_Config.m_SvEndlessDrag ?
|
||||
"Players hook time is unlimited" :
|
||||
"Players hook time is limited");
|
||||
}
|
||||
else if(str_comp(pArg, "hitting") == 0)
|
||||
else if(str_comp_nocase(pArg, "hitting") == 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp",
|
||||
g_Config.m_SvHit ?
|
||||
"Players weapons affect others" :
|
||||
"Players weapons has no affect on others");
|
||||
}
|
||||
else if(str_comp(pArg, "oldlaser") == 0)
|
||||
else if(str_comp_nocase(pArg, "oldlaser") == 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp",
|
||||
g_Config.m_SvOldLaser ?
|
||||
"Lasers can hit you if you shot them and they pull you towards the bounce origin (Like DDRace Beta)" :
|
||||
"Lasers can't hit you if you shot them, and they pull others towards the shooter");
|
||||
}
|
||||
else if(str_comp(pArg, "me") == 0)
|
||||
else if(str_comp_nocase(pArg, "me") == 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp",
|
||||
g_Config.m_SvSlashMe ?
|
||||
"Players can use /me commands the famous IRC Command" :
|
||||
"Players can't use the /me command");
|
||||
}
|
||||
else if(str_comp(pArg, "timeout") == 0)
|
||||
else if(str_comp_nocase(pArg, "timeout") == 0)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "The Server Timeout is currently set to %d seconds", g_Config.m_ConnTimeout);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp", aBuf);
|
||||
}
|
||||
else if(str_comp(pArg, "votes") == 0)
|
||||
else if(str_comp_nocase(pArg, "votes") == 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp",
|
||||
g_Config.m_SvVoteKick ?
|
||||
|
@ -233,14 +233,14 @@ void CGameContext::ConSettings(IConsole::IResult *pResult, void *pUserData)
|
|||
"Players are just kicked and not banned if they get voted off");
|
||||
}
|
||||
}
|
||||
else if(str_comp(pArg, "pause") == 0)
|
||||
else if(str_comp_nocase(pArg, "pause") == 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp",
|
||||
g_Config.m_SvPauseable ?
|
||||
"/spec will pause you and your tee will vanish" :
|
||||
"/spec will pause you but your tee will not vanish");
|
||||
}
|
||||
else if(str_comp(pArg, "scores") == 0)
|
||||
else if(str_comp_nocase(pArg, "scores") == 0)
|
||||
{
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp",
|
||||
g_Config.m_SvHideScore ?
|
||||
|
@ -414,7 +414,7 @@ void CGameContext::ConTeamTop5(IConsole::IResult *pResult, void *pUserData)
|
|||
}
|
||||
else
|
||||
{
|
||||
const char *pRequestedName = (str_comp(pResult->GetString(0), "me") == 0) ?
|
||||
const char *pRequestedName = (str_comp_nocase(pResult->GetString(0), "me") == 0) ?
|
||||
pSelf->Server()->ClientName(pResult->m_ClientID) :
|
||||
pResult->GetString(0);
|
||||
pSelf->Score()->ShowPlayerTeamTop5(pResult->m_ClientID, pRequestedName, 0);
|
||||
|
@ -422,7 +422,7 @@ void CGameContext::ConTeamTop5(IConsole::IResult *pResult, void *pUserData)
|
|||
}
|
||||
else if(pResult->NumArguments() == 2 && pResult->GetInteger(1) != 0)
|
||||
{
|
||||
const char *pRequestedName = (str_comp(pResult->GetString(0), "me") == 0) ?
|
||||
const char *pRequestedName = (str_comp_nocase(pResult->GetString(0), "me") == 0) ?
|
||||
pSelf->Server()->ClientName(pResult->m_ClientID) :
|
||||
pResult->GetString(0);
|
||||
pSelf->Score()->ShowPlayerTeamTop5(pResult->m_ClientID, pRequestedName, pResult->GetInteger(1));
|
||||
|
@ -472,7 +472,7 @@ void CGameContext::ConTimes(IConsole::IResult *pResult, void *pUserData)
|
|||
}
|
||||
else
|
||||
{
|
||||
const char *pRequestedName = (str_comp(pResult->GetString(0), "me") == 0) ?
|
||||
const char *pRequestedName = (str_comp_nocase(pResult->GetString(0), "me") == 0) ?
|
||||
pSelf->Server()->ClientName(pResult->m_ClientID) :
|
||||
pResult->GetString(0);
|
||||
pSelf->Score()->ShowTimes(pResult->m_ClientID, pRequestedName, pResult->GetInteger(1));
|
||||
|
@ -480,7 +480,7 @@ void CGameContext::ConTimes(IConsole::IResult *pResult, void *pUserData)
|
|||
}
|
||||
else if(pResult->NumArguments() == 2 && pResult->GetInteger(1) != 0)
|
||||
{
|
||||
const char *pRequestedName = (str_comp(pResult->GetString(0), "me") == 0) ?
|
||||
const char *pRequestedName = (str_comp_nocase(pResult->GetString(0), "me") == 0) ?
|
||||
pSelf->Server()->ClientName(pResult->m_ClientID) :
|
||||
pResult->GetString(0);
|
||||
pSelf->Score()->ShowTimes(pResult->m_ClientID, pRequestedName, pResult->GetInteger(1));
|
||||
|
@ -1255,19 +1255,19 @@ void CGameContext::ConEyeEmote(IConsole::IResult *pResult, void *pUserData)
|
|||
return;
|
||||
|
||||
int EmoteType = 0;
|
||||
if(!str_comp(pResult->GetString(0), "angry"))
|
||||
if(!str_comp_nocase(pResult->GetString(0), "angry"))
|
||||
EmoteType = EMOTE_ANGRY;
|
||||
else if(!str_comp(pResult->GetString(0), "blink"))
|
||||
else if(!str_comp_nocase(pResult->GetString(0), "blink"))
|
||||
EmoteType = EMOTE_BLINK;
|
||||
else if(!str_comp(pResult->GetString(0), "close"))
|
||||
else if(!str_comp_nocase(pResult->GetString(0), "close"))
|
||||
EmoteType = EMOTE_BLINK;
|
||||
else if(!str_comp(pResult->GetString(0), "happy"))
|
||||
else if(!str_comp_nocase(pResult->GetString(0), "happy"))
|
||||
EmoteType = EMOTE_HAPPY;
|
||||
else if(!str_comp(pResult->GetString(0), "pain"))
|
||||
else if(!str_comp_nocase(pResult->GetString(0), "pain"))
|
||||
EmoteType = EMOTE_PAIN;
|
||||
else if(!str_comp(pResult->GetString(0), "surprise"))
|
||||
else if(!str_comp_nocase(pResult->GetString(0), "surprise"))
|
||||
EmoteType = EMOTE_SURPRISE;
|
||||
else if(!str_comp(pResult->GetString(0), "normal"))
|
||||
else if(!str_comp_nocase(pResult->GetString(0), "normal"))
|
||||
EmoteType = EMOTE_NORMAL;
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue