[ServerList]: Use std::format (#794)

This commit is contained in:
Edo 2023-02-22 13:51:34 +01:00 committed by GitHub
parent 3bcca9e706
commit 5975eb80ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -307,7 +307,7 @@ namespace Components
if (!GetMasterServer(masterServerName, masterPort, masterServerAddr))
{
Logger::Print("Could not resolve address for {}:{}", masterServerName, masterPort);
Toast::Show("cardicon_headshot", "^1Error", Utils::String::VA("Could not resolve address for %s:%i", masterServerName, masterPort), 5000);
Toast::Show("cardicon_headshot", "^1Error", std::format("Could not resolve address for {}:{}", masterServerName, masterPort), 5000);
UseMasterServer = false;
return;
}
@ -318,10 +318,10 @@ namespace Components
RefreshContainer.awatingList = true;
RefreshContainer.awaitTime = Game::Sys_Milliseconds();
RefreshContainer.host = Network::Address(Utils::String::VA("%s:%u", masterServerName, masterPort));
RefreshContainer.host = Network::Address(std::format("{}:{}", masterServerName, masterPort));
Logger::Print("Sending serverlist request to master\n");
Network::SendCommand(RefreshContainer.host, "getservers", Utils::String::VA("IW4 %i full empty", PROTOCOL));
Network::SendCommand(RefreshContainer.host, "getservers", std::format("IW4 {} full empty", PROTOCOL));
}
else if (IsFavouriteList())
{
@ -860,9 +860,9 @@ namespace Components
std::lock_guard _(RefreshContainer.mutex);
int offset = 0;
auto count = RefreshContainer.servers.size();
MasterEntry* entry = nullptr;
auto offset = 0;
const auto count = RefreshContainer.servers.size();
MasterEntry* entry;
// Find first entry
do

View File

@ -85,13 +85,13 @@ namespace Components
uint16_t port;
};
bool IsEndToken() const
[[nodiscard]] bool IsEndToken() const noexcept
{
// End of transmission or file token
return (token[0] == 'E' && token[1] == 'O' && (token[2] == 'T' || token[2] == 'F'));
}
bool HasSeparator() const
[[nodiscard]] bool HasSeparator() const noexcept
{
return (token[6] == '\\');
}