convert HAVE_NETSERVER to check for file existance, so that it's easier to provide missing servers
authorkoda
Mon, 04 Mar 2013 10:30:56 +0100
changeset 8636 fa8cd97a0a09
parent 8635 c1c6b815691e
child 8637 bf63104605fe
convert HAVE_NETSERVER to check for file existance, so that it's easier to provide missing servers
CMakeLists.txt
QTfrontend/hwconsts.cpp.in
QTfrontend/hwconsts.h
QTfrontend/ui/page/pagenet.cpp
--- a/CMakeLists.txt	Mon Mar 04 10:08:38 2013 +0100
+++ b/CMakeLists.txt	Mon Mar 04 10:30:56 2013 +0100
@@ -261,7 +261,6 @@
     endif()
 
     if(ghc_executable)
-        set(HAVE_NETSERVER true)
         add_subdirectory(gameServer)
         message(STATUS "Found GHC: ${ghc_executable}")
     else()
--- a/QTfrontend/hwconsts.cpp.in	Mon Mar 04 10:08:38 2013 +0100
+++ b/QTfrontend/hwconsts.cpp.in	Mon Mar 04 10:30:56 2013 +0100
@@ -73,7 +73,5 @@
 QString * netHost = new QString();
 quint16 netPort = NETGAME_DEFAULT_PORT;
 
-bool haveServer = ${HAVE_NETSERVER};
-
 int season = SEASON_NONE;
 int years_since_foundation = 0;
--- a/QTfrontend/hwconsts.h	Mon Mar 04 10:08:38 2013 +0100
+++ b/QTfrontend/hwconsts.h	Mon Mar 04 10:30:56 2013 +0100
@@ -50,7 +50,6 @@
 extern QString * netHost;
 extern quint16 netPort;
 
-extern bool haveServer;
 
 //Current season, SEASON_NONE by default
 extern int season;
--- a/QTfrontend/ui/page/pagenet.cpp	Mon Mar 04 10:08:38 2013 +0100
+++ b/QTfrontend/ui/page/pagenet.cpp	Mon Mar 04 10:30:56 2013 +0100
@@ -72,7 +72,12 @@
 
     BtnNetSvrStart = formattedButton(QPushButton::tr("Start server"));
     BtnNetSvrStart->setMinimumWidth(180);
-    BtnNetSvrStart->setVisible(haveServer);
+    QString serverPath = bindir->absolutePath() + "/hedgewars-server";
+#ifdef Q_WS_WIN
+    serverPath += + ".exe";
+#endif
+    QFile server(serverPath);
+    BtnNetSvrStart->setVisible(server.exists());
 
     footerLayout->addStretch();
     footerLayout->addWidget(BtnNetSvrStart);