mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Use named enum EUpdaterState
instead of int
This commit is contained in:
parent
80ff5157d0
commit
c4b9924b28
|
@ -98,13 +98,13 @@ void CUpdater::Init(CHttp *pHttp)
|
|||
m_pHttp = pHttp;
|
||||
}
|
||||
|
||||
void CUpdater::SetCurrentState(int NewState)
|
||||
void CUpdater::SetCurrentState(EUpdaterState NewState)
|
||||
{
|
||||
CLockScope ls(m_Lock);
|
||||
m_State = NewState;
|
||||
}
|
||||
|
||||
int CUpdater::GetCurrentState()
|
||||
IUpdater::EUpdaterState CUpdater::GetCurrentState()
|
||||
{
|
||||
CLockScope ls(m_Lock);
|
||||
return m_State;
|
||||
|
@ -164,8 +164,7 @@ bool CUpdater::MoveFile(const char *pFile)
|
|||
|
||||
void CUpdater::Update()
|
||||
{
|
||||
auto State = GetCurrentState();
|
||||
switch(State)
|
||||
switch(GetCurrentState())
|
||||
{
|
||||
case IUpdater::GOT_MANIFEST:
|
||||
PerformUpdate();
|
||||
|
|
|
@ -52,7 +52,7 @@ class CUpdater : public IUpdater
|
|||
|
||||
CLock m_Lock;
|
||||
|
||||
int m_State GUARDED_BY(m_Lock);
|
||||
EUpdaterState m_State GUARDED_BY(m_Lock);
|
||||
char m_aStatus[256] GUARDED_BY(m_Lock);
|
||||
int m_Percent GUARDED_BY(m_Lock);
|
||||
char m_aClientExecTmp[64];
|
||||
|
@ -80,12 +80,12 @@ class CUpdater : public IUpdater
|
|||
bool ReplaceClient();
|
||||
bool ReplaceServer();
|
||||
|
||||
void SetCurrentState(int NewState) REQUIRES(!m_Lock);
|
||||
void SetCurrentState(EUpdaterState NewState) REQUIRES(!m_Lock);
|
||||
|
||||
public:
|
||||
CUpdater();
|
||||
|
||||
int GetCurrentState() override REQUIRES(!m_Lock);
|
||||
EUpdaterState GetCurrentState() override REQUIRES(!m_Lock);
|
||||
void GetCurrentFile(char *pBuf, int BufSize) override REQUIRES(!m_Lock);
|
||||
int GetCurrentPercent() override REQUIRES(!m_Lock);
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ class IUpdater : public IInterface
|
|||
{
|
||||
MACRO_INTERFACE("updater")
|
||||
public:
|
||||
enum
|
||||
enum EUpdaterState
|
||||
{
|
||||
CLEAN = 0,
|
||||
CLEAN,
|
||||
GETTING_MANIFEST,
|
||||
GOT_MANIFEST,
|
||||
PARSING_UPDATE,
|
||||
|
@ -22,7 +22,7 @@ public:
|
|||
virtual void Update() = 0;
|
||||
virtual void InitiateUpdate() = 0;
|
||||
|
||||
virtual int GetCurrentState() = 0;
|
||||
virtual EUpdaterState GetCurrentState() = 0;
|
||||
virtual void GetCurrentFile(char *pBuf, int BufSize) = 0;
|
||||
virtual int GetCurrentPercent() = 0;
|
||||
};
|
||||
|
|
|
@ -3402,7 +3402,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
|||
#if defined(CONF_AUTOUPDATE)
|
||||
{
|
||||
bool NeedUpdate = str_comp(Client()->LatestVersion(), "0");
|
||||
int State = Updater()->GetCurrentState();
|
||||
IUpdater::EUpdaterState State = Updater()->GetCurrentState();
|
||||
|
||||
// Update Button
|
||||
char aBuf[256];
|
||||
|
|
|
@ -206,7 +206,7 @@ void CMenus::RenderStartMenu(CUIRect MainView)
|
|||
#if defined(CONF_AUTOUPDATE)
|
||||
char aBuf[64];
|
||||
CUIRect Part;
|
||||
int State = Updater()->GetCurrentState();
|
||||
IUpdater::EUpdaterState State = Updater()->GetCurrentState();
|
||||
bool NeedUpdate = str_comp(Client()->LatestVersion(), "0");
|
||||
if(State == IUpdater::CLEAN && NeedUpdate)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue