Skip to content

Commit

Permalink
Skip json hidden names when reading playername mappings.
Browse files Browse the repository at this point in the history
  • Loading branch information
splewis committed Feb 13, 2019
1 parent 1679123 commit 958d99f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripting/get5/jsonhelpers.sp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ stock int AddJsonSubsectionArrayToList(JSON_Object json, const char[] key, Array
}

// Used for mapping a keyvalue section
stock int AddJsonAuthsToList(JSON_Object json, const char[] key, ArrayList list, int maxValueLength) {
stock int AddJsonAuthsToList(JSON_Object json, const char[] key, ArrayList list,
int maxValueLength) {
int count = 0;
// We handle two formats here: one where we get a array of steamids as strings, and in the
// 2nd format we have a map of steamid- > player name.
Expand All @@ -123,8 +124,13 @@ stock int AddJsonAuthsToList(JSON_Object json, const char[] key, ArrayList list,
char name[MAX_NAME_LENGTH];
for (int i = 0; i < snap.Length; i++) {
snap.GetKey(i, buffer, maxValueLength);
data.GetString(buffer, name, sizeof(name));

// Skip json meta keys.
if (json_is_meta_key(buffer)) {
continue;
}

data.GetString(buffer, name, sizeof(name));
char steam64[AUTH_LENGTH];
if (ConvertAuthToSteam64(buffer, steam64)) {
Get5_SetPlayerName(steam64, name);
Expand All @@ -134,7 +140,6 @@ stock int AddJsonAuthsToList(JSON_Object json, const char[] key, ArrayList list,
}
delete snap;
}

}
return count;
}

0 comments on commit 958d99f

Please sign in to comment.