]> git.mxchange.org Git - flightgear.git/commitdiff
Network updates contributed by Oliver Delise.
authorcurt <curt>
Wed, 30 Jun 1999 20:21:04 +0000 (20:21 +0000)
committercurt <curt>
Wed, 30 Jun 1999 20:21:04 +0000 (20:21 +0000)
src/Cockpit/hud.cxx
src/GUI/gui.cxx
src/Main/main.cxx
src/Main/options.cxx
src/Network/FILES [new file with mode: 0644]
src/Network/Makefile.am
src/Network/README
src/Network/net_hud.cxx
src/Network/net_hud.h [deleted file]
src/Network/network.cxx [new file with mode: 0644]
src/Network/network.h

index d1e3c1f01cbfd705c41b062a0d2add10aa47950b..91da17d59ea2937756b1f9ed131763d7049b2af6 100644 (file)
@@ -1105,7 +1105,7 @@ 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();
index 165a00c1f8cac02e26c56479be8d8d0431306853..8c130f24c4464d7183e47b8993ced87c7212aad8 100644 (file)
@@ -539,13 +539,16 @@ void NetIdDialog_OK (puObject *)
     int PauseMode = t->getPause();
     if(!PauseMode)
         t->togglePauseMode();
-
-    char *s;
-    NetIdDialogInput->getValue(&s);
-    NetId = s;
+/*  
+   The following needs some cleanup because 
+   "string options.NetId" and "char *net_callsign" 
+*/
+    NetIdDialogInput->getValue(&net_callsign);
+    NetId = net_callsign;
     
     NetIdDialog_Cancel( NULL );
     current_options.set_net_id( NetId.c_str() );
+/* Entering a callsign indicates : user wants Net HUD Info */
     net_hud_display = 1;
 
     if( PauseMode != t->getPause() )
@@ -592,6 +595,13 @@ static void NewNetIdInit(void)
 static void net_display_toggle( puObject *cb)
 {
        net_hud_display = (net_hud_display) ? 0 : 1;
+        printf("Toggle net_hud_display : %d\n", net_hud_display);
+}
+
+static void net_blaster_toggle( puObject *cb)
+{
+       net_blast_toggle = (net_blast_toggle) ? 0 : -1;
+        printf("Toggle net_blast : %d\n", net_blast_toggle);
 }
 
 /***************  End Networking  **************/
@@ -646,11 +656,12 @@ puCallback optionsSubmenuCb     [] = {
 #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
+    "Scan for Deamons", "Enter Callsign", "Display Netinfos", "Toggle Display",
+    "Hyper Blast", NULL
 };
 puCallback networkSubmenuCb     [] = {
     notCb, notCb, notCb, notCb, notCb, notCb, NewCallSign, notCb,
-    net_display_toggle, NULL
+    net_display_toggle, net_blaster_toggle, NULL
 };
 #endif
 
index ab70ba57bbd04e9482b7946481141dc8a6b044c7..254f8595fcb21cdb497d2701f7361a9a53ead7df 100644 (file)
@@ -81,6 +81,9 @@
 #include <Math/polar3d.hxx>
 #include <Math/fg_random.h>
 #include <Misc/fgpath.hxx>
+#ifdef FG_NETWORK_OLK
+#include <Network/network.h>
+#endif
 #include <Objects/materialmgr.hxx>
 #include <Scenery/scenery.hxx>
 #include <Scenery/tilemgr.hxx>
@@ -1121,6 +1124,11 @@ int main( int argc, char **argv ) {
     ssgFlatten( tux_obj );
     ssgStripify( penguin_sel );
 
+#ifdef FG_NETWORK_OLK
+    // Do the network intialization
+    printf("Multipilot mode %s\n", fg_net_init() );
+#endif
+
     scene->addKid( terrain );
     scene->addKid( penguin_sel );
 
index 286776c7169062b06215f1ad69a985aef722766a..89abbfc4f8c59dbca3025a47c52428f08e470036 100644 (file)
@@ -44,6 +44,9 @@ bool global_fullscreen = true;
 #include <Debug/logstream.hxx>
 #include <FDM/flight.hxx>
 #include <Misc/fgstream.hxx>
+#ifdef FG_NETWORK_OLK
+#  include <Network/network.h>
+#endif
 #include <Time/fg_time.hxx>
 
 #include "options.hxx"
@@ -200,8 +203,8 @@ fgOPTIONS::fgOPTIONS() :
 #endif
     }
 
