From b75a7563676c4274528bd407122c885670b5d73e Mon Sep 17 00:00:00 2001 From: Learath Lea Date: Fri, 13 Mar 2015 21:18:00 +0200 Subject: [PATCH] Don't get stuck on a manifest fail. --- src/engine/autoupdate.h | 1 + src/engine/client/autoupdate.cpp | 5 ++++- src/game/client/components/menus_browser.cpp | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/engine/autoupdate.h b/src/engine/autoupdate.h index 89e78e1a1..2b2008d09 100644 --- a/src/engine/autoupdate.h +++ b/src/engine/autoupdate.h @@ -16,6 +16,7 @@ public: PARSING_UPDATE, DOWNLOADING, NEED_RESTART, + FAIL_MANIFEST, }; virtual void Update() = 0; diff --git a/src/engine/client/autoupdate.cpp b/src/engine/client/autoupdate.cpp index 2a3423b69..ddea091a6 100644 --- a/src/engine/client/autoupdate.cpp +++ b/src/engine/client/autoupdate.cpp @@ -39,7 +39,10 @@ void CAutoUpdate::CompletionCallback(CFetchTask *pTask, void *pUser) CAutoUpdate *pUpdate = (CAutoUpdate *)pUser; if(!str_comp(pTask->Dest(), "update.json")) { - pUpdate->m_State = GOT_MANIFEST; + if(pTask->State() == CFetchTask::STATE_DONE) + pUpdate->m_State = GOT_MANIFEST; + else if(pTask->State() == CFetchTask::STATE_ERROR) + pUpdate->m_State = FAIL_MANIFEST; } else if(!str_comp(pTask->Dest(), pUpdate->m_aLastFile)) { diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 879bd837d..628bc4606 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -1292,6 +1292,11 @@ void CMenus::RenderServerbrowser(CUIRect MainView) str_format(aBuf, sizeof(aBuf), Localize("Current version: %s"), GAME_VERSION); else if(State >= IAutoUpdate::GETTING_MANIFEST && State < IAutoUpdate::NEED_RESTART) str_format(aBuf, sizeof(aBuf), "Downloading %s:", AutoUpdate()->GetCurrentFile()); + else if(State == IAutoUpdate::FAIL_MANIFEST) + { + str_format(aBuf, sizeof(aBuf), "Failed to download manifest!"); + TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f); + } else if(State == IAutoUpdate::NEED_RESTART) { str_format(aBuf, sizeof(aBuf), "DDNet Client updated!");