diff -ru src-0.84/server/Makefile src-0.84-sgiirix5/server/Makefile --- src-0.84/server/Makefile Sat Mar 16 08:45:42 1996 +++ src-0.84-sgiirix5/server/Makefile Sun Aug 3 21:34:30 1997 @@ -1,9 +1,9 @@ -CC=cc +CC=gcc S_OBJS = main.o socket.o data.o map.o newplayer.o tick.o sintab.o log.o motd.o life.o commands.o S_SRC = `echo $(S_OBJS) | sed -e 's/\.o/.c/g'` -EXTRAFLAGS = -g -Wall -DLIFE -DLIFEFREQ=300 +EXTRAFLAGS = -g -Wall -DLIFE -DLIFEFREQ=300 -DHAVE_GIGS INCLUDES = -I../common @@ -11,7 +11,7 @@ # and a hosed make .c.o: ; $(CC) $(CFLAGS) -c $*.c -LIBS = $(EXTRALIBS) -lc -lm +LIBS = $(EXTRALIBS) -lgigs -lc -lm CFLAGS = $(OPT) $(FLAGS) $(EXTRAFLAGS) $(FILES) $(DIRS) $(PORT) $(INCLUDES) diff -ru src-0.84/server/data.c src-0.84-sgiirix5/server/data.c --- src-0.84/server/data.c Wed Nov 22 09:08:32 1995 +++ src-0.84-sgiirix5/server/data.c Sun Aug 3 21:35:16 1997 @@ -17,6 +17,11 @@ /* all the players */ player GLO_players[MAXPLAYERS]; +#ifdef HAVE_GIGS +/* Number of connected players */ +int GLO_player_count = 0; +#endif + /* number of updates that have passed since the server started */ int GLO_counter = 0; diff -ru src-0.84/server/global.h src-0.84-sgiirix5/server/global.h --- src-0.84/server/global.h Wed Nov 22 09:38:13 1995 +++ src-0.84-sgiirix5/server/global.h Sun Aug 3 21:35:45 1997 @@ -12,6 +12,10 @@ extern player GLO_players[]; +#ifdef HAVE_GIGS +extern int GLO_player_count; +#endif + extern double *GLO_Cos, GLO_Sin[]; extern int GLO_counter; diff -ru src-0.84/server/main.c src-0.84-sgiirix5/server/main.c --- src-0.84/server/main.c Wed Nov 22 09:32:57 1995 +++ src-0.84-sgiirix5/server/main.c Sun Aug 3 21:46:02 1997 @@ -19,8 +19,25 @@ #include "commands.h" #include "sintab.h" +#ifdef HAVE_GIGS +#include +#endif + +static volatile int server_running = 1; int listenSock = -1; + +/* exithandler(int) + * + * set static server_running to 0 when signaled + * + * Return: none + */ +void exithandler(int sig) +{ + server_running = 0; +} + /* init_players() * * Clear all the player structures @@ -84,6 +101,11 @@ /* ignores certain errors from sockets */ signal(SIGPIPE, SIG_IGN); +#ifdef HAVE_GIGS + /* notify GIGS when server stops */ + signal(SIGINT, exithandler); +#endif + /* Open up our initial sockets */ NET_listenSocket(XFIREPORT); @@ -103,8 +125,20 @@ /* clear the voting status of commands */ commands_init_commands(); +#ifdef HAVE_GIGS + /* XXX hack - should use SERVERVERSION but need char * */ + GIGS_init(); +#endif + /* This is it, NET_checkSockets() does all the real work. */ - while (1) { + while (server_running) { +#ifdef HAVE_GIGS + GIGS_notifySimple("Firepower", XFIREPORT, "0.84", GLO_player_count); +#endif NET_checkSockets(); } +#ifdef HAVE_GIGS + GIGS_serverStopped("Firepower", XFIREPORT, "0.84"); +#endif + return 0; } diff -ru src-0.84/server/newplayer.c src-0.84-sgiirix5/server/newplayer.c --- src-0.84/server/newplayer.c Wed Nov 22 09:34:36 1995 +++ src-0.84-sgiirix5/server/newplayer.c Sun Aug 3 21:47:54 1997 @@ -113,6 +113,9 @@ /* send a text message about him */ sprintf(buf, "Player %d joining", pl); NET_send_message_to_all(buf, M_SRV); +#ifdef HAVE_GIGS + GLO_player_count++; +#endif } /* newplayer_remove_player(pl) @@ -157,6 +160,9 @@ /* no players are left, read a new map in and wait for connections */ map_pick_map(GLO_maplist); } +#ifdef HAVE_GIGS + GLO_player_count = livecount; +#endif } /* newplayer_game_over(team)