From: curt Date: Mon, 28 Feb 2000 04:16:12 +0000 (+0000) Subject: Make NetworkOLK optional even if compiled in. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=749462f9bb39887008adbb54fd32d35acc25a084;p=flightgear.git Make NetworkOLK optional even if compiled in. --- diff --git a/src/GUI/gui.cxx b/src/GUI/gui.cxx index 20c8326bd..c6f40e324 100644 --- a/src/GUI/gui.cxx +++ b/src/GUI/gui.cxx @@ -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) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 2af1f3e9c..e97c4d376 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -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 ); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index da885d388..57a9fa257 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -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 ) { diff --git a/src/Main/options.hxx b/src/Main/options.hxx index e01ee0ee4..23c580697 100644 --- a/src/Main/options.hxx +++ b/src/Main/options.hxx @@ -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: