mirror of
https://github.com/rei-2/Amalgam
synced 2026-10-10 04:43:09 +08:00
deal with bot priorities correctly
This commit is contained in:
@@ -54,8 +54,7 @@ void CPlayerlistUtils::AddTag(uint32_t uFriendsID, int iID, bool bSave, std::str
|
||||
}
|
||||
void CPlayerlistUtils::AddTag(int iIndex, int iID, bool bSave, std::string sName, std::unordered_map<uint32_t, std::vector<int>>& mPlayerTags)
|
||||
{
|
||||
if (const uint32_t uFriendsID = GetFriendsID(iIndex))
|
||||
AddTag(uFriendsID, iID, bSave, sName, mPlayerTags);
|
||||
AddTag(GetFriendsID(iIndex), iID, bSave, sName, mPlayerTags);
|
||||
}
|
||||
void CPlayerlistUtils::AddTag(uint32_t uFriendsID, int iID, bool bSave, std::string sName)
|
||||
{
|
||||
@@ -89,8 +88,7 @@ void CPlayerlistUtils::RemoveTag(uint32_t uFriendsID, int iID, bool bSave, std::
|
||||
}
|
||||
void CPlayerlistUtils::RemoveTag(int iIndex, int iID, bool bSave, std::string sName, std::unordered_map<uint32_t, std::vector<int>>& mPlayerTags)
|
||||
{
|
||||
if (const uint32_t uFriendsID = GetFriendsID(iIndex))
|
||||
RemoveTag(uFriendsID, iID, bSave, sName, mPlayerTags);
|
||||
RemoveTag(GetFriendsID(iIndex), iID, bSave, sName, mPlayerTags);
|
||||
}
|
||||
void CPlayerlistUtils::RemoveTag(uint32_t uFriendsID, int iID, bool bSave, std::string sName)
|
||||
{
|
||||
@@ -106,13 +104,11 @@ bool CPlayerlistUtils::HasTags(uint32_t uFriendsID, std::unordered_map<uint32_t,
|
||||
if (!uFriendsID)
|
||||
return false;
|
||||
|
||||
return mPlayerTags[uFriendsID].size();
|
||||
return !mPlayerTags[uFriendsID].empty();
|
||||
}
|
||||
bool CPlayerlistUtils::HasTags(int iIndex, std::unordered_map<uint32_t, std::vector<int>>& mPlayerTags)
|
||||
{
|
||||
if (const uint32_t uFriendsID = GetFriendsID(iIndex))
|
||||
return HasTags(uFriendsID, mPlayerTags);
|
||||
return false;
|
||||
return HasTags(GetFriendsID(iIndex), mPlayerTags);
|
||||
}
|
||||
bool CPlayerlistUtils::HasTags(uint32_t uFriendsID)
|
||||
{
|
||||
@@ -133,9 +129,7 @@ bool CPlayerlistUtils::HasTag(uint32_t uFriendsID, int iID, std::unordered_map<u
|
||||
}
|
||||
bool CPlayerlistUtils::HasTag(int iIndex, int iID, std::unordered_map<uint32_t, std::vector<int>>& mPlayerTags)
|
||||
{
|
||||
if (const uint32_t uFriendsID = GetFriendsID(iIndex))
|
||||
return HasTag(uFriendsID, iID, mPlayerTags);
|
||||
return false;
|
||||
return HasTag(GetFriendsID(iIndex), iID, mPlayerTags);
|
||||
}
|
||||
bool CPlayerlistUtils::HasTag(uint32_t uFriendsID, int iID)
|
||||
{
|
||||
@@ -196,9 +190,7 @@ int CPlayerlistUtils::GetPriority(int iIndex, bool bCache)
|
||||
if (bCache)
|
||||
return H::Entities.GetPriority(iIndex);
|
||||
|
||||
if (const uint32_t uFriendsID = GetFriendsID(iIndex))
|
||||
return GetPriority(uFriendsID);
|
||||
return m_vTags[TagToIndex(DEFAULT_TAG)].m_iPriority;
|
||||
return GetPriority(GetFriendsID(iIndex));
|
||||
}
|
||||
|
||||
PriorityLabel_t* CPlayerlistUtils::GetSignificantTag(uint32_t uFriendsID, int iMode)
|
||||
@@ -279,25 +271,18 @@ PriorityLabel_t* CPlayerlistUtils::GetSignificantTag(uint32_t uFriendsID, int iM
|
||||
}
|
||||
PriorityLabel_t* CPlayerlistUtils::GetSignificantTag(int iIndex, int iMode)
|
||||
{
|
||||
if (const uint32_t uFriendsID = GetFriendsID(iIndex))
|
||||
return GetSignificantTag(uFriendsID, iMode);
|
||||
return nullptr;
|
||||
return GetSignificantTag(GetFriendsID(iIndex), iMode);
|
||||
}
|
||||
|
||||
bool CPlayerlistUtils::IsIgnored(uint32_t uFriendsID)
|
||||
{
|
||||
if (!uFriendsID)
|
||||
return false;
|
||||
|
||||
const int iPriority = GetPriority(uFriendsID);
|
||||
const int iIgnored = m_vTags[TagToIndex(IGNORED_TAG)].m_iPriority;
|
||||
return iPriority <= iIgnored;
|
||||
}
|
||||
bool CPlayerlistUtils::IsIgnored(int iIndex)
|
||||
{
|
||||
if (const uint32_t uFriendsID = GetFriendsID(iIndex))
|
||||
return IsIgnored(uFriendsID);
|
||||
return false;
|
||||
return IsIgnored(GetFriendsID(iIndex));
|
||||
}
|
||||
|
||||
bool CPlayerlistUtils::IsPrioritized(uint32_t uFriendsID)
|
||||
@@ -311,9 +296,7 @@ bool CPlayerlistUtils::IsPrioritized(uint32_t uFriendsID)
|
||||
}
|
||||
bool CPlayerlistUtils::IsPrioritized(int iIndex)
|
||||
{
|
||||
if (const uint32_t uFriendsID = GetFriendsID(iIndex))
|
||||
return IsPrioritized(uFriendsID);
|
||||
return false;
|
||||
return IsPrioritized(GetFriendsID(iIndex));
|
||||
}
|
||||
|
||||
const char* CPlayerlistUtils::GetPlayerName(int iIndex, const char* sDefault, int* pType)
|
||||
|
||||
@@ -200,7 +200,7 @@ void CEntities::Store()
|
||||
if (bUpdateInfo)
|
||||
{
|
||||
PlayerInfo_t pi{};
|
||||
if (I::EngineClient->GetPlayerInfo(n, &pi) && !pi.fakeplayer)
|
||||
if (I::EngineClient->GetPlayerInfo(n, &pi))
|
||||
{
|
||||
bool bLocal = n == I::EngineClient->GetLocalPlayer();
|
||||
if (bLocal) m_uFriendsID = pi.friendsID;
|
||||
|
||||
Reference in New Issue
Block a user