Skip to content

Commit

Permalink
Merge pull request ddnet#8993 from heinrich5991/pr_ddnet_info_finishes
Browse files Browse the repository at this point in the history
info: "finishes" shouldn't be under "icon" either
  • Loading branch information
def- authored Sep 19, 2024
2 parents 66e8d1f + 4dcc565 commit ff9196d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/engine/client/serverbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1465,23 +1465,28 @@ void CServerBrowser::LoadDDNetServers()
const json_value &IconUrl = Icon["url"];
const json_value &Name = Community["name"];
const json_value HasFinishes = Community["has_finishes"];
const json_value *pFinishes = &Icon["finishes"];
const json_value *pFinishes = &Community["finishes"];
const json_value *pServers = &Community["servers"];
// We accidentally set servers to be part of icon, so support that as a
// fallback for now. Can be removed in a few versions when the
// communities.json has been updated.
// We accidentally set finishes/servers to be part of icon in
// the past, so support that, too. Can be removed once we make
// a breaking change to the whole thing, necessitating a new
// endpoint.
if(pFinishes->type == json_none)
{
pServers = &Icon["finishes"];
}
if(pServers->type == json_none)
{
pServers = &Icon["servers"];
}
// Backward compatibility.
if(pFinishes->type == json_none)
{
if(str_comp(Id, COMMUNITY_DDNET) == 0)
{
pFinishes = &(*m_pDDNetInfo)["maps"];
}
}
// Backward compatibility.
if(pServers->type == json_none)
{
if(str_comp(Id, COMMUNITY_DDNET) == 0)
Expand Down

0 comments on commit ff9196d

Please sign in to comment.