define NETGAME_DEFAULT_SERVER
authorkoda
Wed, 27 Mar 2013 14:12:19 +0100
changeset 8803 b3f37e7f9ff4
parent 8801 c38ce9cf4c3a
child 8805 c0ea47957bdc
define NETGAME_DEFAULT_SERVER
QTfrontend/HWApplication.cpp
QTfrontend/hwconsts.h
QTfrontend/hwform.cpp
--- a/QTfrontend/HWApplication.cpp	Wed Mar 27 14:12:05 2013 +0100
+++ b/QTfrontend/HWApplication.cpp	Wed Mar 27 14:12:19 2013 +0100
@@ -35,7 +35,7 @@
 }
 #endif
 
-HWApplication::HWApplication(int &argc,  char **argv):
+HWApplication::HWApplication(int &argc, char **argv) :
     QApplication(argc, argv)
 {
 #if !defined(Q_WS_WIN)
@@ -85,7 +85,7 @@
         } else if (scheme == "hwplay") {
             int port = openEvent->url().port(NETGAME_DEFAULT_PORT);
             if (address == "")
-                address = "netserver.hedgewars.org";
+                address = NETGAME_DEFAULT_SERVER;
             form->NetConnectQuick(address, (quint16) port);
             return true;
         } else {
--- a/QTfrontend/hwconsts.h	Wed Mar 27 14:12:05 2013 +0100
+++ b/QTfrontend/hwconsts.h	Wed Mar 27 14:12:19 2013 +0100
@@ -67,6 +67,7 @@
 #define SEASON_HWBDAY 4
 #define SEASON_EASTER 8
 
+#define NETGAME_DEFAULT_SERVER "netserver.hedgewars.org"
 #define NETGAME_DEFAULT_PORT 46631
 #define HEDGEHOGS_PER_TEAM 8
 
--- a/QTfrontend/hwform.cpp	Wed Mar 27 14:12:05 2013 +0100
+++ b/QTfrontend/hwform.cpp	Wed Mar 27 14:12:19 2013 +0100
@@ -361,7 +361,7 @@
 {
     if(hwnet && (hwnet->clientState() != HWNewNet::Disconnected))
     {
-        xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare(QString("netserver.hedgewars.org:%1").arg(NETGAME_DEFAULT_PORT)) ? "Official server" : hwnet->getHost().toAscii());
+        xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare(QString("%1:%2").arg(NETGAME_DEFAULT_SERVER).arg(NETGAME_DEFAULT_PORT)) ? "Official server" : hwnet->getHost().toAscii());
         switch(hwnet->clientState())
         {
             case HWNewNet::Connecting: // Connecting
@@ -1014,7 +1014,7 @@
 
 void HWForm::NetConnectOfficialServer()
 {
-    NetConnectServer("netserver.hedgewars.org", NETGAME_DEFAULT_PORT);
+    NetConnectServer(NETGAME_DEFAULT_SERVER, NETGAME_DEFAULT_PORT);
 }
 
 void HWForm::NetPassword(const QString & nick)
@@ -1345,7 +1345,7 @@
     //nick and pass stuff
     QString nickname = config->value("net/nick", "").toString();
 
-    hwnet->m_private_game = !(hostName == "netserver.hedgewars.org" && port == NETGAME_DEFAULT_PORT);
+    hwnet->m_private_game = !(hostName == NETGAME_DEFAULT_SERVER && port == NETGAME_DEFAULT_PORT);
     if (hwnet->m_private_game == false)
         if (AskForNickAndPwd() != 0)
             return;