From a164458f702615c999a78c22d7db53e2e9d2b698 Mon Sep 17 00:00:00 2001 From: Learath Lea Date: Fri, 13 Mar 2015 21:27:37 +0200 Subject: [PATCH] Add a messag for last file too --- src/engine/autoupdate.h | 2 +- src/engine/client/autoupdate.cpp | 17 +++++++++++------ src/game/client/components/menus_browser.cpp | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/engine/autoupdate.h b/src/engine/autoupdate.h index 2b2008d09..82404a47c 100644 --- a/src/engine/autoupdate.h +++ b/src/engine/autoupdate.h @@ -16,7 +16,7 @@ public: PARSING_UPDATE, DOWNLOADING, NEED_RESTART, - FAIL_MANIFEST, + FAIL, }; virtual void Update() = 0; diff --git a/src/engine/client/autoupdate.cpp b/src/engine/client/autoupdate.cpp index ddea091a6..43751cc1b 100644 --- a/src/engine/client/autoupdate.cpp +++ b/src/engine/client/autoupdate.cpp @@ -42,15 +42,20 @@ void CAutoUpdate::CompletionCallback(CFetchTask *pTask, void *pUser) if(pTask->State() == CFetchTask::STATE_DONE) pUpdate->m_State = GOT_MANIFEST; else if(pTask->State() == CFetchTask::STATE_ERROR) - pUpdate->m_State = FAIL_MANIFEST; + pUpdate->m_State = FAIL; } else if(!str_comp(pTask->Dest(), pUpdate->m_aLastFile)) { - if(pUpdate->m_ClientUpdate) - pUpdate->ReplaceClient(); - if(pUpdate->m_ServerUpdate) - pUpdate->ReplaceServer(); - pUpdate->m_State = NEED_RESTART; + if(pTask->State() == CFetchTask::STATE_DONE) + { + if(pUpdate->m_ClientUpdate) + pUpdate->ReplaceClient(); + if(pUpdate->m_ServerUpdate) + pUpdate->ReplaceServer(); + pUpdate->m_State = NEED_RESTART; + } + else if(pTask->State() == CFetchTask::STATE_ERROR) + pUpdate->m_State = FAIL; } delete pTask; } diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 628bc4606..fd9c65294 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -1292,9 +1292,9 @@ 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) + else if(State == IAutoUpdate::FAIL) { - str_format(aBuf, sizeof(aBuf), "Failed to download manifest!"); + str_format(aBuf, sizeof(aBuf), "Failed to download a file! Restart client to retry..."); TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f); } else if(State == IAutoUpdate::NEED_RESTART)