mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Improve autoupdater a bit
- Only ask for restart when we're ingame or unsaved changes in editor - Otherwise restart directly
This commit is contained in:
parent
b4336e4638
commit
8ae27f81b6
|
@ -178,6 +178,7 @@ public:
|
||||||
virtual void DemoSlice(const char *pDstPath) = 0;
|
virtual void DemoSlice(const char *pDstPath) = 0;
|
||||||
|
|
||||||
virtual void RequestDDNetSrvList() = 0;
|
virtual void RequestDDNetSrvList() = 0;
|
||||||
|
virtual bool EditorHasUnsavedData() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IGameClient : public IInterface
|
class IGameClient : public IInterface
|
||||||
|
|
|
@ -52,7 +52,10 @@ void CAutoUpdate::CompletionCallback(CFetchTask *pTask, void *pUser)
|
||||||
pUpdate->ReplaceClient();
|
pUpdate->ReplaceClient();
|
||||||
if(pUpdate->m_ServerUpdate)
|
if(pUpdate->m_ServerUpdate)
|
||||||
pUpdate->ReplaceServer();
|
pUpdate->ReplaceServer();
|
||||||
|
if(pUpdate->m_pClient->State() == IClient::STATE_ONLINE || pUpdate->m_pClient->EditorHasUnsavedData())
|
||||||
pUpdate->m_State = NEED_RESTART;
|
pUpdate->m_State = NEED_RESTART;
|
||||||
|
else
|
||||||
|
pUpdate->m_pClient->Restart();
|
||||||
}
|
}
|
||||||
else if(pTask->State() == CFetchTask::STATE_ERROR)
|
else if(pTask->State() == CFetchTask::STATE_ERROR)
|
||||||
pUpdate->m_State = FAIL;
|
pUpdate->m_State = FAIL;
|
||||||
|
|
|
@ -362,5 +362,6 @@ public:
|
||||||
virtual void DemoSlice(const char *pDstPath);
|
virtual void DemoSlice(const char *pDstPath);
|
||||||
|
|
||||||
void RequestDDNetSrvList();
|
void RequestDDNetSrvList();
|
||||||
|
bool EditorHasUnsavedData() { return m_pEditor->HasUnsavedData(); }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1302,10 +1302,6 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
|
||||||
str_format(aBuf, sizeof(aBuf), "DDNet Client updated!");
|
str_format(aBuf, sizeof(aBuf), "DDNet Client updated!");
|
||||||
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
|
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
|
||||||
}
|
}
|
||||||
//else if(State == IAutoUpdate::NEED_RESTART && !Initiated){
|
|
||||||
// str_format(aBuf, sizeof(aBuf), "DDNet Client needs to be restarted to complete update!");
|
|
||||||
// TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
|
|
||||||
//}
|
|
||||||
UI()->DoLabelScaled(&Button, aBuf, 14.0f, -1);
|
UI()->DoLabelScaled(&Button, aBuf, 14.0f, -1);
|
||||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue