Skip to content

Commit

Permalink
simplify using SString trim
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando-A-Rocha committed Oct 20, 2024
1 parent 4a0bc7e commit d1ae252
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions Server/mods/deathmatch/logic/CMainConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,8 @@ bool CMainConfig::Load()
return false;
}

// Cancel if the server name only contains spaces
const std::size_t snameStart = m_strServerName.find_first_not_of(" ");
if (snameStart == std::string::npos)
{
CLogger::ErrorPrintf("Server name must contain at least one character other than a space\n");
return false;
}

// Strip spaces from beginning and end of server name
const std::size_t snameEnd = m_strServerName.find_last_not_of(" ");
m_strServerName = m_strServerName.substr(snameStart, snameEnd - snameStart + 1);
m_strServerName = SString(m_strServerName).TrimStart(" ").TrimEnd(" ");

// Grab the forced server ip(s)
GetString(m_pRootNode, "serverip", m_strServerIP);
Expand Down

0 comments on commit d1ae252

Please sign in to comment.