mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Pylon: light cleanup of GetBannedList
Logic remains unchanged, just unscoped the iteration code by inverting the check for whether the array is empty.
This commit is contained in:
parent
c1ca886ee5
commit
50b4c559c6
@ -271,29 +271,25 @@ bool CPylon::GetBannedList(const CBanSystem::BannedList_t& inBannedVec, CBanSyst
|
|||||||
|
|
||||||
const rapidjson::Value::ConstArray bannedPlayers = bannedPlayersIt->value.GetArray();
|
const rapidjson::Value::ConstArray bannedPlayers = bannedPlayersIt->value.GetArray();
|
||||||
|
|
||||||
if (!bannedPlayers.Empty())
|
if (bannedPlayers.Empty())
|
||||||
{
|
|
||||||
*outBannedVec = new CBanSystem::BannedList_t();
|
|
||||||
Assert(*outBannedVec);
|
|
||||||
|
|
||||||
for (const rapidjson::Value& obj : bannedPlayers)
|
|
||||||
{
|
|
||||||
const char* reason = nullptr;
|
|
||||||
JSON_GetValue(obj, "reason", JSONFieldType_e::kString, reason);
|
|
||||||
|
|
||||||
NucleusID_t nuc = NULL;
|
|
||||||
JSON_GetValue(obj, "id", JSONFieldType_e::kUint64, nuc);
|
|
||||||
|
|
||||||
CBanSystem::Banned_t banned(reason ? reason : "#DISCONNECT_BANNED", nuc);
|
|
||||||
(*outBannedVec)->AddToTail(banned);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
*outBannedVec = new CBanSystem::BannedList_t();
|
||||||
|
Assert(*outBannedVec);
|
||||||
|
|
||||||
|
for (const rapidjson::Value& obj : bannedPlayers)
|
||||||
|
{
|
||||||
|
const char* reason = nullptr;
|
||||||
|
JSON_GetValue(obj, "reason", JSONFieldType_e::kString, reason);
|
||||||
|
|
||||||
|
NucleusID_t nuc = NULL;
|
||||||
|
JSON_GetValue(obj, "id", JSONFieldType_e::kUint64, nuc);
|
||||||
|
|
||||||
|
CBanSystem::Banned_t banned(reason ? reason : "#DISCONNECT_BANNED", nuc);
|
||||||
|
(*outBannedVec)->AddToTail(banned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user