Avoid creating a unnecessary copy

Avoid copying the string out of the vector.
This commit is contained in:
Kawe Mazidjatari 2023-04-03 11:21:31 +02:00
parent a1f7cc9a0d
commit 53c693f6e1
2 changed files with 4 additions and 4 deletions

View File

@ -242,8 +242,8 @@ bool CBanSystem::IsBanned(const string& svIpAddress, const uint64_t nNucleusID)
{
for (size_t i = 0; i < m_vBanList.size(); i++)
{
string ipAddress = m_vBanList[i].first;
uint64_t nucleusID = m_vBanList[i].second;
const string& ipAddress = m_vBanList[i].first;
const uint64_t nucleusID = m_vBanList[i].second;
if (ipAddress.empty() ||
!nucleusID) // Cannot be null.

View File

@ -30,8 +30,8 @@ private:
void AuthorPlayerByName(const string& svPlayerName, const bool bBan);
void AuthorPlayerById(const string& svHandle, const bool bBan);
vector<std::pair<string, uint64_t>> m_vRefuseList = {};
vector<std::pair<string, uint64_t>> m_vBanList = {};
vector<std::pair<string, uint64_t>> m_vRefuseList;
vector<std::pair<string, uint64_t>> m_vBanList;
};
extern CBanSystem* g_pBanSystem;