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();
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() )
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 **************/
#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
#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>
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 );
#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"
#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(),
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;
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 ) {
}
-
-
--- /dev/null
+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
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
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
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)
# include <config.h>
#endif
+/*
+
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
}
#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, 18, fgd_str) );
}
+++ /dev/null
-// 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>
--- /dev/null
+// 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");
+}
#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