mirror of
https://github.com/vattam/BSDGames.git
synced 2025-12-21 11:24:49 +00:00
copy in from cvs; cvs2svn fucked up big time
git-svn-id: file:///srv/svn/joey/trunk/src/packages/bsdgames@9775 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile.inc,v 1.3 1997/10/22 05:05:21 lukem Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.6 2002/09/20 21:00:01 mycroft Exp $
|
||||
#
|
||||
# Hunt
|
||||
# Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
|
||||
@@ -39,7 +39,7 @@ GAME_PARAM= -DRANDOM -DREFLECT -DMONITOR -DOOZE -DFLY -DVOLCANO -DBOOTS \
|
||||
# HPUX do special HPUX only hacks
|
||||
#
|
||||
DEFS_BSD43= -DINTERNET -DLOG -DBSD_RELEASE=43 -DSIGNAL_TYPE=int
|
||||
DEFS_BSD44= -DINTERNET -DLOG -DBSD_RELEASE=44 -DSIGNAL_TYPE=void
|
||||
DEFS_BSD44= -DINTERNET -DLOG -DBSD_RELEASE=44 -DSIGNAL_TYPE=void -DUSE_CURSES
|
||||
DEFS_SUN= -DINTERNET -DLOG -DBSD_RELEASE=42 -DBROADCAST -DSIGNAL_TYPE=int
|
||||
DEFS_SUN4_0= -DINTERNET -DLOG -DSYSLOG_43 -DBROADCAST -DSIGNAL_TYPE=void
|
||||
DEFS_ULTRIX= -DINTERNET -DLOG -DBSD_RELEASE=42 -DSIGNAL_TYPE=void
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for hunt
|
||||
#
|
||||
# Copyright (c) 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. 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.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
|
||||
hunt_all:
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ sockets rather than Unix domain sockets, but is almost completely untested.
|
||||
The original README.linux is below.
|
||||
|
||||
Joseph S. Myers
|
||||
jsm28@cam.ac.uk
|
||||
jsm@polyomino.org.uk
|
||||
|
||||
8/25/93
|
||||
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for hunt/huntd
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. 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.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 hunt/Makeconfig
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: answer.c,v 1.3 1997/10/10 16:32:50 lukem Exp $ */
|
||||
/* $NetBSD: answer.c,v 1.5 2003/02/26 07:14:45 jdc Exp $ */
|
||||
/*
|
||||
* Hunt
|
||||
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: answer.c,v 1.3 1997/10/10 16:32:50 lukem Exp $");
|
||||
__RCSID("$NetBSD: answer.c,v 1.5 2003/02/26 07:14:45 jdc Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include <ctype.h>
|
||||
@@ -33,11 +33,12 @@ answer()
|
||||
static int enter_status;
|
||||
static int socklen;
|
||||
static u_long machine;
|
||||
static u_long uid;
|
||||
static u_int32_t uid;
|
||||
static SOCKET sockstruct;
|
||||
char *cp1, *cp2;
|
||||
int flags;
|
||||
long version;
|
||||
u_int32_t version;
|
||||
int i;
|
||||
|
||||
# ifdef INTERNET
|
||||
socklen = sizeof sockstruct;
|
||||
@@ -124,9 +125,10 @@ answer()
|
||||
# endif
|
||||
# ifdef MONITOR
|
||||
if (mode == C_MONITOR)
|
||||
if (End_monitor < &Monitor[MAXMON])
|
||||
if (End_monitor < &Monitor[MAXMON]) {
|
||||
pp = End_monitor++;
|
||||
else {
|
||||
i = pp - Monitor + MAXPL + 3;
|
||||
} else {
|
||||
socklen = 0;
|
||||
(void) write(newsock, (char *) &socklen,
|
||||
sizeof socklen);
|
||||
@@ -135,9 +137,10 @@ answer()
|
||||
}
|
||||
else
|
||||
# endif
|
||||
if (End_player < &Player[MAXPL])
|
||||
if (End_player < &Player[MAXPL]) {
|
||||
pp = End_player++;
|
||||
else {
|
||||
i = pp - Player + 3;
|
||||
} else {
|
||||
socklen = 0;
|
||||
(void) write(newsock, (char *) &socklen,
|
||||
sizeof socklen);
|
||||
@@ -153,9 +156,8 @@ answer()
|
||||
pp->p_output = fdopen(newsock, "w");
|
||||
pp->p_death[0] = '\0';
|
||||
pp->p_fd = newsock;
|
||||
FD_SET(pp->p_fd, &Fds_mask);
|
||||
if (pp->p_fd >= Num_fds)
|
||||
Num_fds = pp->p_fd + 1;
|
||||
fdset[i].fd = newsock;
|
||||
fdset[i].events = POLLIN;
|
||||
|
||||
pp->p_y = 0;
|
||||
pp->p_x = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bsd.h,v 1.2 1998/01/09 08:03:40 perry Exp $ */
|
||||
/* $NetBSD: bsd.h,v 1.3 2002/09/20 21:00:02 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Hunt
|
||||
@@ -9,13 +9,7 @@
|
||||
# if defined(BSD_RELEASE) && BSD_RELEASE >= 43
|
||||
# define BROADCAST
|
||||
# define SYSLOG_43
|
||||
#ifdef __linux__
|
||||
#define TALK_42 /* Kludge around broken <protocols/talkd.h> */
|
||||
#else
|
||||
# define TALK_43
|
||||
#endif
|
||||
# endif
|
||||
# if defined(BSD_RELEASE) && BSD_RELEASE == 42
|
||||
# define SYSLOG_42
|
||||
# define TALK_42
|
||||
# endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ctl_transact.c,v 1.3 1997/10/20 00:37:16 lukem Exp $ */
|
||||
/* $NetBSD: ctl_transact.c,v 1.5 2002/09/20 20:54:16 mycroft Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
* All rights reserved. The Berkeley software License Agreement
|
||||
@@ -14,7 +14,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ctl_transact.c 5.2 (Berkeley) 3/13/86";
|
||||
#else
|
||||
__RCSID("$NetBSD: ctl_transact.c,v 1.3 1997/10/20 00:37:16 lukem Exp $");
|
||||
__RCSID("$NetBSD: ctl_transact.c,v 1.5 2002/09/20 20:54:16 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -28,7 +28,7 @@ __RCSID("$NetBSD: ctl_transact.c,v 1.3 1997/10/20 00:37:16 lukem Exp $");
|
||||
|
||||
/*
|
||||
* SOCKDGRAM is unreliable, so we must repeat messages if we have
|
||||
* not recieved an acknowledgement within a reasonable amount
|
||||
* not received an acknowledgement within a reasonable amount
|
||||
* of time
|
||||
*/
|
||||
void
|
||||
@@ -38,24 +38,21 @@ ctl_transact(target, msg, type, rp)
|
||||
int type;
|
||||
CTL_RESPONSE *rp;
|
||||
{
|
||||
fd_set read_mask, ctl_mask;
|
||||
struct pollfd set[1];
|
||||
int nready, cc, retries;
|
||||
struct timeval wait;
|
||||
|
||||
nready = 0;
|
||||
msg.type = type;
|
||||
daemon_addr.sin_addr = target;
|
||||
daemon_addr.sin_port = daemon_port;
|
||||
FD_ZERO(&ctl_mask);
|
||||
FD_SET(ctl_sockt, &ctl_mask);
|
||||
set[0].fd = ctl_sockt;
|
||||
set[0].events = POLLIN;
|
||||
|
||||
/*
|
||||
* Keep sending the message until a response of
|
||||
* the proper type is obtained.
|
||||
*/
|
||||
do {
|
||||
wait.tv_sec = CTL_WAIT;
|
||||
wait.tv_usec = 0;
|
||||
/* resend message until a response is obtained */
|
||||
for (retries = MAX_RETRY; retries > 0; retries -= 1) {
|
||||
cc = sendto(ctl_sockt, (char *)&msg, sizeof (msg), 0,
|
||||
@@ -65,8 +62,7 @@ ctl_transact(target, msg, type, rp)
|
||||
continue;
|
||||
p_error("Error on write to talk daemon");
|
||||
}
|
||||
read_mask = ctl_mask;
|
||||
nready = select(32, &read_mask, 0, 0, &wait);
|
||||
nready = poll(set, 1, CTL_WAIT * 1000);
|
||||
if (nready < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
@@ -89,10 +85,8 @@ ctl_transact(target, msg, type, rp)
|
||||
continue;
|
||||
p_error("Error on read from talk daemon");
|
||||
}
|
||||
read_mask = ctl_mask;
|
||||
/* an immediate poll */
|
||||
timerclear(&wait);
|
||||
nready = select(32, &read_mask, 0, 0, &wait);
|
||||
nready = poll(set, 1, 0);
|
||||
} while (nready > 0 && (
|
||||
#ifdef TALK_43
|
||||
rp->vers != TALK_VERSION ||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: driver.c,v 1.5 1997/10/20 00:37:16 lukem Exp $ */
|
||||
/* $NetBSD: driver.c,v 1.8 2002/09/20 20:54:16 mycroft Exp $ */
|
||||
/*
|
||||
* Hunt
|
||||
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: driver.c,v 1.5 1997/10/20 00:37:16 lukem Exp $");
|
||||
__RCSID("$NetBSD: driver.c,v 1.8 2002/09/20 20:54:16 mycroft Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include <sys/ioctl.h>
|
||||
@@ -17,6 +17,7 @@ __RCSID("$NetBSD: driver.c,v 1.5 1997/10/20 00:37:16 lukem Exp $");
|
||||
# include <errno.h>
|
||||
# include <signal.h>
|
||||
# include <stdlib.h>
|
||||
# include <time.h>
|
||||
# include <unistd.h>
|
||||
# include "hunt.h"
|
||||
|
||||
@@ -44,12 +45,12 @@ u_short stat_port; /* port # of statistics tcp socket */
|
||||
# endif
|
||||
|
||||
static void clear_scores __P((void));
|
||||
static int havechar __P((PLAYER *));
|
||||
static int havechar __P((PLAYER *, int));
|
||||
static void init __P((void));
|
||||
int main __P((int, char *[], char *[]));
|
||||
static void makeboots __P((void));
|
||||
static void send_stats __P((void));
|
||||
static void zap __P((PLAYER *, FLAG));
|
||||
static void zap __P((PLAYER *, FLAG, int));
|
||||
|
||||
|
||||
/*
|
||||
@@ -62,20 +63,16 @@ main(ac, av, ep)
|
||||
char **av, **ep;
|
||||
{
|
||||
PLAYER *pp;
|
||||
int had_char;
|
||||
# ifdef INTERNET
|
||||
u_short msg;
|
||||
short port_num, reply;
|
||||
int namelen;
|
||||
SOCKET test;
|
||||
# endif
|
||||
static fd_set read_fds;
|
||||
static FLAG first = TRUE;
|
||||
static FLAG server = FALSE;
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
int c;
|
||||
static struct timeval linger = { 90, 0 };
|
||||
int c, i;
|
||||
const int linger = 90 * 1000;
|
||||
|
||||
First_arg = av[0];
|
||||
if (ep == NULL || *ep == NULL)
|
||||
@@ -109,9 +106,8 @@ erred:
|
||||
|
||||
again:
|
||||
do {
|
||||
read_fds = Fds_mask;
|
||||
errno = 0;
|
||||
while (select(Num_fds, &read_fds, NULL, NULL, NULL) < 0)
|
||||
while (poll(fdset, 3+MAXPL+MAXMON, INFTIM) < 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
# ifdef LOG
|
||||
@@ -121,9 +117,8 @@ again:
|
||||
# endif
|
||||
errno = 0;
|
||||
}
|
||||
Have_inp = read_fds;
|
||||
# ifdef INTERNET
|
||||
if (FD_ISSET(Test_socket, &read_fds)) {
|
||||
if (fdset[2].revents & POLLIN) {
|
||||
namelen = DAEMON_SIZE;
|
||||
port_num = htons(sock_port);
|
||||
(void) recvfrom(Test_socket, (char *) &msg, sizeof msg,
|
||||
@@ -155,39 +150,34 @@ again:
|
||||
}
|
||||
}
|
||||
# endif
|
||||
for (;;) {
|
||||
had_char = FALSE;
|
||||
for (pp = Player; pp < End_player; pp++)
|
||||
if (havechar(pp)) {
|
||||
{
|
||||
for (pp = Player, i = 0; pp < End_player; pp++, i++)
|
||||
if (havechar(pp, i + 3)) {
|
||||
execute(pp);
|
||||
pp->p_nexec++;
|
||||
had_char++;
|
||||
}
|
||||
# ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++)
|
||||
if (havechar(pp)) {
|
||||
for (pp = Monitor, i = 0; pp < End_monitor; pp++, i++)
|
||||
if (havechar(pp, i + MAXPL + 3)) {
|
||||
mon_execute(pp);
|
||||
pp->p_nexec++;
|
||||
had_char++;
|
||||
}
|
||||
# endif
|
||||
if (!had_char)
|
||||
break;
|
||||
moveshots();
|
||||
for (pp = Player; pp < End_player; )
|
||||
for (pp = Player, i = 0; pp < End_player; )
|
||||
if (pp->p_death[0] != '\0')
|
||||
zap(pp, TRUE);
|
||||
zap(pp, TRUE, i + 3);
|
||||
else
|
||||
pp++;
|
||||
pp++, i++;
|
||||
# ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; )
|
||||
for (pp = Monitor, i = 0; pp < End_monitor; )
|
||||
if (pp->p_death[0] != '\0')
|
||||
zap(pp, FALSE);
|
||||
zap(pp, FALSE, i + MAXPL + 3);
|
||||
else
|
||||
pp++;
|
||||
pp++, i++;
|
||||
# endif
|
||||
}
|
||||
if (FD_ISSET(Socket, &read_fds))
|
||||
if (fdset[0].revents & POLLIN)
|
||||
if (answer()) {
|
||||
# ifdef INTERNET
|
||||
if (first && standard_port)
|
||||
@@ -195,17 +185,17 @@ again:
|
||||
# endif
|
||||
first = FALSE;
|
||||
}
|
||||
if (FD_ISSET(Status, &read_fds))
|
||||
if (fdset[1].revents & POLLIN)
|
||||
send_stats();
|
||||
for (pp = Player; pp < End_player; pp++) {
|
||||
if (FD_ISSET(pp->p_fd, &read_fds))
|
||||
for (pp = Player, i = 0; pp < End_player; pp++, i++) {
|
||||
if (fdset[i + 3].revents & POLLIN)
|
||||
sendcom(pp, READY, pp->p_nexec);
|
||||
pp->p_nexec = 0;
|
||||
(void) fflush(pp->p_output);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; pp++) {
|
||||
if (FD_ISSET(pp->p_fd, &read_fds))
|
||||
for (pp = Monitor, i = 0; pp < End_monitor; pp++, i++) {
|
||||
if (fdset[i + MAXPL + 3].revents & POLLIN)
|
||||
sendcom(pp, READY, pp->p_nexec);
|
||||
pp->p_nexec = 0;
|
||||
(void) fflush(pp->p_output);
|
||||
@@ -213,8 +203,7 @@ again:
|
||||
# endif
|
||||
} while (Nplayer > 0);
|
||||
|
||||
read_fds = Fds_mask;
|
||||
if (select(Num_fds, &read_fds, NULL, NULL, &linger) > 0) {
|
||||
if (poll(fdset, 3+MAXPL+MAXMON, linger) > 0) {
|
||||
goto again;
|
||||
}
|
||||
if (server) {
|
||||
@@ -229,8 +218,8 @@ again:
|
||||
}
|
||||
|
||||
# ifdef MONITOR
|
||||
for (pp = Monitor; pp < End_monitor; )
|
||||
zap(pp, FALSE);
|
||||
for (pp = Monitor, i = 0; pp < End_monitor; i++)
|
||||
zap(pp, FALSE, i + MAXPL + 3);
|
||||
# endif
|
||||
cleanup(0);
|
||||
/* NOTREACHED */
|
||||
@@ -252,6 +241,14 @@ init()
|
||||
# endif
|
||||
|
||||
# ifndef DEBUG
|
||||
switch (fork()) {
|
||||
case -1:
|
||||
err(1, "fork");
|
||||
case 0:
|
||||
break; /* child */
|
||||
default:
|
||||
exit(0); /* parent */
|
||||
}
|
||||
if (setsid() == -1)
|
||||
err(1, "setsid");
|
||||
(void) signal(SIGHUP, SIG_IGN);
|
||||
@@ -266,10 +263,10 @@ init()
|
||||
|
||||
# ifdef LOG
|
||||
# ifdef SYSLOG_43
|
||||
openlog("HUNT", LOG_PID, LOG_DAEMON);
|
||||
openlog("huntd", LOG_PID, LOG_DAEMON);
|
||||
# endif
|
||||
# ifdef SYSLOG_42
|
||||
openlog("HUNT", LOG_PID);
|
||||
openlog("huntd", LOG_PID);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
@@ -367,10 +364,10 @@ init()
|
||||
/*
|
||||
* Initialize minimal select mask
|
||||
*/
|
||||
FD_ZERO(&Fds_mask);
|
||||
FD_SET(Socket, &Fds_mask);
|
||||
FD_SET(Status, &Fds_mask);
|
||||
Num_fds = ((Socket > Status) ? Socket : Status) + 1;
|
||||
fdset[0].fd = Socket;
|
||||
fdset[0].events = POLLIN;
|
||||
fdset[1].fd = Status;
|
||||
fdset[1].events = POLLIN;
|
||||
|
||||
# ifdef INTERNET
|
||||
len = sizeof (SOCKET);
|
||||
@@ -399,9 +396,10 @@ init()
|
||||
(void) listen(Test_socket, 5);
|
||||
}
|
||||
|
||||
FD_SET(Test_socket, &Fds_mask);
|
||||
if (Test_socket + 1 > Num_fds)
|
||||
Num_fds = Test_socket + 1;
|
||||
fdset[2].fd = Test_socket;
|
||||
fdset[2].events = POLLIN;
|
||||
# else
|
||||
fdset[2].fd = -1;
|
||||
# endif
|
||||
|
||||
Seed = getpid() + time((time_t *) NULL);
|
||||
@@ -584,11 +582,12 @@ checkdam(ouch, gotcha, credit, amt, shot_type)
|
||||
* Kill off a player and take him out of the game.
|
||||
*/
|
||||
static void
|
||||
zap(pp, was_player)
|
||||
zap(pp, was_player, i)
|
||||
PLAYER *pp;
|
||||
FLAG was_player;
|
||||
int i;
|
||||
{
|
||||
int i, len;
|
||||
int n, len;
|
||||
BULLET *bp;
|
||||
PLAYER *np;
|
||||
int x, y;
|
||||
@@ -605,8 +604,8 @@ zap(pp, was_player)
|
||||
x = (WIDTH - len) / 2;
|
||||
cgoto(pp, HEIGHT / 2, x);
|
||||
outstr(pp, pp->p_death, len);
|
||||
for (i = 1; i < len; i++)
|
||||
pp->p_death[i] = '-';
|
||||
for (n = 1; n < len; n++)
|
||||
pp->p_death[n] = '-';
|
||||
pp->p_death[0] = '+';
|
||||
pp->p_death[len - 1] = '+';
|
||||
cgoto(pp, HEIGHT / 2 - 1, x);
|
||||
@@ -627,22 +626,22 @@ zap(pp, was_player)
|
||||
bp->b_over = SPACE;
|
||||
}
|
||||
|
||||
i = rand_num(pp->p_ammo);
|
||||
n = rand_num(pp->p_ammo);
|
||||
x = rand_num(pp->p_ammo);
|
||||
if (x > i)
|
||||
i = x;
|
||||
if (x > n)
|
||||
n = x;
|
||||
if (pp->p_ammo == 0)
|
||||
x = 0;
|
||||
else if (i == pp->p_ammo - 1) {
|
||||
else if (n == pp->p_ammo - 1) {
|
||||
x = pp->p_ammo;
|
||||
len = SLIME;
|
||||
}
|
||||
else {
|
||||
for (x = MAXBOMB - 1; x > 0; x--)
|
||||
if (i >= shot_req[x])
|
||||
if (n >= shot_req[x])
|
||||
break;
|
||||
for (y = MAXSLIME - 1; y > 0; y--)
|
||||
if (i >= slime_req[y])
|
||||
if (n >= slime_req[y])
|
||||
break;
|
||||
if (y >= 0 && slime_req[y] > shot_req[x]) {
|
||||
x = slime_req[y];
|
||||
@@ -730,31 +729,34 @@ zap(pp, was_player)
|
||||
End_player--;
|
||||
if (pp != End_player) {
|
||||
memcpy(pp, End_player, sizeof (PLAYER));
|
||||
fdset[i] = fdset[End_player - Player + 3];
|
||||
fdset[End_player - Player + 3].fd = -1;
|
||||
(void) sprintf(Buf, "%5.2f%c%-10.10s %c",
|
||||
pp->p_ident->i_score, stat_char(pp),
|
||||
pp->p_ident->i_name, pp->p_ident->i_team);
|
||||
i = STAT_PLAY_ROW + 1 + (pp - Player);
|
||||
n = STAT_PLAY_ROW + 1 + (pp - Player);
|
||||
for (np = Player; np < End_player; np++) {
|
||||
cgoto(np, i, STAT_NAME_COL);
|
||||
cgoto(np, n, STAT_NAME_COL);
|
||||
outstr(np, Buf, STAT_NAME_LEN);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
for (np = Monitor; np < End_monitor; np++) {
|
||||
cgoto(np, i, STAT_NAME_COL);
|
||||
cgoto(np, n, STAT_NAME_COL);
|
||||
outstr(np, Buf, STAT_NAME_LEN);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
} else
|
||||
fdset[i].fd = -1;
|
||||
|
||||
/* Erase the last player */
|
||||
i = STAT_PLAY_ROW + 1 + Nplayer;
|
||||
n = STAT_PLAY_ROW + 1 + Nplayer;
|
||||
for (np = Player; np < End_player; np++) {
|
||||
cgoto(np, i, STAT_NAME_COL);
|
||||
cgoto(np, n, STAT_NAME_COL);
|
||||
ce(np);
|
||||
}
|
||||
# ifdef MONITOR
|
||||
for (np = Monitor; np < End_monitor; np++) {
|
||||
cgoto(np, i, STAT_NAME_COL);
|
||||
cgoto(np, n, STAT_NAME_COL);
|
||||
ce(np);
|
||||
}
|
||||
}
|
||||
@@ -766,50 +768,34 @@ zap(pp, was_player)
|
||||
End_monitor--;
|
||||
if (pp != End_monitor) {
|
||||
memcpy(pp, End_monitor, sizeof (PLAYER));
|
||||
fdset[i] = fdset[End_monitor - Monitor + MAXPL + 3];
|
||||
fdset[End_monitor - Monitor + MAXPL + 3].fd = -1;
|
||||
(void) sprintf(Buf, "%5.5s %-10.10s %c", " ",
|
||||
pp->p_ident->i_name, pp->p_ident->i_team);
|
||||
i = STAT_MON_ROW + 1 + (pp - Player);
|
||||
n = STAT_MON_ROW + 1 + (pp - Player);
|
||||
for (np = Player; np < End_player; np++) {
|
||||
cgoto(np, i, STAT_NAME_COL);
|
||||
cgoto(np, n, STAT_NAME_COL);
|
||||
outstr(np, Buf, STAT_NAME_LEN);
|
||||
}
|
||||
for (np = Monitor; np < End_monitor; np++) {
|
||||
cgoto(np, i, STAT_NAME_COL);
|
||||
cgoto(np, n, STAT_NAME_COL);
|
||||
outstr(np, Buf, STAT_NAME_LEN);
|
||||
}
|
||||
}
|
||||
} else
|
||||
fdset[i].fd = -1;
|
||||
|
||||
/* Erase the last monitor */
|
||||
i = STAT_MON_ROW + 1 + (End_monitor - Monitor);
|
||||
n = STAT_MON_ROW + 1 + (End_monitor - Monitor);
|
||||
for (np = Player; np < End_player; np++) {
|
||||
cgoto(np, i, STAT_NAME_COL);
|
||||
cgoto(np, n, STAT_NAME_COL);
|
||||
ce(np);
|
||||
}
|
||||
for (np = Monitor; np < End_monitor; np++) {
|
||||
cgoto(np, i, STAT_NAME_COL);
|
||||
cgoto(np, n, STAT_NAME_COL);
|
||||
ce(np);
|
||||
}
|
||||
|
||||
}
|
||||
# endif
|
||||
|
||||
FD_CLR(savefd, &Fds_mask);
|
||||
if (Num_fds == savefd + 1) {
|
||||
Num_fds = Socket;
|
||||
# ifdef INTERNET
|
||||
if (Test_socket > Socket)
|
||||
Num_fds = Test_socket;
|
||||
# endif
|
||||
for (np = Player; np < End_player; np++)
|
||||
if (np->p_fd > Num_fds)
|
||||
Num_fds = np->p_fd;
|
||||
# ifdef MONITOR
|
||||
for (np = Monitor; np < End_monitor; np++)
|
||||
if (np->p_fd > Num_fds)
|
||||
Num_fds = np->p_fd;
|
||||
# endif
|
||||
Num_fds++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -830,15 +816,15 @@ rand_num(range)
|
||||
* FALSE.
|
||||
*/
|
||||
static int
|
||||
havechar(pp)
|
||||
havechar(pp, i)
|
||||
PLAYER *pp;
|
||||
int i;
|
||||
{
|
||||
|
||||
if (pp->p_ncount < pp->p_nchar)
|
||||
return TRUE;
|
||||
if (!FD_ISSET(pp->p_fd, &Have_inp))
|
||||
if (!(fdset[i].revents & POLLIN))
|
||||
return FALSE;
|
||||
FD_CLR(pp->p_fd, &Have_inp);
|
||||
check_again:
|
||||
errno = 0;
|
||||
if ((pp->p_nchar = read(pp->p_fd, pp->p_cbuf, sizeof pp->p_cbuf)) <= 0)
|
||||
@@ -909,7 +895,7 @@ send_stats()
|
||||
if (errno == EINTR)
|
||||
return;
|
||||
# ifdef LOG
|
||||
syslog(LOG_ERR, "accept: %m");
|
||||
syslog(LOG_WARNING, "accept: %m");
|
||||
# else
|
||||
warn("accept");
|
||||
# endif
|
||||
@@ -918,7 +904,7 @@ send_stats()
|
||||
fp = fdopen(s, "w");
|
||||
if (fp == NULL) {
|
||||
# ifdef LOG
|
||||
syslog(LOG_ERR, "fdopen: %m");
|
||||
syslog(LOG_WARNING, "fdopen: %m");
|
||||
# else
|
||||
warn("fdopen");
|
||||
# endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.c,v 1.2 1997/10/10 16:33:24 lukem Exp $ */
|
||||
/* $NetBSD: extern.c,v 1.3 2002/09/20 20:54:16 mycroft Exp $ */
|
||||
/*
|
||||
* Hunt
|
||||
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: extern.c,v 1.2 1997/10/10 16:33:24 lukem Exp $");
|
||||
__RCSID("$NetBSD: extern.c,v 1.3 2002/09/20 20:54:16 mycroft Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
# include "hunt.h"
|
||||
@@ -20,10 +20,8 @@ char Buf[BUFSIZ]; /* general scribbling buffer */
|
||||
char Maze[HEIGHT][WIDTH2]; /* the maze */
|
||||
char Orig_maze[HEIGHT][WIDTH2]; /* the original maze */
|
||||
|
||||
fd_set Fds_mask; /* mask for the file descriptors */
|
||||
fd_set Have_inp; /* which file descriptors have input */
|
||||
struct pollfd fdset[3+MAXPL+MAXMON];
|
||||
int Nplayer = 0; /* number of players */
|
||||
int Num_fds; /* number of maximum file descriptor */
|
||||
int Socket; /* main socket */
|
||||
int Status; /* stat socket */
|
||||
int See_over[NASCII]; /* lookup table for determining whether
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: faketalk.c,v 1.4 1997/10/11 08:13:48 lukem Exp $ */
|
||||
/* $NetBSD: faketalk.c,v 1.7 2002/09/20 20:54:16 mycroft Exp $ */
|
||||
/*
|
||||
* Hunt
|
||||
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
|
||||
@@ -11,10 +11,11 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: faketalk.c,v 1.4 1997/10/11 08:13:48 lukem Exp $");
|
||||
__RCSID("$NetBSD: faketalk.c,v 1.7 2002/09/20 20:54:16 mycroft Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "bsd.h"
|
||||
#include "hunt.h"
|
||||
|
||||
#if defined(TALK_43) || defined(TALK_42)
|
||||
|
||||
@@ -26,7 +27,6 @@ __RCSID("$NetBSD: faketalk.c,v 1.4 1997/10/11 08:13:48 lukem Exp $");
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
# include <unistd.h>
|
||||
# include "hunt.h"
|
||||
# include "talk_ctl.h"
|
||||
|
||||
# define TRUE 1
|
||||
@@ -43,17 +43,17 @@ __RCSID("$NetBSD: faketalk.c,v 1.4 1997/10/11 08:13:48 lukem Exp $");
|
||||
|
||||
extern char *my_machine_name;
|
||||
extern char *First_arg, *Last_arg;
|
||||
extern char **environ;
|
||||
|
||||
static void do_announce __P((char *));
|
||||
SIGNAL_TYPE exorcise __P((int));
|
||||
|
||||
/*
|
||||
* exorcise - disspell zombies
|
||||
*/
|
||||
|
||||
SIGNAL_TYPE
|
||||
exorcise(dummy)
|
||||
int dummy __attribute__((unused));
|
||||
int dummy __attribute__((__unused__));
|
||||
{
|
||||
(void) wait(0);
|
||||
}
|
||||
@@ -73,7 +73,6 @@ faketalk()
|
||||
struct sockaddr_in des; /* address of destination */
|
||||
char *a;
|
||||
const char *b;
|
||||
extern char **environ;
|
||||
|
||||
(void) signal(SIGCHLD, exorcise);
|
||||
|
||||
@@ -124,7 +123,7 @@ faketalk()
|
||||
# else
|
||||
warn("falktalk: socket");
|
||||
# endif
|
||||
_exit(-1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
if (connect(service, (struct sockaddr *) &des, sizeof(des)) != 0) {
|
||||
@@ -133,7 +132,7 @@ faketalk()
|
||||
# else
|
||||
warn("faketalk: connect");
|
||||
# endif
|
||||
_exit(-1);
|
||||
_exit(1);
|
||||
}
|
||||
if ((f = fdopen(service, "r")) == NULL) {
|
||||
# ifdef LOG
|
||||
@@ -141,7 +140,7 @@ faketalk()
|
||||
# else
|
||||
warn("faketalk: fdopen");
|
||||
# endif
|
||||
_exit(-2);
|
||||
_exit(2);
|
||||
}
|
||||
|
||||
(void) fgets(buf, BUFSIZ, f);
|
||||
@@ -190,7 +189,6 @@ do_announce(s)
|
||||
char *s;
|
||||
{
|
||||
CTL_RESPONSE response;
|
||||
extern struct sockaddr_in ctl_addr;
|
||||
|
||||
get_remote_name(s); /* setup his_machine_addr, msg.r_name */
|
||||
|
||||
@@ -225,6 +223,7 @@ do_announce(s)
|
||||
p_error("send delete remote");
|
||||
}
|
||||
#else
|
||||
void
|
||||
faketalk()
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hunt.h,v 1.5 1998/09/13 15:27:28 hubertf Exp $ */
|
||||
/* $NetBSD: hunt.h,v 1.7 2002/09/20 20:54:17 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
* Hunt
|
||||
@@ -21,7 +21,7 @@
|
||||
# endif
|
||||
# include <sys/types.h>
|
||||
# include <sys/uio.h>
|
||||
# include <sys/socket.h>
|
||||
# include <sys/poll.h>
|
||||
# ifdef INTERNET
|
||||
# include <netinet/in.h>
|
||||
# include <netdb.h>
|
||||
@@ -82,6 +82,7 @@
|
||||
# define MAXMON 1
|
||||
# else
|
||||
# define MAXPL 17
|
||||
# define MAXMON 0
|
||||
# endif
|
||||
# define SHORTLEN 2 /* sizeof (network short) */
|
||||
# define LONGLEN 4 /* sizeof (network long) */
|
||||
@@ -348,8 +349,8 @@ extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
|
||||
extern char *Sock_name;
|
||||
extern const char *Driver;
|
||||
|
||||
extern int Nplayer, Num_fds, Socket, Status;
|
||||
extern fd_set Fds_mask, Have_inp;
|
||||
extern int Nplayer, Socket, Status;
|
||||
extern struct pollfd fdset[];
|
||||
|
||||
# ifdef INTERNET
|
||||
extern u_short Test_port;
|
||||
@@ -393,8 +394,8 @@ extern FLAG no_beep;
|
||||
|
||||
void add_shot __P((int, int, int, char, int, PLAYER *, int, char));
|
||||
int answer __P((void));
|
||||
void bad_con __P((void));
|
||||
void bad_ver __P((void));
|
||||
void bad_con __P((void)) __attribute__((__noreturn__));
|
||||
void bad_ver __P((void)) __attribute__((__noreturn__));
|
||||
int broadcast_vec __P((int, struct sockaddr **));
|
||||
void ce __P((PLAYER *));
|
||||
void cgoto __P((PLAYER *, int, int));
|
||||
@@ -453,6 +454,6 @@ char translate __P((char));
|
||||
SIGNAL_TYPE cleanup __P((int)) __attribute__((__noreturn__));
|
||||
SIGNAL_TYPE intr __P((int));
|
||||
SIGNAL_TYPE sigalrm __P((int));
|
||||
SIGNAL_TYPE sigemt __P((int));
|
||||
SIGNAL_TYPE sigterm __P((int));
|
||||
SIGNAL_TYPE sigemt __P((int)) __attribute__((__noreturn__));
|
||||
SIGNAL_TYPE sigterm __P((int)) __attribute__((__noreturn__));
|
||||
SIGNAL_TYPE tstp __P((int));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: huntd.6,v 1.3 1998/01/09 08:03:42 perry Exp $
|
||||
.\" $NetBSD: huntd.6,v 1.6 2002/09/26 18:32:02 wiz Exp $
|
||||
.\"
|
||||
.\" Hunt
|
||||
.\" Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
|
||||
@@ -8,93 +8,94 @@
|
||||
.\" All rights reserved. The Berkeley software License Agreement
|
||||
.\" specifies the terms and conditions for redistribution.
|
||||
.\"
|
||||
.TH HUNTD 6 "21 August 1986"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
huntd \- hunt daemon, back-end for hunt game
|
||||
.SH SYNOPSIS
|
||||
\fB@sbindir@/huntd\fP [ \fB\-s\fP ] [ \fB\-p\fP port ]
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
.I huntd
|
||||
.Dd April 4, 2001
|
||||
.Dt HUNTD 6
|
||||
.Sh NAME
|
||||
.Nm huntd
|
||||
.Nd hunt daemon, back-end for hunt game
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl s
|
||||
.Op Fl p Ar port
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
controls the multi-player
|
||||
.IR hunt (6)
|
||||
.Xr hunt 6
|
||||
game.
|
||||
When it starts up, it tries to notify all members of the
|
||||
.I hunt-players
|
||||
.Em hunt-players
|
||||
mailing list (see
|
||||
.IR sendmail (8))
|
||||
.Xr sendmail 8 )
|
||||
by faking a
|
||||
.IR talk (1)
|
||||
request from user ``Hunt Game''.
|
||||
.PP
|
||||
.Xr talk 1
|
||||
request from user
|
||||
.Dq Hunt Game .
|
||||
.Pp
|
||||
The
|
||||
.B \-s
|
||||
.Fl s
|
||||
option is for running
|
||||
.I huntd
|
||||
.Nm
|
||||
forever (server mode).
|
||||
This is similar to running it under the control of
|
||||
.I inetd
|
||||
(see below),
|
||||
but it consumes a process table entry when no one is playing.
|
||||
.PP
|
||||
.Xr inetd 8
|
||||
(see below), but it consumes a process table entry when no one is playing.
|
||||
.Pp
|
||||
The
|
||||
.B \-p
|
||||
option changes the udp port number used to rendezvous with the player
|
||||
.Fl p
|
||||
option changes the UDP port number used to rendezvous with the player
|
||||
process and thus allows for private games of hunt.
|
||||
This option turns off the notification of players on the
|
||||
.I hunt-players
|
||||
.Em hunt-players
|
||||
mailing list.
|
||||
.SH INETD
|
||||
.PP
|
||||
.Ss INETD
|
||||
To run
|
||||
.I huntd
|
||||
.Nm
|
||||
from
|
||||
.IR inetd ,
|
||||
you'll need to put the
|
||||
.I hunt
|
||||
.Xr inetd 8 ,
|
||||
you'll need to
|
||||
put the
|
||||
.Nm hunt
|
||||
service in
|
||||
.BR /etc/services :
|
||||
.IP
|
||||
.Pa /etc/services :
|
||||
.Bd -literal
|
||||
hunt 26740/udp # multi-player/multi-host mazewars
|
||||
.LP
|
||||
and add a line in
|
||||
.BR /etc/inetd.conf :
|
||||
.IP
|
||||
hunt dgram udp wait nobody @sbindir@/huntd HUNT
|
||||
.LP
|
||||
except for Suns which use
|
||||
.BR /etc/servers :
|
||||
.IP
|
||||
hunt udp @sbindir@/huntd
|
||||
.LP
|
||||
Do not use any of the command line options \(em if you want
|
||||
.I inetd
|
||||
.Ed
|
||||
and
|
||||
add the following line to
|
||||
.Pa /etc/inetd.conf :
|
||||
.Bd -literal -offset indent -compact
|
||||
hunt dgram udp wait nobody @sbindir@/huntd huntd
|
||||
.Ed
|
||||
Do not use any of the command line options; if you want
|
||||
.Xr inetd 8
|
||||
to start up
|
||||
.I huntd
|
||||
on a private port, change the port listed in
|
||||
.BR /etc/services .
|
||||
.SH "NETWORK RENDEZVOUS"
|
||||
.Nm
|
||||
on a private port, change the port listed for
|
||||
.Nm hunt
|
||||
in
|
||||
.Pa /etc/services .
|
||||
.Sh NETWORK RENDEZVOUS
|
||||
When
|
||||
.IR hunt (6)
|
||||
.Xr hunt 6
|
||||
starts up, it broadcasts on the local area net
|
||||
(using the broadcast address for each interface) to find a
|
||||
.I hunt
|
||||
.Nm hunt
|
||||
game in progress.
|
||||
If a
|
||||
.I huntd
|
||||
.Nm
|
||||
hears the request, it sends back the port number for the
|
||||
.I hunt
|
||||
.Nm hunt
|
||||
process to connect to.
|
||||
Otherwise, the
|
||||
.I hunt
|
||||
.Nm hunt
|
||||
process starts up a
|
||||
.I huntd
|
||||
on the local machine and trys to rendezvous with it.
|
||||
.SH "SEE ALSO"
|
||||
hunt(6), talk(1), sendmail(8)
|
||||
.SH AUTHORS
|
||||
.Nm
|
||||
on the local machine and tries to rendezvous with it.
|
||||
.Sh SEE ALSO
|
||||
.Xr talk 1 ,
|
||||
.Xr hunt 6 ,
|
||||
.Xr sendmail 8
|
||||
.Sh AUTHORS
|
||||
Conrad Huang, Ken Arnold, and Greg Couch;
|
||||
.br
|
||||
University of California, San Francisco, Computer Graphics Lab
|
||||
.\"SH BUGS
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: terminal.c,v 1.2 1997/10/10 16:34:05 lukem Exp $ */
|
||||
/* $NetBSD: terminal.c,v 1.3 2002/05/26 00:12:13 wiz Exp $ */
|
||||
/*
|
||||
* Hunt
|
||||
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
|
||||
@@ -7,16 +7,12 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: terminal.c,v 1.2 1997/10/10 16:34:05 lukem Exp $");
|
||||
__RCSID("$NetBSD: terminal.c,v 1.3 2002/05/26 00:12:13 wiz Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
# include "hunt.h"
|
||||
# define TERM_WIDTH 80 /* Assume terminals are 80-char wide */
|
||||
#include "hunt.h"
|
||||
#define TERM_WIDTH 80 /* Assume terminals are 80-char wide */
|
||||
|
||||
/*
|
||||
* cgoto:
|
||||
@@ -110,22 +106,12 @@ ref(pp)
|
||||
* Send a command to the given user
|
||||
*/
|
||||
void
|
||||
#if __STDC__
|
||||
sendcom(PLAYER *pp, int command, ...)
|
||||
#else
|
||||
sendcom(pp, command, va_alist)
|
||||
PLAYER *pp;
|
||||
int command;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int arg1, arg2;
|
||||
#if __STDC__
|
||||
|
||||
va_start(ap, command);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void) putc(command, pp->p_output);
|
||||
switch (command & 0377) {
|
||||
case MOVE:
|
||||
|
||||
Reference in New Issue
Block a user