-    airport_id = "";  // default airport id
-    net_id = "";
+    airport_id = "";           // default airport id
+    net_id = "Johnney";                // default pilot's name
 
     // initialize port config string list
     port_options_list.erase ( port_options_list.begin(), 
@@ -661,6 +664,12 @@ int fgOPTIONS::parse_option( const string& arg ) {
        tris_or_culled = 1;
     } else if ( arg.find( "--serial=" ) != string::npos ) {
        parse_serial( arg.substr(9) );
+#ifdef FG_NETWORK_OLK
+    } else if ( arg == "--net-hud" ) {
+       net_hud_display = 1;    
+    } else if ( arg.find( "--net-id=") != string::npos ) {
+       net_id = arg.substr( 9 );
+#endif
     } else {
        FG_LOG( FG_GENERAL, FG_ALERT, "Unknown option '" << arg << "'" );
        return FG_OPTIONS_ERROR;
@@ -801,11 +810,16 @@ void fgOPTIONS::usage ( void ) {
     printf("\t--time-offset=[+-]hh:mm:ss:  offset local time by this amount\n");
     printf("\t--start-date-gmt=yyyy:mm:dd:hh:mm:ss: specify a starting date/time. Time is Greenwich Mean Time\n");
     printf("\t--start-date-lst=yyyy:mm:dd:hh:mm:ss: specify a starting date/time. Uses local sidereal time\n");
+#ifdef FG_NETWORK_OLK
+    printf("\n");
+
+    printf("Network Options:\n");
+    printf("\t--net-hud:  Hud displays network info\n");
+    printf("\t--net-id=name:  specify your own callsign\n");
+#endif
 }
 
 
 // Destructor
 fgOPTIONS::~fgOPTIONS( void ) {
 }
-
-
diff --git a/src/Network/FILES b/src/Network/FILES
new file mode 100644 (file)
index 0000000..4b08245
--- /dev/null
@@ -0,0 +1,8 @@
+FILES        - This file, describing the other files
+README       - containing Network info
+Makefile.am  -  
+net_hud.cxx  - display found player's info in bottom/left part of HUD
+network.cxx  - initialization of netcode and vars
+network.h    - declaration of used vars and functions for libnetwork.a
+               should be included from other files using libnetwork
+Tools        - directory containing network tools and toys
index daa32e4fdcd806d7b2dd189a319fc7e2bd909fbc..d8f2ddf15e7b5af88133fe87d2fde89a3f94e79f 100644 (file)
@@ -1,5 +1,5 @@
 noinst_LIBRARIES = libNetwork.a
 
-libNetwork_a_SOURCES = net_hud.cxx net_hud.h network.h
+libNetwork_a_SOURCES = net_hud.cxx network.cxx network.h
 
 INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator
index c029e3097768fd96c233a18f5d75c67549953412..a8db2a9a9f4b2c75d3039ca5f1ed236a080fa3ed 100644 (file)
@@ -5,6 +5,8 @@ related code.
 For the moment all you get is a new menu entry "Network" with the
 folowing entries:
 
+- Hyper Blast            : Toggles between LaRCsim and a tuned Flight-Model
+                           you can change between both "on the fly "
 - Toggle Display         : enable/disable info (Lat/Lon/Alt) about found player
                            well, by now it will be you. ;-))
 - Display Netinfos       : n.i. will display more detailed information
@@ -23,8 +25,8 @@ You don't need a net-access to test this new stuff since it is just an idea
 of how to incorporate a Multi-Pilot Mode in FGFS.
 
 There are two security options:
-a) Compiletime - commenting the "#define FGD" in "network.h" disables _ALL_
-   network related stuff in case of problems, should not happen ;-)
+a) Compiletime - commenting the "#define FG_NETWORK_OLK" in "network.h" 
+   disables ALL network related stuff in case of problems, shouldn't occur ;-)
 b) Runtime - setting the "int net_hud_display" variable to 0 disables any
    network display (default)
 
index 52ecddbd8b83cbe74bf8902fd3bfeec598a993f3..614f08708940e7600a1b11bbe3b21e7deeab8669 100644 (file)
@@ -25,6 +25,8 @@
 #  include <config.h>
 #endif
 
