]> git.mxchange.org Git - flightgear.git/commitdiff
Incorporated Oliver's initial networking code.
authorcurt <curt>
Tue, 22 Jun 1999 21:24:31 +0000 (21:24 +0000)
committercurt <curt>
Tue, 22 Jun 1999 21:24:31 +0000 (21:24 +0000)
acconfig.h
src/Cockpit/hud.cxx
src/GUI/gui.cxx
src/Main/Makefile.am
src/Main/main.cxx
src/Main/options.cxx
src/Main/options.hxx

index 98c86342d10f19709abeaeff1f42fcd06064618c..afce6c4a15cf38d1ad58c687c9c5fc77504287e6 100644 (file)
@@ -49,6 +49,9 @@
    release build */
 #undef FG_NDEBUG
    
+/* Define to include Oliver's networking support */
+#undef FG_NETWORK_OLK
+   
 /* Define to the type of elements in the array set by `getgroups'.
    Usually this is either `int' or `gid_t'.  */
 #undef GETGROUPS_T
index 36d03c3b623bb07b2f5922d59bb1be457bb34114..d1e3c1f01cbfd705c41b062a0d2add10aa47950b 100644 (file)
@@ -50,6 +50,7 @@
 #include <Math/fg_random.h>
 #include <Math/mat3.h>
 #include <Math/polar3d.hxx>
+#include <Network/network.h>
 #include <Scenery/scenery.hxx>
 #include <Time/fg_timer.hxx>
 
@@ -1105,6 +1106,12 @@ void fgUpdateHUD( void ) {
   char *gmt_str = get_formated_gmt_time();
   HUD_TextList.add( fgText( 40, 10, gmt_str) );
   
+#ifdef FG_NETWORK_OLK
+  if ( net_hud_display ) {
+      net_hud_update();
+  }
+#endif
+
   HUD_TextList.draw();
 
   line_width = (current_options.get_xsize() > 1000) ? 1.0 : 0.5;
index 7bbd73b819b5ec95627ce584cdf716cb9cc79843..164ec1a530b877097c318cde41a82350b64fc35a 100644 (file)
@@ -58,6 +58,7 @@
 #include <Main/fg_init.hxx>
 #include <Main/views.hxx>
 #include <Misc/fgpath.hxx>
+#include <Network/network.h>
 #include <Time/fg_time.hxx>
 
 #include "gui.h"
@@ -507,6 +508,91 @@ static void NewAirportInit(void)
     FG_FINALIZE_PUI_DIALOG( AptDialog );
 }
 
