1
0
Fork 0

Initial revision.

This commit is contained in:
curt 1999-06-24 20:40:22 +00:00
parent aea253a85c
commit 8520f46403
5 changed files with 174 additions and 0 deletions

6
src/Network/Makefile.am Normal file
View file

@ -0,0 +1,6 @@
noinst_LIBRARIES = libNetwork.a
libNetwork_a_SOURCES = \
net_hud.cxx
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator

32
src/Network/README Normal file
View file

@ -0,0 +1,32 @@
Network README
--------------
Here in .../Simulator/Network will be the new home for multi pilot
related code.
For the moment all you get is a new menu entry "Network" with the
folowing entries:
- 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
- Enter Callsign : to enter your name
- Scan for Deamons : n.i. will scan the network for FGFS_D's
- Register to FGD : n.i. will allow pilot to connect to found Deamons
- Show Pilots : n.i. ? not yet sure what to show, maybe their planes
- Send Message : n.i. will send a message to a specific Pilot
- Send Message to all : n.i. obvious, isn't it ?
- Unregister from Deamon : n.i.
In the Tools directory you will find some progs (one first try of deamon)
to play with. There is also a README file, check it out.
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 ;-)
b) Runtime - setting the "int net_hud_display" variable to 0 disables any
network display (default)
Have Phun
Oliver <delise@rp-plus.de>

78
src/Network/net_hud.cxx Normal file
View file

@ -0,0 +1,78 @@
// network.cxx -- 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$
#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 <Cockpit/hud.hxx>
int net_hud_display = 0;
void net_hud_update(){
char fgd_str[80];
char *fgd_pilot;
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) );
}

26
src/Network/net_hud.h Normal file
View file

@ -0,0 +1,26 @@
// 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>

32
src/Network/network.h Normal file
View file

@ -0,0 +1,32 @@
// network.h -- public 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$
#ifndef NETWORK_H
#define NETWORK_H
#define FGD
extern int net_hud_display;
extern void net_hud_update( void );
#endif