]> git.mxchange.org Git - flightgear.git/blobdiff - src/MultiPlayer/multiplaymgr.cxx
toggle fullscreen: also adapt GUI plane when resizing
[flightgear.git] / src / MultiPlayer / multiplaymgr.cxx
index 8c7a8d7c5f3b94186d13592091d8424ebcee5444..7d6ce8b33dc8909e2cb0655d88702ace460edaca 100644 (file)
@@ -35,7 +35,6 @@
 #include <algorithm>
 #include <cstring>
 #include <errno.h>
-#include <osg/Math>             // isNaN
 
 #include <simgear/misc/stdint.hxx>
 #include <simgear/timing/timestamp.hxx>
@@ -302,7 +301,7 @@ namespace
         case props::DOUBLE:
           {
             float val = XDR_decode_float(*xdr);
-            if (osg::isNaN(val))
+            if (SGMisc<float>::isNaN(val))
               return false;
             xdr++;
             break;
@@ -404,14 +403,9 @@ FGMultiplayMgr::init (void)
     return;
   }
 
-  fgSetBool("/sim/multiplay/online", false);
-
-  if (!fgGetBool("/sim/ai/enabled"))
-  {
-      SG_LOG(SG_NETWORK, SG_ALERT,
-        "Cannot enable multiplayer mode: AI subsystem is disabled (to enable start with '--enable-ai-models').");
-      return;
-  }
+  SGPropertyNode* propOnline = fgGetNode("/sim/multiplay/online", true);
+  propOnline->setBoolValue(false);
+  propOnline->setAttribute(SGPropertyNode::PRESERVE, true);
 
   //////////////////////////////////////////////////
   //  Set members from property values
@@ -445,7 +439,7 @@ FGMultiplayMgr::init (void)
     if (rxPort <= 0)
       rxPort = txPort;
   } else {
-    SG_LOG(SG_NETWORK, SG_ALERT, "Cannot enable multiplayer mode: missing a valid server address.");
+    SG_LOG(SG_NETWORK, SG_INFO, "FGMultiplayMgr - multiplayer mode disabled (no MP server specificed).");
     return;
   }
 
@@ -484,6 +478,12 @@ FGMultiplayMgr::init (void)
   mInitialised = true;
 
   SG_LOG(SG_NETWORK, SG_ALERT, "Multiplayer mode active!");
+
+  if (!fgGetBool("/sim/ai/enabled"))
+  {
+      // multiplayer depends on AI module
+      fgSetBool("/sim/ai/enabled", true);
+  }
 } // FGMultiplayMgr::init()
 //////////////////////////////////////////////////////////////////////
 
@@ -610,8 +610,8 @@ FGMultiplayMgr::isSane(const FGExternalMotionData& motionInfo)
 {
     // check for corrupted data (NaNs)
     bool isCorrupted = false;
-    isCorrupted |= ((osg::isNaN(motionInfo.time           )) ||
-                    (osg::isNaN(motionInfo.lag            )) ||
+    isCorrupted |= ((SGMisc<double>::isNaN(motionInfo.time           )) ||
+                    (SGMisc<double>::isNaN(motionInfo.lag            )) ||
                     (osg::isNaN(motionInfo.orientation(3) )));
     for (unsigned i = 0; (i < 3)&&(!isCorrupted); ++i)
     {