From 488db9b4fbe5259c25802175cd6df4665b04e023 Mon Sep 17 00:00:00 2001 From: Learath Lea Date: Fri, 27 Feb 2015 23:08:34 +0200 Subject: [PATCH] Can't autoupdate on OSX and Android. --- src/engine/client/client.cpp | 10 +++++++++- src/game/client/components/menus_browser.cpp | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index a821d0fe8..3dcecb58e 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2485,7 +2485,9 @@ void CClient::RegisterInterfaces() Kernel()->RegisterInterface(static_cast(&m_DemoPlayer)); Kernel()->RegisterInterface(static_cast(&m_ServerBrowser)); Kernel()->RegisterInterface(static_cast(&m_Fetcher)); +#if !defined(CONF_PLATFORM_MACOSX) && !defined(__ANDROID__) Kernel()->RegisterInterface(static_cast(&m_AutoUpdate)); +#endif Kernel()->RegisterInterface(static_cast(&m_Friends)); } @@ -2501,7 +2503,9 @@ void CClient::InitInterfaces() m_pMap = Kernel()->RequestInterface(); m_pMasterServer = Kernel()->RequestInterface(); m_pFetcher = Kernel()->RequestInterface(); +#if !defined(CONF_PLATFORM_MACOSX) && !defined(__ANDROID__) m_pAutoUpdate = Kernel()->RequestInterface(); +#endif m_pStorage = Kernel()->RequestInterface(); m_DemoEditor.Init(m_pGameClient->NetVersion(), &m_SnapshotDelta, m_pConsole, m_pStorage); @@ -2509,7 +2513,10 @@ void CClient::InitInterfaces() m_ServerBrowser.SetBaseInfo(&m_NetClient[2], m_pGameClient->NetVersion()); m_Fetcher.Init(); + +#if !defined(CONF_PLATFORM_MACOSX) && !defined(__ANDROID__) m_AutoUpdate.Init(); +#endif m_Friends.Init(); @@ -2645,8 +2652,9 @@ void CClient::Run() // update input if(Input()->Update()) break; // SDL_QUIT - +#if !defined(CONF_PLATFORM_MACOSX) && !defined(__ANDROID__) AutoUpdate()->Update(); +#endif // update sound Sound()->Update(); diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 300dd47d9..b86db3065 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -1271,6 +1271,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView) StatusBox.HSplitTop(5.0f, 0, &StatusBox); // version note +#if !defined(CONF_PLATFORM_MACOSX) && !defined(__ANDROID__) StatusBox.HSplitBottom(15.0f, &StatusBox, &Button); char aBuf[64]; int State = AutoUpdate()->GetCurrentState(); @@ -1319,7 +1320,19 @@ void CMenus::RenderServerbrowser(CUIRect MainView) ProgressBar.w = (float)AutoUpdate()->GetCurrentPercent(); RenderTools()->DrawUIRect(&ProgressBar, vec4(1.0f, 1.0f, 1.0f, 0.5f), CUI::CORNER_ALL, 5.0f); } - +#else + StatusBox.HSplitBottom(15.0f, &StatusBox, &Button); + char aBuf[64]; + if(str_comp(Client()->LatestVersion(), "0") != 0) + { + str_format(aBuf, sizeof(aBuf), Localize("DDNet %s is out! Download it at ddnet.tw!"), Client()->LatestVersion()); + TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f); + } + else + str_format(aBuf, sizeof(aBuf), Localize("Current Version: %s"), GAME_VERSION); + UI()->DoLabelScaled(&Button, aBuf, 14.0f, -1); + TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f); +#endif // button area //StatusBox.VSplitRight(80.0f, &StatusBox, 0); StatusBox.VSplitRight(170.0f, &StatusBox, &ButtonArea);