forked from Mirrors/openclonk
Add a compile-time option to disable automatic update
parent
63faacc520
commit
1967d914c2
|
@ -54,6 +54,7 @@ endif()
|
|||
option(BUILD_TO_PLANET "Put build files to ./planet/" OFF)
|
||||
option(DEBUGREC "Debug records" OFF)
|
||||
option(OC_BUILD_MULTIPROCESSOR "Use all processor cores to build" OFF)
|
||||
option(WITH_AUTOMATIC_UPDATE "Build engine without automatic update support" ON)
|
||||
|
||||
############################################################################
|
||||
# Check for compiler quirks and features
|
||||
|
|
|
@ -176,6 +176,9 @@
|
|||
/* Use GTK+3 for the developer mode */
|
||||
#cmakedefine WITH_GTK3 1
|
||||
|
||||
/* Enable the automatic update system */
|
||||
#cmakedefine WITH_AUTOMATIC_UPDATE 1
|
||||
|
||||
/* Define to 1 if the X Window System is missing or not being used. */
|
||||
#cmakedefine X_DISPLAY_MISSING 1
|
||||
|
||||
|
|
|
@ -181,6 +181,9 @@
|
|||
/* Define to 1 if the X Window System is used */
|
||||
#undef USE_X11
|
||||
|
||||
/* Enable automatic update system */
|
||||
#undef WITH_AUTOMATIC_UPDATE
|
||||
|
||||
/* Developer mode */
|
||||
#undef WITH_DEVELOPER_MODE
|
||||
|
||||
|
|
|
@ -282,6 +282,13 @@ if test "$with_directx" = yes; then
|
|||
AC_DEFINE([USE_DIRECTX], 1, [DirectX graphics])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH([automatic-update],
|
||||
[AC_HELP_STRING([--with-automatic-update],[enable support for automatic engine updates [default=yes]])],
|
||||
, [with_automatic_update="yes"])
|
||||
if test "$with_automatic_update" = "yes"; then
|
||||
AC_DEFINE([WITH_AUTOMATIC_UPDATE], 1, [Enable automatic update system])
|
||||
fi
|
||||
|
||||
if test $win32 = false; then
|
||||
# pthread
|
||||
AX_PTHREAD( , [AC_MSG_ERROR([No pthread support.])])
|
||||
|
|
|
@ -189,10 +189,12 @@ void C4ConfigNetwork::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(LeagueServerSignUp, "LeagueServerSignUp", 0 ));
|
||||
pComp->Value(mkNamingAdapt(UseAlternateServer, "UseAlternateServer", 0 ));
|
||||
pComp->Value(mkNamingAdapt(s(AlternateServerAddress),"AlternateServerAddress", "boom.openclonk.org:80/server/"));
|
||||
pComp->Value(mkNamingAdapt(s(UpdateServerAddress), "UpdateServerAddress", "boom.openclonk.org:80/server/"));
|
||||
pComp->Value(mkNamingAdapt(s(LastPassword), "LastPassword", "Wipf" ));
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
pComp->Value(mkNamingAdapt(s(UpdateServerAddress), "UpdateServerAddress", "boom.openclonk.org:80/server/"));
|
||||
pComp->Value(mkNamingAdapt(AutomaticUpdate, "AutomaticUpdate", 0 ,false, true));
|
||||
pComp->Value(mkNamingAdapt(LastUpdateTime, "LastUpdateTime", 0 ));
|
||||
#endif
|
||||
pComp->Value(mkNamingAdapt(AsyncMaxWait, "AsyncMaxWait", 2 ));
|
||||
|
||||
pComp->Value(mkNamingAdapt(s(PuncherAddress), "PuncherAddress", "clonk.de:11115")); // maybe store default for this one?
|
||||
|
|
|
@ -177,10 +177,12 @@ public:
|
|||
int32_t MaxLoadFileSize;
|
||||
char LastPassword[CFG_MaxString+1];
|
||||
char AlternateServerAddress[CFG_MaxString+1];
|
||||
char UpdateServerAddress[CFG_MaxString+1];
|
||||
char PuncherAddress[CFG_MaxString+1];
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
char UpdateServerAddress[CFG_MaxString+1];
|
||||
int32_t AutomaticUpdate;
|
||||
int32_t LastUpdateTime;
|
||||
#endif
|
||||
int32_t AsyncMaxWait;
|
||||
public:
|
||||
void CompileFunc(StdCompiler *pComp);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <C4StartupAboutDlg.h>
|
||||
#include <C4UpdateDlg.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4Version.h>
|
||||
|
||||
#include <C4StartupMainDlg.h>
|
||||
|
||||
|
@ -63,8 +64,10 @@ C4StartupAboutDlg::C4StartupAboutDlg() : C4StartupDlg("")
|
|||
int32_t iButtonWidth = caButtons.GetInnerWidth() / 4;
|
||||
AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_BACK"), caButtons.GetGridCell(0,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnBackBtn));
|
||||
btn->SetToolTip(LoadResStr("IDS_DLGTIP_BACKMAIN"));
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_CHECKFORUPDATES"), caButtons.GetGridCell(2,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnUpdateBtn));
|
||||
btn->SetToolTip(LoadResStr("IDS_DESC_CHECKONLINEFORNEWVERSIONS"));
|
||||
#endif
|
||||
}
|
||||
|
||||
C4StartupAboutDlg::~C4StartupAboutDlg()
|
||||
|
@ -109,7 +112,9 @@ void C4StartupAboutDlg::OnRegisterBtn(C4GUI::Control *btn)
|
|||
OpenURL(FormatString("http://www.clonk.de/register.php?lng=%s&product=cr", sLangCode.getData()).getData());
|
||||
}
|
||||
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
void C4StartupAboutDlg::OnUpdateBtn(C4GUI::Control *btn)
|
||||
{
|
||||
C4UpdateDlg::CheckForUpdates(GetScreen());
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -48,7 +48,9 @@ protected:
|
|||
bool KeyBack() { DoBack(); return true; }
|
||||
void OnBackBtn(C4GUI::Control *btn) { DoBack(); }
|
||||
void OnRegisterBtn(C4GUI::Control *btn);
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
void OnUpdateBtn(C4GUI::Control *btn);
|
||||
#endif
|
||||
|
||||
public:
|
||||
void OnSec1Timer();
|
||||
|
|
|
@ -290,7 +290,7 @@ bool C4StartupMainDlg::KeyEnterUp()
|
|||
|
||||
void C4StartupMainDlg::OnShown()
|
||||
{
|
||||
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
// Incoming update
|
||||
if (Application.IncomingUpdate)
|
||||
{
|
||||
|
@ -309,6 +309,7 @@ void C4StartupMainDlg::OnShown()
|
|||
if (Config.Network.AutomaticUpdate)
|
||||
C4UpdateDlg::CheckForUpdates(GetScreen(), true);
|
||||
}
|
||||
#endif
|
||||
|
||||
// first start evaluation
|
||||
if (Config.General.FirstStart)
|
||||
|
|
|
@ -706,11 +706,13 @@ C4StartupNetDlg::C4StartupNetDlg() : C4StartupDlg(LoadResStr("IDS_DLG_NETSTART")
|
|||
btnRecord->SetToolTip(LoadResStr("IDS_DLGTIP_RECORD"));
|
||||
btnRecord->SetText(LoadResStr("IDS_CTL_RECORD"));
|
||||
AddElement(btnRecord);
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
btnUpdate = new C4GUI::CallbackButton<C4StartupNetDlg, C4GUI::IconButton>(C4GUI::Ico_Ex_Update, caConfigArea.GetFromTop(iIconSize, iIconSize), '\0', &C4StartupNetDlg::OnBtnUpdate);
|
||||
btnUpdate->SetVisibility(false); // update only available if masterserver notifies it
|
||||
btnUpdate->SetToolTip(LoadResStr("IDS_DLGTIP_UPDATE"));
|
||||
btnUpdate->SetText(LoadResStr("IDS_CTL_UPDATE"));
|
||||
AddElement(btnUpdate);
|
||||
#endif
|
||||
|
||||
// button area
|
||||
C4GUI::CallbackButton<C4StartupNetDlg> *btn;
|
||||
|
@ -842,6 +844,7 @@ void C4StartupNetDlg::OnBtnRecord(C4GUI::Control *btn)
|
|||
btnRecord->SetIcon(fCheck ? C4GUI::Ico_Ex_RecordOn : C4GUI::Ico_Ex_RecordOff);
|
||||
}
|
||||
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
void C4StartupNetDlg::OnBtnUpdate(C4GUI::Control *btn)
|
||||
{
|
||||
// do update
|
||||
|
@ -850,6 +853,7 @@ void C4StartupNetDlg::OnBtnUpdate(C4GUI::Control *btn)
|
|||
GetScreen()->ShowMessage(LoadResStr("IDS_MSG_UPDATEFAILED"), LoadResStr("IDS_TYPE_UPDATE"), C4GUI::Ico_Ex_Update);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void C4StartupNetDlg::UpdateMasterserver()
|
||||
{
|
||||
|
@ -1198,6 +1202,7 @@ void C4StartupNetDlg::OnReferenceEntryAdd(C4StartupNetListEntry *pEntry)
|
|||
|
||||
void C4StartupNetDlg::CheckVersionUpdate(const char *szUpdateURL)
|
||||
{
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
// Is a valid update
|
||||
if (C4UpdateDlg::IsValidUpdate(szUpdateURL))
|
||||
{
|
||||
|
@ -1206,7 +1211,16 @@ void C4StartupNetDlg::CheckVersionUpdate(const char *szUpdateURL)
|
|||
}
|
||||
// Otherwise: no update available
|
||||
else
|
||||
{
|
||||
btnUpdate->SetVisibility(false);
|
||||
}
|
||||
#else
|
||||
if(szUpdateURL && *szUpdateURL)
|
||||
{
|
||||
// TODO: We could show an item notifying the user that an
|
||||
// update is available externally.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void C4StartupNetDlg::OnChatTitleChange(const StdStrBuf &sNewTitle)
|
||||
|
|
|
@ -138,7 +138,10 @@ private:
|
|||
C4GUI::ListBox *pGameSelList; // game selection listbox
|
||||
C4KeyBinding *pKeyRefresh, *pKeyBack, *pKeyForward;
|
||||
C4GUI::CallbackButton<C4StartupNetDlg, C4GUI::IconButton> *btnGameList , *btnChat; // left side buttons
|
||||
C4GUI::CallbackButton<C4StartupNetDlg, C4GUI::IconButton> *btnInternet, *btnRecord, *btnUpdate; // right side buttons
|
||||
C4GUI::CallbackButton<C4StartupNetDlg, C4GUI::IconButton> *btnInternet, *btnRecord; // right side buttons
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
C4GUI::CallbackButton<C4StartupNetDlg, C4GUI::IconButton> *btnUpdate;
|
||||
#endif
|
||||
C4GUI::Button *btnJoin, *btnRefresh;
|
||||
C4GUI::Edit *pJoinAddressEdt;
|
||||
C4GUI::Edit *pSearchFieldEdt;
|
||||
|
@ -179,7 +182,9 @@ protected:
|
|||
void OnBtnChat(C4GUI::Control *btn);
|
||||
void OnBtnInternet(C4GUI::Control *btn);
|
||||
void OnBtnRecord(C4GUI::Control *btn);
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
void OnBtnUpdate(C4GUI::Control *btn);
|
||||
#endif
|
||||
C4GUI::Edit::InputResult OnJoinAddressEnter(C4GUI::Edit *edt, bool fPasting, bool fPastingMore)
|
||||
{ DoOK(); return C4GUI::Edit::IR_Abort; }
|
||||
C4GUI::Edit::InputResult OnSearchFieldEnter(C4GUI::Edit *edt, bool fPasting, bool fPastingMore)
|
||||
|
|
|
@ -966,10 +966,12 @@ C4StartupOptionsDlg::C4StartupOptionsDlg() : C4StartupDlg(LoadResStrNoAmp("IDS_D
|
|||
pLeagueServerCfg = new NetworkServerAddressConfig(caSheetNetwork.GetFromTop(iServerCfgHgt), sServerText.getData(), &(Config.Network.UseAlternateServer), Config.Network.AlternateServerAddress, iServerCfgWdtMid);
|
||||
pLeagueServerCfg->SetToolTip(LoadResStr("IDS_NET_MASTERSRV_DESC"));
|
||||
pSheetNetwork->AddElement(pLeagueServerCfg);
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
pCheck = new BoolConfig(caSheetNetwork.GetFromTop(pUseFont->GetLineHeight()), LoadResStr("IDS_CTL_AUTOMATICUPDATES"), NULL, &Config.Network.AutomaticUpdate, false);
|
||||
pCheck->SetToolTip(LoadResStr("IDS_DESC_AUTOMATICUPDATES"));
|
||||
pCheck->SetFont(pUseFont, C4StartupFontClr, C4StartupFontClrDisabled);
|
||||
pSheetNetwork->AddElement(pCheck);
|
||||
#endif
|
||||
const char *szNameCfgText = LoadResStr("IDS_NET_USERNAME");
|
||||
int iNameCfgWdt=200, iNameCfgHgt=48; C4StartupOptionsDlg::EditConfig::GetControlSize(&iNameCfgWdt, &iNameCfgHgt, szNameCfgText, false);
|
||||
iNameCfgWdt += 5;
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
// dialogs for update, and the actual update application code
|
||||
|
||||
#include "C4Include.h"
|
||||
|
||||
// Don't compile this class if automatic update is disabled
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
|
||||
#include "C4UpdateDlg.h"
|
||||
#include "C4DownloadDlg.h"
|
||||
|
||||
|
@ -388,3 +392,5 @@ bool C4Network2UpdateClient::GetUpdateURL(StdStrBuf *pUpdateURL)
|
|||
// done; version OK!
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // WITH_AUTOMATIC_UPDATE
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#ifndef INC_C4UpdateDialogs
|
||||
#define INC_C4UpdateDialogs
|
||||
|
||||
#include "PlatformAbstraction.h"
|
||||
|
||||
#ifdef WITH_AUTOMATIC_UPDATE
|
||||
|
||||
#include "C4Gui.h"
|
||||
#include "C4GameVersion.h"
|
||||
#include "C4Network2Reference.h"
|
||||
|
@ -68,4 +72,5 @@ public:
|
|||
bool GetUpdateURL(StdStrBuf *pUpdateURL);
|
||||
};
|
||||
|
||||
#endif // WITH_AUTOMATIC_UPDATE
|
||||
#endif // INC_C4UpdateDialogs
|
||||
|
|
Loading…
Reference in New Issue