use NETGAME_DEFAULT_PORT macro across frontend sources
authorkoda
Thu, 28 Feb 2013 22:59:22 +0100
changeset 8609 3f6c08223aa1
parent 8608 50cc0131b109
child 8610 6d6b5b529890
use NETGAME_DEFAULT_PORT macro across frontend sources
QTfrontend/gameuiconfig.cpp
QTfrontend/hwform.cpp
QTfrontend/net/netudpserver.cpp
QTfrontend/net/netudpwidget.cpp
QTfrontend/ui/dialog/input_ip.cpp
QTfrontend/ui/page/pagenetserver.cpp
--- a/QTfrontend/gameuiconfig.cpp	Thu Feb 28 22:47:42 2013 +0100
+++ b/QTfrontend/gameuiconfig.cpp	Thu Feb 28 22:59:22 2013 +0100
@@ -130,10 +130,10 @@
 
     delete netHost;
     netHost = new QString(value("net/ip", "").toString());
-    netPort = value("net/port", 46631).toUInt();
+    netPort = value("net/port", NETGAME_DEFAULT_PORT).toUInt();
 
     Form->ui.pageNetServer->leServerDescr->setText(value("net/servername", "hedgewars server").toString());
-    Form->ui.pageNetServer->sbPort->setValue(value("net/serverport", 46631).toUInt());
+    Form->ui.pageNetServer->sbPort->setValue(value("net/serverport", NETGAME_DEFAULT_PORT).toUInt());
 
     Form->ui.pageOptions->CBShowFPS->setChecked(value("fps/show", false).toBool());
     Form->ui.pageOptions->fpsedit->setValue(value("fps/limit", 27).toUInt());
--- a/QTfrontend/hwform.cpp	Thu Feb 28 22:47:42 2013 +0100
+++ b/QTfrontend/hwform.cpp	Thu Feb 28 22:59:22 2013 +0100
@@ -361,7 +361,7 @@
 {
     if(hwnet && (hwnet->clientState() != HWNewNet::Disconnected))
     {
-        xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare("netserver.hedgewars.org:46631") ? "Official server" : hwnet->getHost().toAscii());
+        xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare(QString("netserver.hedgewars.org:%1").arg(NETGAME_DEFAULT_PORT)) ? "Official server" : hwnet->getHost().toAscii());
         switch(hwnet->clientState())
         {
             case HWNewNet::Connecting: // Connecting
@@ -1008,7 +1008,7 @@
 
 void HWForm::NetConnectOfficialServer()
 {
-    NetConnectServer("netserver.hedgewars.org", 46631);
+    NetConnectServer("netserver.hedgewars.org", NETGAME_DEFAULT_PORT);
 }
 
 void HWForm::NetPassword(const QString & nick)
--- a/QTfrontend/net/netudpserver.cpp	Thu Feb 28 22:47:42 2013 +0100
+++ b/QTfrontend/net/netudpserver.cpp	Thu Feb 28 22:59:22 2013 +0100
@@ -20,13 +20,14 @@
 #include <QUdpSocket>
 
 #include "netudpserver.h"
+#include "hwconsts.h"
 
 HWNetUdpServer::HWNetUdpServer(QObject *parent, const QString & descr, quint16 port) :
     HWNetRegisterServer(parent, descr, port),
     m_descr(descr)
 {
     pUdpSocket = new QUdpSocket(this);
-    pUdpSocket->bind(46631);
+    pUdpSocket->bind(NETGAME_DEFAULT_PORT);
     connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead()));
 }
 
--- a/QTfrontend/net/netudpwidget.cpp	Thu Feb 28 22:47:42 2013 +0100
+++ b/QTfrontend/net/netudpwidget.cpp	Thu Feb 28 22:59:22 2013 +0100
@@ -20,6 +20,7 @@
 #include <QUdpSocket>
 
 #include "netudpwidget.h"
+#include "hwconsts.h"
 
 HWNetUdpModel::HWNetUdpModel(QObject* parent) :
     HWNetServersModel(parent)
@@ -36,7 +37,7 @@
 
     reset();
 
-    pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, 46631);
+    pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, NETGAME_DEFAULT_PORT);
 }
 
 void HWNetUdpModel::onClientRead()
@@ -54,7 +55,7 @@
         if(packet.startsWith("hedgewars server"))
         {
             QStringList sl;
-            sl << packet.remove(0, 17) << clientAddr.toString() << "46631";
+            sl << packet.remove(0, 17) << clientAddr.toString() << QString::number(NETGAME_DEFAULT_PORT);
             games.append(sl);
         }
     }
--- a/QTfrontend/ui/dialog/input_ip.cpp	Thu Feb 28 22:47:42 2013 +0100
+++ b/QTfrontend/ui/dialog/input_ip.cpp	Thu Feb 28 22:59:22 2013 +0100
@@ -23,6 +23,7 @@
 #include <QLabel>
 
 #include "input_ip.h"
+#include "hwconsts.h"
 
 HWHostPortDialog::HWHostPortDialog(QWidget* parent) : QDialog(parent)
 {
@@ -66,5 +67,5 @@
 
 void HWHostPortDialog::setDefaultPort()
 {
-    sbPort->setValue(46631);
+    sbPort->setValue(NETGAME_DEFAULT_PORT);
 }
--- a/QTfrontend/ui/page/pagenetserver.cpp	Thu Feb 28 22:47:42 2013 +0100
+++ b/QTfrontend/ui/page/pagenetserver.cpp	Thu Feb 28 22:59:22 2013 +0100
@@ -26,6 +26,7 @@
 #include <QSpinBox>
 
 #include "pagenetserver.h"
+#include "hwconsts.h"
 
 QLayout * PageNetServer::bodyLayoutDefinition()
 {
@@ -95,5 +96,5 @@
 
 void PageNetServer::setDefaultPort()
 {
-    sbPort->setValue(46631);
+    sbPort->setValue(NETGAME_DEFAULT_PORT);
 }