From 8ebac31c03e1e586b436e2f6cd5aefe97fa05db6 Mon Sep 17 00:00:00 2001 From: def Date: Thu, 31 Aug 2017 22:40:55 +0200 Subject: [PATCH] Use old ddnet-ranks.json when new one can't be fetched currently --- src/engine/client/client.cpp | 3 ++- src/engine/client/serverbrowser.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index ff9dfa798..e37037bd9 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2274,6 +2274,7 @@ void CClient::ResetDDNetRanks() void CClient::FinishDDNetRanks() { ResetDDNetRanks(); + m_pStorage->RenameFile("ddnet-ranks.json.tmp", "ddnet-ranks.json", IStorage::TYPE_SAVE); m_ServerBrowser.LoadDDNetRanks(); } @@ -3780,7 +3781,7 @@ void CClient::RequestDDNetRanks() str_format(aUrl, sizeof(aUrl), "https://ddnet.tw/players/?json=%s", aEscaped); m_pDDNetRanksTask = new CFetchTask(true, /*UseDDNetCA*/ true); - Fetcher()->QueueAdd(m_pDDNetRanksTask, aUrl, "ddnet-ranks.json", IStorage::TYPE_SAVE); + Fetcher()->QueueAdd(m_pDDNetRanksTask, aUrl, "ddnet-ranks.json.tmp", IStorage::TYPE_SAVE); } int CClient::GetPredictionTime() diff --git a/src/engine/client/serverbrowser.cpp b/src/engine/client/serverbrowser.cpp index eb303aebc..7d7cf1fff 100644 --- a/src/engine/client/serverbrowser.cpp +++ b/src/engine/client/serverbrowser.cpp @@ -594,6 +594,7 @@ void CServerBrowser::Refresh(int Type) else if(Type == IServerBrowser::TYPE_DDNET) { LoadDDNetServers(); + LoadDDNetRanks(); // remove unknown elements of exclude list DDNetCountryFilterClean();