+/// The beginnings of networking :-)
+//  Needs cleaning up but works
+//  These statics should disapear when this is a class
+static puDialogBox     *NetIdDialog = 0;
+static puFrame         *NetIdDialogFrame = 0;
+static puText          *NetIdDialogMessage = 0;
+static puInput         *NetIdDialogInput = 0;
+
+static char NewNetId[16];
+static char NewNetIdLabel[] = "Enter New Callsign"; 
+
+static puOneShot       *NetIdDialogOkButton = 0;
+static puOneShot       *NetIdDialogCancelButton = 0;
+
+void NetIdDialog_Cancel(puObject *)
+{
+    FG_POP_PUI_DIALOG( NetIdDialog );
+}
+
+void NetIdDialog_OK (puObject *)
+{
+    string NetId;
+    
+    FGTime *t = FGTime::cur_time_params;
+    int PauseMode = t->getPause();
+    if(!PauseMode)
+        t->togglePauseMode();
+
+    char *s;
+    NetIdDialogInput->getValue(&s);
+    NetId = s;
+    
+    NetIdDialog_Cancel( NULL );
+    current_options.set_net_id( NetId.c_str() );
+    net_hud_display = 1;
+
+    if( PauseMode != t->getPause() )
+        t->togglePauseMode();
+}
+
+void NewCallSign(puObject *cb)
+{
+    sprintf( NewNetId, "%s", current_options.get_net_id().c_str() );
+    NetIdDialogInput->setValue( NewNetId );
+
+    FG_PUSH_PUI_DIALOG( NetIdDialog );
+}
+
+static void NewNetIdInit(void)
+{
+    sprintf( NewNetId, "%s", current_options.get_net_id().c_str() );
+    int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
+                                      NewNetIdLabel ) / 2;
+
+    NetIdDialog = new puDialogBox (150, 50);
+    {
+        NetIdDialogFrame   = new puFrame           (0,0,350, 150);
+        NetIdDialogMessage = new puText            (len, 110);
+        NetIdDialogMessage ->    setLabel          (NewNetIdLabel);
+
+        NetIdDialogInput   = new puInput           (50, 70, 300, 100);
+        NetIdDialogInput   ->    setValue          (NewNetId);
+        NetIdDialogInput   ->    acceptInput();
+
+        NetIdDialogOkButton     =  new puOneShot   (50, 10, 110, 50);
+        NetIdDialogOkButton     ->     setLegend   (gui_msg_OK);
+        NetIdDialogOkButton     ->     setCallback (NetIdDialog_OK);
+        NetIdDialogOkButton     ->     makeReturnDefault(TRUE);
+
+        NetIdDialogCancelButton =  new puOneShot   (240, 10, 300, 50);
+        NetIdDialogCancelButton ->     setLegend   (gui_msg_CANCEL);
+        NetIdDialogCancelButton ->     setCallback (NetIdDialog_Cancel);
+
+    }
+    FG_FINALIZE_PUI_DIALOG( NetIdDialog );
+}
+
+static void net_display_toggle( puObject *cb)
+{
+       net_hud_display = (net_hud_display) ? 0 : 1;
+}
+
+/***************  End Networking  **************/
+
+
 
 /* -----------------------------------------------------------------------
 The menu stuff 
@@ -553,6 +639,17 @@ puCallback optionsSubmenuCb     [] = {
     notCb, notCb, NULL
 };
 
+#ifdef FG_NETWORK_OLK
+char *networkSubmenu            [] = {
+    "Unregister from FGD ", "Send MSG to All", "Send MSG", "Show Pilots", "Register to FGD",
+    "Scan for Deamons", "Enter Callsign", "Display Netinfos", "Toggle Display", NULL
+};
+puCallback networkSubmenuCb     [] = {
+    notCb, notCb, notCb, notCb, notCb, notCb, NewCallSign, notCb,
+    net_display_toggle, NULL
+};
+#endif
+
 char *helpSubmenu               [] = {
     "About...", "Help", NULL
 };
@@ -626,6 +723,9 @@ void guiInit()
     // Set up our Dialog Boxes
     ConfirmExitDialogInit();
     NewAirportInit();
+#ifdef FG_NETWORK_OLK
+    NewNetIdInit();
+#endif
     mkDialogInit();
     
     // Make the menu bar
@@ -636,6 +736,9 @@ void guiInit()
     mainMenuBar -> add_submenu ("Aircraft", aircraftSubmenu, aircraftSubmenuCb);
     mainMenuBar -> add_submenu ("Environment", environmentSubmenu, environmentSubmenuCb);
     mainMenuBar -> add_submenu ("Options", optionsSubmenu, optionsSubmenuCb);
+#ifdef FG_NETWORK_OLK
+    mainMenuBar -> add_submenu ("Network", networkSubmenu, networkSubmenuCb);
+#endif
     mainMenuBar -> add_submenu ("Help", helpSubmenu, helpSubmenuCb);
     mainMenuBar-> close ();
     // Set up menu bar toggle
index d0af569d8231b5b314e1a129aa9408c097e0841f..b60fa20ea6f40b5fe6a80a798855e66289f1f8b7 100644 (file)
@@ -58,6 +58,7 @@ fgfs_LDADD = \
        $(top_builddir)/Simulator/GUI/libGUI.a \
        $(top_builddir)/Simulator/Scenery/libScenery.a \
        $(top_builddir)/Simulator/Airports/libAirports.a \
+        $(top_builddir)/Simulator/Network/libNetwork.a \
        $(top_builddir)/Simulator/Objects/libObjects.a \
        $(top_builddir)/Simulator/Time/libTime.a \
        $(top_builddir)/Simulator/Weather/libWeather.a \
index d6f1ec88b555f5b1cf5d637303aa45b447591222..9ed50324087263ec2490f0af926653ffd0f74fd0 100644 (file)
@@ -427,7 +427,7 @@ static void fgRenderFrame( void ) {
        sgMultMat4( sgVIEW, current_view.sgVIEW, sgTRANS );
        ssgSetCamera( sgVIEW );
        // ssgSetCamera( current_view.sgVIEW );
-       ssgCullAndDraw( scene );
+       // ssgCullAndDraw( scene );
 
     }
 
@@ -1066,8 +1066,10 @@ int main( int argc, char **argv ) {
     // distribution) specifically from the ssg tux example
     //
 
-    ssgModelPath( "/stage/pinky01/src/Libs/plib-1.0.12/examples/ssg/tux/data/" );
-    ssgTexturePath( "/stage/pinky01/src/Libs/plib-1.0.12/examples/ssg/tux/data/" );
+    // ssgModelPath( "/stage/pinky01/src/Libs/plib-1.0.12/examples/ssg/tux/data/" );
+    // ssgTexturePath( "/stage/pinky01/src/Libs/plib-1.0.12/examples/ssg/tux/data/" );
+    ssgModelPath( "/h/curt/src/Libs/plib-1.0.12/examples/ssg/tux/data/" );
+    ssgTexturePath( "/h/curt/src/Libs/plib-1.0.12/examples/ssg/tux/data/" );
 
     scene = new ssgRoot;
     penguin = new ssgTransform;
index da93926dbcac000062d3ab130d28a36b2a78b28e..286776c7169062b06215f1ad69a985aef722766a 100644 (file)
@@ -201,6 +201,7 @@ fgOPTIONS::fgOPTIONS() :
     }
 
     airport_id = "";  // default airport id
+    net_id = "";
 
     // initialize port config string list
     port_options_list.erase ( port_options_list.begin(), 
index fa4c5f497c1bdd9cdc7b8a25afb4c410f279dba8..cb20dcc28fb5f9bf40d98352a67aa6c2f440098d 100644 (file)
@@ -151,6 +151,9 @@ private:
 
     // Serial port configuration strings
     str_container port_options_list;
+
+    // Network options
+    string net_id;
     
 public:
 
@@ -210,6 +213,7 @@ public:
     inline str_container get_port_options_list() const { 
        return port_options_list;
     }
+    inline string get_net_id() const { return net_id; }
 
     // Update functions
     inline void set_airport_id( const string id ) { airport_id = id; }
@@ -230,6 +234,7 @@ public:
     void toggle_panel();
     inline void set_xsize( int x ) { xsize= x; }
     inline void set_ysize( int y ) { xsize= y; }
+    inline void set_net_id( const string id ) { net_id = id; }
 
 private: