Module Name:    src
Committed By:   dholland
Date:           Sat Mar 29 21:24:27 UTC 2014

Modified Files:
        src/games/hunt/hunt: Makefile connect.c hunt.c otto.c playit.c
        src/games/hunt/huntd: Makefile hunt.h pathname.c
Added Files:
        src/games/hunt/hunt: hunt_private.h
        src/games/hunt/include: hunt_common.h

Log Message:
Split hunt and huntd's includes, instead of incestuously sharing a pile
of external data and function declarations between the two programs.

Common constants and defines now go in hunt_common.h. Stuff that belongs
only to hunt is in hunt/hunt_private.h. Stuff that belongs only to huntd
is in huntd/hunt.h.

Copy some declarations that are used in both programs under the same
names (but are not actually the same objects) from huntd/hunt.h to
hunt/hunt_private.h. Move others that are only used in hunt. Remove
some entirely unused material, and tidy up standard includes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/games/hunt/hunt/Makefile
cvs rdiff -u -r1.8 -r1.9 src/games/hunt/hunt/connect.c
cvs rdiff -u -r1.43 -r1.44 src/games/hunt/hunt/hunt.c
cvs rdiff -u -r0 -r1.1 src/games/hunt/hunt/hunt_private.h
cvs rdiff -u -r1.16 -r1.17 src/games/hunt/hunt/otto.c
cvs rdiff -u -r1.17 -r1.18 src/games/hunt/hunt/playit.c
cvs rdiff -u -r1.3 -r1.4 src/games/hunt/huntd/Makefile
cvs rdiff -u -r1.22 -r1.23 src/games/hunt/huntd/hunt.h
cvs rdiff -u -r1.5 -r1.6 src/games/hunt/huntd/pathname.c
cvs rdiff -u -r0 -r1.1 src/games/hunt/include/hunt_common.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/hunt/hunt/Makefile
diff -u src/games/hunt/hunt/Makefile:1.7 src/games/hunt/hunt/Makefile:1.8
--- src/games/hunt/hunt/Makefile:1.7	Sat Feb  6 23:45:25 2010
+++ src/games/hunt/hunt/Makefile	Sat Mar 29 21:24:26 2014
@@ -1,14 +1,12 @@
-#	$NetBSD: Makefile,v 1.7 2010/02/06 23:45:25 he Exp $
+#	$NetBSD: Makefile,v 1.8 2014/03/29 21:24:26 dholland Exp $
 
 PROG=	hunt
-SRCS=	connect.c hunt.c otto.c playit.c pathname.c
+SRCS=	connect.c hunt.c otto.c playit.c
 MAN=	hunt.6
 LDADD=	-lcurses -lterminfo
 DPADD=	${LIBCURSES} ${LIBTERMINFO}
 HIDEGAME=hidegame
 
-CPPFLAGS+=-I${.CURDIR}/../huntd
-
-.PATH: ${.CURDIR}/../huntd
+CPPFLAGS+=-I${.CURDIR}/../include
 
 .include <bsd.prog.mk>

Index: src/games/hunt/hunt/connect.c
diff -u src/games/hunt/hunt/connect.c:1.8 src/games/hunt/hunt/connect.c:1.9
--- src/games/hunt/hunt/connect.c:1.8	Sat Jul  4 05:01:16 2009
+++ src/games/hunt/hunt/connect.c	Sat Mar 29 21:24:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: connect.c,v 1.8 2009/07/04 05:01:16 dholland Exp $	*/
+/*	$NetBSD: connect.c,v 1.9 2014/03/29 21:24:26 dholland Exp $	*/
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
@@ -32,13 +32,16 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: connect.c,v 1.8 2009/07/04 05:01:16 dholland Exp $");
+__RCSID("$NetBSD: connect.c,v 1.9 2014/03/29 21:24:26 dholland Exp $");
 #endif /* not lint */
 
-#include "hunt.h"
+#include <string.h>
 #include <signal.h>
 #include <unistd.h>
 
+#include "hunt_common.h"
+#include "hunt_private.h"
+
 void
 do_connect(char *name, char team, long enter_status)
 {

Index: src/games/hunt/hunt/hunt.c
diff -u src/games/hunt/hunt/hunt.c:1.43 src/games/hunt/hunt/hunt.c:1.44
--- src/games/hunt/hunt/hunt.c:1.43	Sat Mar 29 20:53:55 2014
+++ src/games/hunt/hunt/hunt.c	Sat Mar 29 21:24:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hunt.c,v 1.43 2014/03/29 20:53:55 dholland Exp $	*/
+/*	$NetBSD: hunt.c,v 1.44 2014/03/29 21:24:26 dholland Exp $	*/
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: hunt.c,v 1.43 2014/03/29 20:53:55 dholland Exp $");
+__RCSID("$NetBSD: hunt.c,v 1.44 2014/03/29 21:24:26 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -49,12 +49,23 @@ __RCSID("$NetBSD: hunt.c,v 1.43 2014/03/
 #include <unistd.h>
 #include <ifaddrs.h>
 
-#include "hunt.h"
+#include "hunt_common.h"
+#include "hunt_private.h"
 
 #define clear_eol()	clrtoeol()
 #define put_ch		addch
 #define put_str		addstr
 
+#ifdef DEBUG
+char *Driver = "/home/socr/a/conrad/games/src/hunt/huntd.dbg";
+#else
+const char *Driver = HUNTD;
+#endif
+
+#ifdef INTERNET
+u_short Test_port = TEST_PORT;
+#endif
+
 bool Last_player = false;
 #ifdef MONITOR
 bool Am_monitor = false;

Index: src/games/hunt/hunt/otto.c
diff -u src/games/hunt/hunt/otto.c:1.16 src/games/hunt/hunt/otto.c:1.17
--- src/games/hunt/hunt/otto.c:1.16	Sat Mar 29 20:52:13 2014
+++ src/games/hunt/hunt/otto.c	Sat Mar 29 21:24:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: otto.c,v 1.16 2014/03/29 20:52:13 dholland Exp $	*/
+/*	$NetBSD: otto.c,v 1.17 2014/03/29 21:24:26 dholland Exp $	*/
 #ifdef OTTO
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
@@ -45,7 +45,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: otto.c,v 1.16 2014/03/29 20:52:13 dholland Exp $");
+__RCSID("$NetBSD: otto.c,v 1.17 2014/03/29 21:24:26 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/time.h>
@@ -53,8 +53,11 @@ __RCSID("$NetBSD: otto.c,v 1.16 2014/03/
 #include <ctype.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
-#include "hunt.h"
+
+#include "hunt_common.h"
+#include "hunt_private.h"
 
 #undef WALL
 #undef NORTH

Index: src/games/hunt/hunt/playit.c
diff -u src/games/hunt/hunt/playit.c:1.17 src/games/hunt/hunt/playit.c:1.18
--- src/games/hunt/hunt/playit.c:1.17	Sat Mar 29 20:52:13 2014
+++ src/games/hunt/hunt/playit.c	Sat Mar 29 21:24:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: playit.c,v 1.17 2014/03/29 20:52:13 dholland Exp $	*/
+/*	$NetBSD: playit.c,v 1.18 2014/03/29 21:24:26 dholland Exp $	*/
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: playit.c,v 1.17 2014/03/29 20:52:13 dholland Exp $");
+__RCSID("$NetBSD: playit.c,v 1.18 2014/03/29 21:24:26 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/file.h>
@@ -42,9 +42,12 @@ __RCSID("$NetBSD: playit.c,v 1.17 2014/0
 #include <curses.h>
 #include <ctype.h>
 #include <signal.h>
+#include <string.h>
 #include <termios.h>
 #include <unistd.h>
-#include "hunt.h"
+
+#include "hunt_common.h"
+#include "hunt_private.h"
 
 #ifndef FREAD
 #define FREAD	1

Index: src/games/hunt/huntd/Makefile
diff -u src/games/hunt/huntd/Makefile:1.3 src/games/hunt/huntd/Makefile:1.4
--- src/games/hunt/huntd/Makefile:1.3	Sat Mar 29 20:35:30 2014
+++ src/games/hunt/huntd/Makefile	Sat Mar 29 21:24:26 2014
@@ -1,8 +1,10 @@
-#	$NetBSD: Makefile,v 1.3 2014/03/29 20:35:30 dholland Exp $
+#	$NetBSD: Makefile,v 1.4 2014/03/29 21:24:26 dholland Exp $
 
 PROG=	huntd
 SRCS=	answer.c draw.c driver.c execute.c expl.c \
 	extern.c makemaze.c pathname.c shots.c terminal.c
 MAN=	huntd.6
 
+CPPFLAGS+=-I${.CURDIR}/../include
+
 .include <bsd.prog.mk>

Index: src/games/hunt/huntd/hunt.h
diff -u src/games/hunt/huntd/hunt.h:1.22 src/games/hunt/huntd/hunt.h:1.23
--- src/games/hunt/huntd/hunt.h:1.22	Sat Mar 29 20:16:09 2014
+++ src/games/hunt/huntd/hunt.h	Sat Mar 29 21:24:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hunt.h,v 1.22 2014/03/29 20:16:09 dholland Exp $	*/
+/*	$NetBSD: hunt.h,v 1.23 2014/03/29 21:24:26 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
@@ -53,225 +53,16 @@
 #include <sys/un.h>
 #endif
 
-#ifdef INTERNET
-#define SOCK_FAMILY	AF_INET
-#else
-#define SOCK_FAMILY	AF_UNIX
-#define AF_UNIX_HACK			/* 4.2 hack; leaves files around */
-#endif
-
-/*
- * Preprocessor define dependencies
- */
-#if defined(VOLCANO) && !defined(OOZE)
-#define OOZE
-#endif
-#if defined(BOOTS) && !defined(FLY)
-#define FLY
-#endif
-#if !defined(REFLECT) && !defined(RANDOM)
-#define RANDOM
-#endif
-
-/* decrement version number for each change in startup protocol */
-#define HUNT_VERSION		-1
-
-#define ADDCH		('a' | 0200)
-#define MOVE		('m' | 0200)
-#define REFRESH		('r' | 0200)
-#define CLRTOEOL	('c' | 0200)
-#define ENDWIN		('e' | 0200)
-#define CLEAR		('C' | 0200)
-#define REDRAW		('R' | 0200)
-#define LAST_PLAYER	('l' | 0200)
-#define BELL		('b' | 0200)
-#define READY		('g' | 0200)
-
-/*
- * Choose MAXPL and MAXMON carefully.  The screen is assumed to be
- * 23 lines high and will only tolerate (MAXPL == 17 && MAXMON == 0)
- * or (MAXPL + MAXMON <= 16).
- */
-#ifdef MONITOR
-#define MAXPL		15
-#define MAXMON		1
-#else
-#define MAXPL		17
-#define MAXMON		0
-#endif
-#define SHORTLEN	2		/* sizeof (network short) */
-#define LONGLEN		4		/* sizeof (network long) */
-#define NAMELEN		20
-#define MSGLEN		SCREEN_WIDTH
-#define DECAY		50.0
-
-#define NASCII		128
-
-#define WIDTH		51
-#define WIDTH2		64	/* Next power of 2 >= WIDTH (for fast access) */
-#define HEIGHT		23
-#define UBOUND		1
-#define DBOUND		(HEIGHT - 1)
-#define LBOUND		1
-#define RBOUND		(WIDTH - 1)
-
-#define SCREEN_HEIGHT	24
-#define SCREEN_WIDTH	80
-#define SCREEN_WIDTH2	128	/* Next power of 2 >= SCREEN_WIDTH */
-
-#define STAT_LABEL_COL	60
-#define STAT_VALUE_COL	74
-#define STAT_NAME_COL	61
-#define STAT_SCAN_COL	(STAT_NAME_COL + 5)
-#define STAT_AMMO_ROW	0
-#define STAT_GUN_ROW	1
-#define STAT_DAM_ROW	2
-#define STAT_KILL_ROW	3
-#define STAT_PLAY_ROW	5
-#ifdef MONITOR
-#define STAT_MON_ROW	(STAT_PLAY_ROW + MAXPL + 1)
-#endif
-#define STAT_NAME_LEN	18
+#include "hunt_common.h"
 
-#define DOOR		'#'
-#define WALL1		'-'
-#define WALL2		'|'
-#define WALL3		'+'
-#ifdef REFLECT
-#define WALL4		'/'
-#define WALL5		'\\'
-#endif
-#define KNIFE		'K'
-#define SHOT		':'
-#define GRENADE		'o'
-#define SATCHEL		'O'
-#define BOMB		'@'
-#define MINE		';'
-#define GMINE		'g'
-#ifdef OOZE
-#define SLIME		'$'
-#endif
-#ifdef VOLCANO
-#define LAVA		'~'
-#endif
-#ifdef DRONE
-#define DSHOT		'?'
-#endif
-#ifdef FLY
-#define FALL		'F'
-#endif
-#ifdef BOOTS
-#define NBOOTS		2
-#define BOOT		'b'
-#define BOOT_PAIR	'B'
-#endif
-#define SPACE		' '
-
-#define ABOVE		'i'
-#define BELOW		'!'
-#define RIGHT		'}'
-#define LEFTS		'{'
-#ifdef FLY
-#define FLYER		'&'
-#define isplayer(c)	(c == LEFTS || c == RIGHT ||\
-			 c == ABOVE || c == BELOW || c == FLYER)
-#else
-#define	isplayer(c)	(c == LEFTS || c == RIGHT ||\
-			 c == ABOVE || c == BELOW)
-#endif
-
-#define NORTH	01
-#define SOUTH	02
-#define EAST	010
-#define WEST	020
-
-#undef CTRL
-#define CTRL(x) ((x) & 037)
-
-#define BULSPD		5		/* bullets movement speed */
-#define ISHOTS		15
-#define NSHOTS		5
-#define MAXNCSHOT	2
-#define MAXDAM		10
-#define MINDAM		5
-#define STABDAM		2
-
-#define BULREQ		1
-#define GRENREQ		9
-#define SATREQ		25
-#define BOMB7REQ	49
-#define BOMB9REQ	81
-#define BOMB11REQ	121
-#define BOMB13REQ	169
-#define BOMB15REQ	225
-#define BOMB17REQ	289
-#define BOMB19REQ	361
-#define BOMB21REQ	441
-#define MAXBOMB		11
-#ifdef DRONE
-#define MINDSHOT	2	/* At least a satchel bomb */
-#endif
 extern int shot_req[];
 extern int shot_type[];
-#ifdef OOZE
-#define SLIME_FACTOR	3
-#define SLIMEREQ	5
-#define SSLIMEREQ	10
-#define SLIME2REQ	15
-#define SLIME3REQ	20
-#define MAXSLIME	4
-#define SLIMESPEED	5
-extern int slime_req[];
-#endif
-#ifdef VOLCANO
-#define LAVASPEED	1
-#endif
-
-#define CLOAKLEN	20
-#define SCANLEN		(Nplayer * 20)
-#define EXPLEN		4
-
-#define Q_QUIT		0
-#define Q_CLOAK		1
-#define Q_FLY		2
-#define Q_SCAN		3
-#define Q_MESSAGE	4
-
-#define C_PLAYER	0
-#define C_MONITOR	1
-#define C_MESSAGE	2
-#define C_SCORES	3
-
-#ifdef MONITOR
-#define C_TESTMSG()	(Query_driver ? C_MESSAGE :\
-			(Show_scores ? C_SCORES :\
-			(Am_monitor ? C_MONITOR :\
-			C_PLAYER)))
-#else
-#define	C_TESTMSG()	(Show_scores ? C_SCORES :\
-			(Query_driver ? C_MESSAGE :\
-			C_PLAYER))
-#endif
-
-#ifdef FLY
-#define _scan_char(pp)	(((pp)->p_scan < 0) ? ' ' : '*')
-#define _cloak_char(pp)	(((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
-#define stat_char(pp)	(((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
-#else
-#define _scan_char(pp)	(((pp)->p_scan < 0) ? ' ' : '*')
-#define stat_char(pp)	(((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
-#endif
 
 typedef struct bullet_def	BULLET;
 typedef struct expl_def		EXPL;
 typedef struct player_def	PLAYER;
 typedef struct ident_def	IDENT;
 typedef struct regen_def	REGEN;
-#ifdef INTERNET
-typedef struct sockaddr_in	SOCKET;
-#else
-typedef struct sockaddr_un	SOCKET;
-#endif
 
 struct ident_def {
 	char i_name[NAMELEN];
@@ -352,12 +143,8 @@ struct regen_def {
  * external variables
  */
 
-extern bool Last_player;
-
 extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
 
-extern const char *Driver;
-
 extern int Nplayer, Socket, Status;
 extern struct pollfd fdset[];
 
@@ -386,37 +173,24 @@ extern PLAYER Boot[NBOOTS];
 #endif
 
 #ifdef MONITOR
-extern bool Am_monitor;
 extern PLAYER Monitor[MAXMON], *End_monitor;
 #endif
 
-#ifdef INTERNET
-extern char *Send_message;
-#endif
-
-extern char map_key[256];
-extern bool no_beep;
-
 /*
  * function types
  */
 
 void add_shot(int, int, int, char, int, PLAYER *, int, char);
 int answer(void);
-void bad_con(void) __dead;
-void bad_ver(void) __dead;
 void ce(PLAYER *);
 void cgoto(PLAYER *, int, int);
 void check(PLAYER *, int, int);
 void checkdam(PLAYER *, PLAYER *, IDENT *, int, char);
 void clearwalls(void);
 void clear_eol(void);
-void clear_the_screen(void);
 void clrscr(PLAYER *);
 BULLET *create_shot(int, int, int, char, int, int, PLAYER *,
 		    IDENT *, int, char);
-void do_connect(char *, char, long);
-void do_message(void);
 void drawmaze(PLAYER *);
 void drawplayer(PLAYER *, bool);
 void execute(PLAYER *);
@@ -432,14 +206,11 @@ void mon_execute(PLAYER *);
 void moveshots(void);
 void open_ctl(void);
 bool opposite(int, char);
-void otto(int, int, char);
 void outch(PLAYER *, int);
 void outstr(PLAYER *, const char *, int);
 PLAYER *play_at(int, int);
-void playit(void);
 void put_ch(char);
 void put_str(char *);
-int quit(int);
 int rand_dir(void);
 int rand_num(int);
 void rollexpl(void);
@@ -447,5 +218,3 @@ void sendcom(PLAYER *, int, ...);
 void showexpl(int, int, char);
 void showstat(PLAYER *);
 void cleanup(int) __dead;
-void intr(int);
-void tstp(int);

Index: src/games/hunt/huntd/pathname.c
diff -u src/games/hunt/huntd/pathname.c:1.5 src/games/hunt/huntd/pathname.c:1.6
--- src/games/hunt/huntd/pathname.c:1.5	Sat Jul  4 04:29:55 2009
+++ src/games/hunt/huntd/pathname.c	Sat Mar 29 21:24:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pathname.c,v 1.5 2009/07/04 04:29:55 dholland Exp $	*/
+/*	$NetBSD: pathname.c,v 1.6 2014/03/29 21:24:26 dholland Exp $	*/
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: pathname.c,v 1.5 2009/07/04 04:29:55 dholland Exp $");
+__RCSID("$NetBSD: pathname.c,v 1.6 2014/03/29 21:24:26 dholland Exp $");
 #endif /* not lint */
 
 /*
@@ -43,11 +43,12 @@ __RCSID("$NetBSD: pathname.c,v 1.5 2009/
 
 #include <sys/types.h>
 
+#include "hunt_common.h"
+
 #ifdef DEBUG
 
-char *Driver = "/home/socr/a/conrad/games/src/hunt/huntd.dbg";
 #ifdef INTERNET
-u_short Test_port = ('h' << 8) | 't';
+u_short Test_port = TEST_PORT;
 #else
 char *Sock_name = "/tmp/hunt";
 char *Stat_name = "/tmp/hunt.stats";
@@ -55,9 +56,8 @@ char *Stat_name = "/tmp/hunt.stats";
 
 #else
 
-const char *Driver = HUNTD;
 #ifdef INTERNET
-u_short Test_port = ('h' << 8) | 't';
+u_short Test_port = TEST_PORT;
 #else
 char *Sock_name = "/tmp/hunt";
 char *Stat_name = "/tmp/hunt.stats";

Added files:

Index: src/games/hunt/hunt/hunt_private.h
diff -u /dev/null src/games/hunt/hunt/hunt_private.h:1.1
--- /dev/null	Sat Mar 29 21:24:27 2014
+++ src/games/hunt/hunt/hunt_private.h	Sat Mar 29 21:24:26 2014
@@ -0,0 +1,97 @@
+/*	$NetBSD: hunt_private.h,v 1.1 2014/03/29 21:24:26 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1983-2003, Regents of the University of California.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are 
+ * met:
+ * 
+ * + Redistributions of source code must retain the above copyright 
+ *   notice, this list of conditions and the following disclaimer.
+ * + Redistributions in binary form must reproduce the above copyright 
+ *   notice, this list of conditions and the following disclaimer in the 
+ *   documentation and/or other materials provided with the distribution.
+ * + Neither the name of the University of California, San Francisco nor 
+ *   the names of its contributors may be used to endorse or promote 
+ *   products derived from this software without specific prior written 
+ *   permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdbool.h>
+#include <stdio.h> /* for BUFSIZ */
+
+#ifdef INTERNET
+#include <netinet/in.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+#else
+#include <sys/un.h>
+#endif
+
+#ifdef MONITOR
+#define C_TESTMSG()	(Query_driver ? C_MESSAGE :\
+			(Show_scores ? C_SCORES :\
+			(Am_monitor ? C_MONITOR :\
+			C_PLAYER)))
+#else
+#define	C_TESTMSG()	(Show_scores ? C_SCORES :\
+			(Query_driver ? C_MESSAGE :\
+			C_PLAYER))
+#endif
+
+/*
+ * external variables
+ */
+
+extern bool Last_player;
+
+extern const char *Driver;
+
+extern char Buf[BUFSIZ];
+extern int Socket;
+
+#ifdef INTERNET
+extern u_short Test_port;
+#else
+extern char *Sock_name;
+#endif
+
+#ifdef INTERNET
+extern char *Send_message;
+#endif
+
+#ifdef MONITOR
+extern bool Am_monitor;
+#endif
+
+extern char map_key[256];
+extern bool no_beep;
+
+/*
+ * function types
+ */
+
+void bad_con(void) __dead;
+void bad_ver(void) __dead;
+void clear_the_screen(void);
+void do_connect(char *, char, long);
+void do_message(void);
+void otto(int, int, char);
+void playit(void);
+int quit(int);
+void intr(int);

Index: src/games/hunt/include/hunt_common.h
diff -u /dev/null src/games/hunt/include/hunt_common.h:1.1
--- /dev/null	Sat Mar 29 21:24:27 2014
+++ src/games/hunt/include/hunt_common.h	Sat Mar 29 21:24:27 2014
@@ -0,0 +1,238 @@
+/*	$NetBSD: hunt_common.h,v 1.1 2014/03/29 21:24:27 dholland Exp $	*/
+
+/*
+ * Copyright (c) 1983-2003, Regents of the University of California.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are 
+ * met:
+ * 
+ * + Redistributions of source code must retain the above copyright 
+ *   notice, this list of conditions and the following disclaimer.
+ * + Redistributions in binary form must reproduce the above copyright 
+ *   notice, this list of conditions and the following disclaimer in the 
+ *   documentation and/or other materials provided with the distribution.
+ * + Neither the name of the University of California, San Francisco nor 
+ *   the names of its contributors may be used to endorse or promote 
+ *   products derived from this software without specific prior written 
+ *   permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifdef INTERNET
+#define SOCK_FAMILY	AF_INET
+#define TEST_PORT	(('h' << 8) | 't')
+#else
+#define SOCK_FAMILY	AF_UNIX
+#define AF_UNIX_HACK			/* 4.2 hack; leaves files around */
+#endif
+
+/*
+ * Preprocessor define dependencies
+ */
+#if defined(VOLCANO) && !defined(OOZE)
+#define OOZE
+#endif
+#if defined(BOOTS) && !defined(FLY)
+#define FLY
+#endif
+#if !defined(REFLECT) && !defined(RANDOM)
+#define RANDOM
+#endif
+
+/* decrement version number for each change in startup protocol */
+#define HUNT_VERSION		-1
+
+#define ADDCH		('a' | 0200)
+#define MOVE		('m' | 0200)
+#define REFRESH		('r' | 0200)
+#define CLRTOEOL	('c' | 0200)
+#define ENDWIN		('e' | 0200)
+#define CLEAR		('C' | 0200)
+#define REDRAW		('R' | 0200)
+#define LAST_PLAYER	('l' | 0200)
+#define BELL		('b' | 0200)
+#define READY		('g' | 0200)
+
+/*
+ * Choose MAXPL and MAXMON carefully.  The screen is assumed to be
+ * 23 lines high and will only tolerate (MAXPL == 17 && MAXMON == 0)
+ * or (MAXPL + MAXMON <= 16).
+ */
+#ifdef MONITOR
+#define MAXPL		15
+#define MAXMON		1
+#else
+#define MAXPL		17
+#define MAXMON		0
+#endif
+#define SHORTLEN	2		/* sizeof (network short) */
+#define LONGLEN		4		/* sizeof (network long) */
+#define NAMELEN		20
+#define MSGLEN		SCREEN_WIDTH
+#define DECAY		50.0
+
+#define NASCII		128
+
+#define WIDTH		51
+#define WIDTH2		64	/* Next power of 2 >= WIDTH (for fast access) */
+#define HEIGHT		23
+#define UBOUND		1
+#define DBOUND		(HEIGHT - 1)
+#define LBOUND		1
+#define RBOUND		(WIDTH - 1)
+
+#define SCREEN_HEIGHT	24
+#define SCREEN_WIDTH	80
+#define SCREEN_WIDTH2	128	/* Next power of 2 >= SCREEN_WIDTH */
+
+#define STAT_LABEL_COL	60
+#define STAT_VALUE_COL	74
+#define STAT_NAME_COL	61
+#define STAT_SCAN_COL	(STAT_NAME_COL + 5)
+#define STAT_AMMO_ROW	0
+#define STAT_GUN_ROW	1
+#define STAT_DAM_ROW	2
+#define STAT_KILL_ROW	3
+#define STAT_PLAY_ROW	5
+#ifdef MONITOR
+#define STAT_MON_ROW	(STAT_PLAY_ROW + MAXPL + 1)
+#endif
+#define STAT_NAME_LEN	18
+
+#define DOOR		'#'
+#define WALL1		'-'
+#define WALL2		'|'
+#define WALL3		'+'
+#ifdef REFLECT
+#define WALL4		'/'
+#define WALL5		'\\'
+#endif
+#define KNIFE		'K'
+#define SHOT		':'
+#define GRENADE		'o'
+#define SATCHEL		'O'
+#define BOMB		'@'
+#define MINE		';'
+#define GMINE		'g'
+#ifdef OOZE
+#define SLIME		'$'
+#endif
+#ifdef VOLCANO
+#define LAVA		'~'
+#endif
+#ifdef DRONE
+#define DSHOT		'?'
+#endif
+#ifdef FLY
+#define FALL		'F'
+#endif
+#ifdef BOOTS
+#define NBOOTS		2
+#define BOOT		'b'
+#define BOOT_PAIR	'B'
+#endif
+#define SPACE		' '
+
+#define ABOVE		'i'
+#define BELOW		'!'
+#define RIGHT		'}'
+#define LEFTS		'{'
+#ifdef FLY
+#define FLYER		'&'
+#define isplayer(c)	(c == LEFTS || c == RIGHT ||\
+			 c == ABOVE || c == BELOW || c == FLYER)
+#else
+#define	isplayer(c)	(c == LEFTS || c == RIGHT ||\
+			 c == ABOVE || c == BELOW)
+#endif
+
+#define NORTH	01
+#define SOUTH	02
+#define EAST	010
+#define WEST	020
+
+#undef CTRL
+#define CTRL(x) ((x) & 037)
+
+#define BULSPD		5		/* bullets movement speed */
+#define ISHOTS		15
+#define NSHOTS		5
+#define MAXNCSHOT	2
+#define MAXDAM		10
+#define MINDAM		5
+#define STABDAM		2
+
+#define BULREQ		1
+#define GRENREQ		9
+#define SATREQ		25
+#define BOMB7REQ	49
+#define BOMB9REQ	81
+#define BOMB11REQ	121
+#define BOMB13REQ	169
+#define BOMB15REQ	225
+#define BOMB17REQ	289
+#define BOMB19REQ	361
+#define BOMB21REQ	441
+#define MAXBOMB		11
+#ifdef DRONE
+#define MINDSHOT	2	/* At least a satchel bomb */
+#endif
+
+#ifdef OOZE
+#define SLIME_FACTOR	3
+#define SLIMEREQ	5
+#define SSLIMEREQ	10
+#define SLIME2REQ	15
+#define SLIME3REQ	20
+#define MAXSLIME	4
+#define SLIMESPEED	5
+extern int slime_req[];
+#endif
+#ifdef VOLCANO
+#define LAVASPEED	1
+#endif
+
+#define CLOAKLEN	20
+#define SCANLEN		(Nplayer * 20)
+#define EXPLEN		4
+
+#define Q_QUIT		0
+#define Q_CLOAK		1
+#define Q_FLY		2
+#define Q_SCAN		3
+#define Q_MESSAGE	4
+
+#define C_PLAYER	0
+#define C_MONITOR	1
+#define C_MESSAGE	2
+#define C_SCORES	3
+
+#ifdef FLY
+#define _scan_char(pp)	(((pp)->p_scan < 0) ? ' ' : '*')
+#define _cloak_char(pp)	(((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
+#define stat_char(pp)	(((pp)->p_flying < 0) ? _cloak_char(pp) : FLYER)
+#else
+#define _scan_char(pp)	(((pp)->p_scan < 0) ? ' ' : '*')
+#define stat_char(pp)	(((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
+#endif
+
+#ifdef INTERNET
+typedef struct sockaddr_in	SOCKET;
+#else
+typedef struct sockaddr_un	SOCKET;
+#endif
+

Reply via email to