+/*
+
 #ifdef HAVE_WINDOWS_H
 #  include <windows.h>
 #endif
@@ -59,20 +61,22 @@ extern "C" {
 }
 #endif
 
+*/
+
+#include <Main/options.hxx>
 #include <Cockpit/hud.hxx>
 
-int net_hud_display = 0;
+extern char *net_callsign;
+
 
 void net_hud_update(){
- char fgd_str[80];
- char *fgd_pilot;
- float fgd_lon, fgd_lat, fgd_alt;
+ static char fgd_str[80];
+ static float fgd_lon, fgd_lat, fgd_alt;
  
-  sprintf( fgd_pilot, "%s", current_options.get_net_id().c_str() );
   fgd_lon = get_longitude();
   fgd_lat = get_latitude();
   fgd_alt = get_altitude();
-  sprintf(fgd_str,"Found %s %3.3f %3.3f", fgd_pilot, fgd_lat, fgd_lon);
-//  printf("Lon: %.3f Lat: %.3f Alt: %.f\n", fgd_lon, fgd_lat, fgd_alt);
-  HUD_TextList.add( fgText( 40, 18 ,fgd_str) );
+  sprintf(fgd_str,"Found %s %3.3f %3.3f", net_callsign, fgd_lat, fgd_lon);
+//  HUD_TextList.add( fgText( 40, 18, net_callsign) );
+  HUD_TextList.add( fgText( 40, 18fgd_str) );
 }
diff --git a/src/Network/net_hud.h b/src/Network/net_hud.h
deleted file mode 100644 (file)
index 8dfa30f..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// net_hud.h -- data structures for managing network.
-//
-// Written by Oliver Delise, started May 1999.
-//
-// Copyleft (C) 1999  Oliver Delise - delise@rp-plus.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-// $Id$
-
-
-#define FGD
-
-#include <Cockpit/hud.hxx>
diff --git a/src/Network/network.cxx b/src/Network/network.cxx
new file mode 100644 (file)
index 0000000..9f9c2a4
--- /dev/null
@@ -0,0 +1,79 @@
+// network.cxx -- data structures for initializing & managing network.
+//
+// Written by Oliver Delise, started May 1999.
+//
+// Copyleft (C) 1999  Oliver Delise - delise@rp-plus.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// $Id$
+
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+/*
+#ifdef HAVE_WINDOWS_H
+#  include <windows.h>
+#endif
+
+#ifdef __BORLANDC__
+#  define exception c_exception
+#endif
+#include <math.h>
+
+#include <GL/glut.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef HAVE_VALUES_H
+#  include <values.h>  // for MAXINT
+#endif
+
+#include <Aircraft/aircraft.hxx>
+#include <Debug/logstream.hxx>
+#include <GUI/gui.h>
+#include <Include/fg_constants.h>
+#include <Main/options.hxx>
+#include <Math/fg_random.h>
+#include <Math/mat3.h>
+#include <Math/polar3d.hxx>
+#include <Scenery/scenery.hxx>
+#include <Time/fg_timer.hxx>
+
+#if defined ( __sun__ ) || defined ( __sgi )
+extern "C" {
+  extern void *memmove(void *, const void *, size_t);
+}
+#endif
+*/
+
+#include <Main/options.hxx>
+
+int  net_blast_toggle;
+int  net_hud_display;
+char *net_callsign;
+
+char *fg_net_init( void ){
+
+ // We enable display of netinfos only if user wishes it via cmd-line param
+ net_hud_display = (net_hud_display == 0) ? 0 : 1; 
+ // Get pilot's name from options, can be modified at runtime via menu
+ net_callsign = (char *) current_options.get_net_id().c_str();
+ // Disable Blast Mode -1 = Disable, 0 = Enable  
+ net_blast_toggle = -1; 
+ return("activated");
+}
index 880e3e3e7214123e31bb4732fc8b2b099871f041..be2dffcd5d4187c728bf9ea6b04c4340f6d1fdb7 100644 (file)
 
 #define FGD
 
-extern int net_hud_display;
-
+extern char *net_callsign;
+extern int  net_hud_display;
+extern int  net_blast_toggle;
+extern char *fg_net_init( void );
 extern void net_hud_update( void );
 
-#endif
\ No newline at end of file
+#endif