Codechange: Prefer string equality instead of comparison. (#14727)

This commit is contained in:
Peter Nelson
2025-10-24 20:30:03 +01:00
committed by dP
parent c9af1c1c7a
commit d284e02a87
15 changed files with 37 additions and 44 deletions

View File

@@ -1463,7 +1463,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_RCON(Packet &p)
/* We are allowed, nothing more to validate. */
} else if (_settings_client.network.rcon_password.empty()) {
return NETWORK_RECV_STATUS_OKAY;
} else if (_settings_client.network.rcon_password.compare(password) != 0) {
} else if (_settings_client.network.rcon_password != password) {
Debug(net, 1, "[rcon] Wrong password from client-id {}", this->client_id);
return NETWORK_RECV_STATUS_OKAY;
}
@@ -1660,7 +1660,7 @@ bool NetworkServerChangeClientName(ClientID client_id, const std::string &new_na
{
/* Check if the name's already in use */
for (NetworkClientInfo *ci : NetworkClientInfo::Iterate()) {
if (ci->client_name.compare(new_name) == 0) return false;
if (ci->client_name == new_name) return false;
}
NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id);