]> git.mxchange.org Git - flightgear.git/commitdiff
Make NetworkOLK optional even if compiled in.
authorcurt <curt>
Mon, 28 Feb 2000 04:16:12 +0000 (04:16 +0000)
committercurt <curt>
Mon, 28 Feb 2000 04:16:12 +0000 (04:16 +0000)
src/GUI/gui.cxx
src/Main/main.cxx
src/Main/options.cxx
src/Main/options.hxx

index 20c8326bd8170d7b5b1cf6fcc8d1e55ce0366df2..c6f40e324a7a03d4a021c1536893061602c3c2f0 100644 (file)
@@ -742,7 +742,9 @@ void goodBye(puObject *)
     cout << "Program exiting normally at user request." << endl;
 
 #ifdef FG_NETWORK_OLK    
-    if ( net_is_registered == 0 ) fgd_send_com( "8", FGFS_host);
+    if ( current_options.get_network_olk() ) {
+       if ( net_is_registered == 0 ) fgd_send_com( "8", FGFS_host);
+    }
 #endif
 
     //  if(gps_bug)
index 2af1f3e9c74c735df7f3ec182449d7ccf057408f..e97c4d3767f117eaded55db8edfde23744109a72 100644 (file)
@@ -553,22 +553,24 @@ void fgRenderFrame( void ) {
        }
 
 # ifdef FG_NETWORK_OLK
-       sgCoord fgdpos;
-       other = head->next;             /* put listpointer to start  */
-       while ( other != tail) {        /* display all except myself */
-           if ( strcmp( other->ipadr, fgd_mcp_ip) != 0) {
-               other->fgd_sel->select(1);
-               sgSetCoord( &fgdpos, other->sgFGD_COORD );
-               other->fgd_pos->setTransform( &fgdpos );
+       if ( current_options.get_network_olk() ) {
+           sgCoord fgdpos;
+           other = head->next;             /* put listpointer to start  */
+           while ( other != tail) {        /* display all except myself */
+               if ( strcmp( other->ipadr, fgd_mcp_ip) != 0) {
+                   other->fgd_sel->select(1);
+                   sgSetCoord( &fgdpos, other->sgFGD_COORD );
+                   other->fgd_pos->setTransform( &fgdpos );
+               }
+               other = other->next;
            }
-           other = other->next;
-       }
 
-       // fgd_sel->select(1);
-       // sgCopyMat4( sgTUX, current_view.sgVIEW);
-       // sgCoord fgdpos;
-       // sgSetCoord( &fgdpos, sgFGD_VIEW );
-       // fgd_pos->setTransform( &fgdpos);
+           // fgd_sel->select(1);
+           // sgCopyMat4( sgTUX, current_view.sgVIEW);
+           // sgCoord fgdpos;
+           // sgSetCoord( &fgdpos, sgFGD_VIEW );
+           // fgd_pos->setTransform( &fgdpos);
+       }
 # endif
 
        ssgSetCamera( current_view.VIEW );
@@ -734,10 +736,12 @@ static void fgMainLoop( void ) {
     FG_LOG( FG_ALL, FG_DEBUG, "======= ==== ====");
 
 #ifdef FG_NETWORK_OLK
-    if ( net_is_registered == 0 ) {           // We first have to reg. to fgd
-        // printf("FGD: Netupdate\n");
-        fgd_send_com( "A", FGFS_host);   // Send Mat4 data
-        fgd_send_com( "B", FGFS_host);   // Recv Mat4 data
+    if ( current_options.get_network_olk() ) {
+       if ( net_is_registered == 0 ) {      // We first have to reg. to fgd
+           // printf("FGD: Netupdate\n");
+           fgd_send_com( "A", FGFS_host);   // Send Mat4 data
+           fgd_send_com( "B", FGFS_host);   // Recv Mat4 data
+       }
     }
 #endif
 
@@ -1318,7 +1322,9 @@ int main( int argc, char **argv ) {
 
 #ifdef FG_NETWORK_OLK
     // Do the network intialization
-    printf("Multipilot mode %s\n", fg_net_init( scene ) );
+    if ( current_options.get_network_olk() ) {
+       printf("Multipilot mode %s\n", fg_net_init( scene ) );
+    }
 #endif
 
     scene->addKid( terrain );
index da885d3881f843c4f92289d2fd77bc4fb9f2c799..57a9fa2571fb0ded99dcd60c2df1b058999df6b2 100644 (file)
@@ -189,7 +189,9 @@ fgOPTIONS::fgOPTIONS() :
     tris_or_culled(0),
        
     // Time options
-    time_offset(0)
+    time_offset(0),
+
+    network_olk(false)
 {
     // set initial values/defaults
     time_offset_type=FG_TIME_SYS_OFFSET;
@@ -762,6 +764,10 @@ int fgOPTIONS::parse_option( const string& arg ) {
     } else if ( arg.find( "--rul=" ) != string::npos ) {
        parse_channel( "rul", arg.substr(6) );
 #ifdef FG_NETWORK_OLK
+    } else if ( arg == "--disable-network-olk" ) {
+       network_olk = false;    
+    } else if ( arg== "--enable-network-olk") {
+       network_olk = true;     
     } else if ( arg == "--net-hud" ) {
        net_hud_display = 1;    
     } else if ( arg.find( "--net-id=") != string::npos ) {
index e01ee0ee4823894a9e86abb9f49407b58f1dd46b..23c5806977ae91c3469f50636b4c7b2519cce989 100644 (file)
@@ -194,6 +194,7 @@ private:
     string_list channel_options_list;
 
     // Network options
+    bool network_olk;
     string net_id;
     
 public:
@@ -271,6 +272,8 @@ public:
     inline string_list get_channel_options_list() const { 
        return channel_options_list;
     }
+
+    inline bool get_network_olk() const { return network_olk; }
     inline string get_net_id() const { return net_id; }
 
     // Update functions
@@ -332,6 +335,7 @@ public:
        }
     }
 
+    inline void set_network_olk( bool net ) { network_olk = net; }
     inline void set_net_id( const string id ) { net_id = id; }
 
 private: