From 67d3cf2bb74c568eb6b8c8aa76ec9a11645deed1 Mon Sep 17 00:00:00 2001 From: Edo Date: Mon, 8 May 2023 13:35:23 +0100 Subject: [PATCH] [Party]: Use .empty() (#1020) --- src/Components/Modules/Party.cpp | 5 +++-- src/Components/Modules/TextRenderer.cpp | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Components/Modules/Party.cpp b/src/Components/Modules/Party.cpp index 8dfad7db..fadefcb1 100644 --- a/src/Components/Modules/Party.cpp +++ b/src/Components/Modules/Party.cpp @@ -9,6 +9,7 @@ #include "Party.hpp" #include "ServerList.hpp" #include "Stats.hpp" +#include "TextRenderer.hpp" #include "Voice.hpp" #include @@ -493,7 +494,7 @@ namespace Components { ConnectError("Invalid map or gametype."); } - else if (Container.info.get("isPrivate") == "1"s && !Dvar::Var("password").get().length()) + else if (Container.info.get("isPrivate") == "1"s && Dvar::Var("password").get().empty()) { 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; - Container.motd = info.get("sv_motd"); + Container.motd = TextRenderer::StripMaterialTextIcons(info.get("sv_motd")); if (Container.matchType == 1) // Party { diff --git a/src/Components/Modules/TextRenderer.cpp b/src/Components/Modules/TextRenderer.cpp index 9f2b0e2e..91d9ff52 100644 --- a/src/Components/Modules/TextRenderer.cpp +++ b/src/Components/Modules/TextRenderer.cpp @@ -1480,7 +1480,7 @@ namespace Components { char buffer[1000]{}; // Should be more than enough StripAllTextIcons(in.data(), buffer, sizeof(buffer)); - return {buffer}; + return std::string{ buffer }; } int TextRenderer::SEH_PrintStrlenWithCursor(const char* string, const Game::field_t* field) @@ -1558,8 +1558,7 @@ namespace Components { if (r_colorBlind.get()) { - const auto str = std::string(name); - if (str == "g_TeamColor_EnemyTeam") + if (std::strcmp(name, "g_TeamColor_EnemyTeam") == 0) { // Dvar_GetUnpackedColor const auto* colorblindEnemy = g_ColorBlind_EnemyTeam->current.color; @@ -1570,7 +1569,7 @@ namespace Components return false; } - if (str == "g_TeamColor_MyTeam") + if (std::strcmp(name, "g_TeamColor_MyTeam") == 0) { // Dvar_GetUnpackedColor const auto* colorblindAlly = g_ColorBlind_MyTeam->current.color;