[Orxonox-commit 3041] r7737 - code/branches/masterserver/src/libraries/network

smerkli at orxonox.net smerkli at orxonox.net
Wed Dec 8 16:08:22 CET 2010


Author: smerkli
Date: 2010-12-08 16:08:22 +0100 (Wed, 08 Dec 2010)
New Revision: 7737

Modified:
   code/branches/masterserver/src/libraries/network/WANDiscovery.cc
   code/branches/masterserver/src/libraries/network/WANDiscovery.h
Log:
pre-merge

Modified: code/branches/masterserver/src/libraries/network/WANDiscovery.cc
===================================================================
--- code/branches/masterserver/src/libraries/network/WANDiscovery.cc	2010-12-08 15:00:30 UTC (rev 7736)
+++ code/branches/masterserver/src/libraries/network/WANDiscovery.cc	2010-12-08 15:08:22 UTC (rev 7737)
@@ -40,19 +40,35 @@
 {
   ManageScopedSingleton(WANDiscovery, ScopeID::Root, true);
 
+  void WANDiscovery::setConfigValues()
+  {
+    SetConfigValue(this->msaddr, "msaddr");
+  } 
+
   WANDiscovery::WANDiscovery()
   {
+    /* debugging output */
     COUT(4) << "Creating WANDiscovery.\n";
+  
+    /* register object with orxonox main class */
+    RegisterObject(WANDiscovery);
 
+    /* set default string for this->msaddr */
+    this->msaddr = "localhost";
+
+    /* ... and register a config value function for it */
+    this->setConfigValues();
+
     /* initialize it and see if it worked */
     if( msc.initialize() )
       COUT(2) << "Error: could not initialize master server communications!\n";
 
     /* connect and see if it worked */
-    if( msc.connect( MS_ADDRESS, 1234 ) )
+    if( msc.connect( this->msaddr.c_str(), 1234 ) )
       COUT(2) << "Error: could not connect to master server at " 
-        << MS_ADDRESS << std::endl;
+        << this->msaddr << std::endl;
 
+    /* debugging output */
     COUT(4) << "Initialization of WANDiscovery complete.\n";
   }
 

Modified: code/branches/masterserver/src/libraries/network/WANDiscovery.h
===================================================================
--- code/branches/masterserver/src/libraries/network/WANDiscovery.h	2010-12-08 15:00:30 UTC (rev 7736)
+++ code/branches/masterserver/src/libraries/network/WANDiscovery.h	2010-12-08 15:08:22 UTC (rev 7737)
@@ -31,7 +31,11 @@
 
 #include "NetworkPrereqs.h"
 #include "packet/ServerInformation.h"
+#include "core/ConfigFileManager.h"
 #include "util/Singleton.h"
+#include "core/OrxonoxClass.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/CoreIncludes.h"
 #include "MasterServerComm.h"
 #include "MasterServerProtocol.h"
 
@@ -45,7 +49,7 @@
 
   class _NetworkExport WANDiscovery
 // tolua_end
-    : public Singleton<WANDiscovery>
+    : public Singleton<WANDiscovery>, public OrxonoxClass
   { // tolua_export
     friend class Singleton<WANDiscovery>;
     public:
@@ -83,6 +87,9 @@
        */
       /** game server list */
       std::vector<packet::ServerInformation> servers_;
+
+      /** Function used for the configuration file parameter update */
+      void setConfigValues();
       
     private:
       /** Singleton pointer */
@@ -91,6 +98,9 @@
       /** Master server communications object */
       MasterServerComm msc;
 
+      /** master server address */
+      std::string msaddr;
+
   }; // tolua_export
 
 } // tolua_export




More information about the Orxonox-commit mailing list