Make use of server port option
authorunc0rr
Fri, 14 Dec 2007 15:02:46 +0000
changeset 658 a7e625f5d9d0
parent 657 b34fc518a48a
child 659 5eafb20566f1
Make use of server port option
QTfrontend/hwform.cpp
QTfrontend/netserver.cpp
QTfrontend/netserver.h
--- a/QTfrontend/hwform.cpp	Thu Dec 13 23:07:16 2007 +0000
+++ b/QTfrontend/hwform.cpp	Fri Dec 14 15:02:46 2007 +0000
@@ -428,13 +428,13 @@
 {
   config->SaveOptions();
   pnetserver = new HWNetServer;
-  pnetserver->StartServer();
+  pnetserver->StartServer(ui.pageNetServer->sbPort->value());
   _NetConnect("localhost", pnetserver->getRunningPort(), ui.pageOptions->editNetNick->text());
 
   if (ui.pageNet->rbLocalGame->isChecked())
-    pRegisterServer = new HWNetUdpServer(0, "hedgewars server", 46631);
+    pRegisterServer = new HWNetUdpServer(0, "hedgewars server", ui.pageNetServer->sbPort->value());
   else
-    pRegisterServer = new HWNetWwwServer(0, "hedgewars server", 46631);
+    pRegisterServer = new HWNetWwwServer(0, "hedgewars server", ui.pageNetServer->sbPort->value());
 }
 
 void HWForm::NetDisconnect()
--- a/QTfrontend/netserver.cpp	Thu Dec 13 23:07:16 2007 +0000
+++ b/QTfrontend/netserver.cpp	Fri Dec 14 15:02:46 2007 +0000
@@ -23,12 +23,11 @@
 #include <QTcpSocket>
 #include <QMessageBox>
 
-const quint16 HWNetServer::ds_port=46631;
-
 extern char delimeter;
 
-void HWNetServer::StartServer()
+void HWNetServer::StartServer(quint16 port)
 {
+  ds_port = port;
   hhnum=0;
   IPCServer = new QTcpServer(this);
   if (!IPCServer->listen(QHostAddress::Any, ds_port)) {
--- a/QTfrontend/netserver.h	Thu Dec 13 23:07:16 2007 +0000
+++ b/QTfrontend/netserver.h	Fri Dec 14 15:02:46 2007 +0000
@@ -35,7 +35,7 @@
   Q_OBJECT
 
  public:
-  void StartServer();
+  void StartServer(quint16 port);
   void StopServer();
   bool isChiefClient(HWConnectedClient* cl) const;
   QMap<QString, QStringList> getGameCfg() const;
@@ -56,7 +56,7 @@
 
  private:
   HWConnectedClient* getChiefClient() const;
-  static const quint16 ds_port;
+  quint16 ds_port;
   QTcpServer* IPCServer;
   QList<HWConnectedClient*> connclients;