Change up strcasecmp/strncasecmp to be more C++y

This commit is contained in:
iikorni
2026-08-30 16:40:12 -05:00
parent 7a697986c6
commit da2a9a8fbc
32 changed files with 351 additions and 790 deletions
+43 -43
View File
@@ -499,50 +499,50 @@ bool SV_ReadClientMessage(void) {
case clc_stringcmd: {
auto s = net_message.read_string().value();
ret = 0;
if (q_strncasecmp(s.c_str(), "status", 6) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "god", 3) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "notarget", 8) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "fly", 3) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "name", 4) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "noclip", 6) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "setpos", 6) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "say", 3) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "say_team", 8) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "tell", 4) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "color", 5) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "kill", 4) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "pause", 5) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "spawn", 5) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "begin", 5) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "prespawn", 8) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "kick", 4) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "ping", 4) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "give", 4) == 0)
ret = 1;
else if (q_strncasecmp(s.c_str(), "ban", 3) == 0)
ret = 1;
bool ret = false;
if (std::is_eq(common::strncasecmp(s, "status", 6)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "god", 3)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "notarget", 8)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "fly", 3)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "name", 4)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "noclip", 6)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "setpos", 6)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "say", 3)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "say_team", 8)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "tell", 4)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "color", 5)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "kill", 4)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "pause", 5)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "spawn", 5)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "begin", 5)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "prespawn", 8)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "kick", 4)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "ping", 4)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "give", 4)))
ret = true;
else if (std::is_eq(common::strncasecmp(s, "ban", 3)))
ret = true;
if (ret == 1)
command::execute_string(s.c_str(), command::source::client);
if (ret)
command::execute_string(s, command::source::client);
else
console::debug("%s tried to %s\n", host_client->name, s.c_str());
break;