[Party]: Use .empty() (#1020)

This commit is contained in:
Edo 2023-05-08 13:35:23 +01:00 committed by GitHub
parent 3c7fbb26e7
commit 67d3cf2bb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -9,6 +9,7 @@
#include "Party.hpp" #include "Party.hpp"
#include "ServerList.hpp" #include "ServerList.hpp"
#include "Stats.hpp" #include "Stats.hpp"
#include "TextRenderer.hpp"
#include "Voice.hpp" #include "Voice.hpp"
#include <version.hpp> #include <version.hpp>
@ -493,7 +494,7 @@ namespace Components
{ {
ConnectError("Invalid map or gametype."); ConnectError("Invalid map or gametype.");
} }
else if (Container.info.get("isPrivate") == "1"s && !Dvar::Var("password").get<std::string>().length()) else if (Container.info.get("isPrivate") == "1"s && Dvar::Var("password").get<std::string>().empty())
{ {
ConnectError("A password is required to join this server! Set it at the bottom of the serverlist."); ConnectError("A password is required to join this server! Set it at the bottom of the serverlist.");
} }
@ -524,7 +525,7 @@ namespace Components
{ {
if (!Maps::CheckMapInstalled(Container.info.get("mapname"), true)) return; if (!Maps::CheckMapInstalled(Container.info.get("mapname"), true)) return;
Container.motd = info.get("sv_motd"); Container.motd = TextRenderer::StripMaterialTextIcons(info.get("sv_motd"));
if (Container.matchType == 1) // Party if (Container.matchType == 1) // Party
{ {

View File

@ -1480,7 +1480,7 @@ namespace Components
{ {
char buffer[1000]{}; // Should be more than enough char buffer[1000]{}; // Should be more than enough
StripAllTextIcons(in.data(), buffer, sizeof(buffer)); StripAllTextIcons(in.data(), buffer, sizeof(buffer));
return {buffer}; return std::string{ buffer };
} }
int TextRenderer::SEH_PrintStrlenWithCursor(const char* string, const Game::field_t* field) int TextRenderer::SEH_PrintStrlenWithCursor(const char* string, const Game::field_t* field)
@ -1558,8 +1558,7 @@ namespace Components
{ {
if (r_colorBlind.get<bool>()) if (r_colorBlind.get<bool>())
{ {
const auto str = std::string(name); if (std::strcmp(name, "g_TeamColor_EnemyTeam") == 0)
if (str == "g_TeamColor_EnemyTeam")
{ {
// Dvar_GetUnpackedColor // Dvar_GetUnpackedColor
const auto* colorblindEnemy = g_ColorBlind_EnemyTeam->current.color; const auto* colorblindEnemy = g_ColorBlind_EnemyTeam->current.color;
@ -1570,7 +1569,7 @@ namespace Components
return false; return false;
} }
if (str == "g_TeamColor_MyTeam") if (std::strcmp(name, "g_TeamColor_MyTeam") == 0)
{ {
// Dvar_GetUnpackedColor // Dvar_GetUnpackedColor
const auto* colorblindAlly = g_ColorBlind_MyTeam->current.color; const auto* colorblindAlly = g_ColorBlind_MyTeam->current.color;