diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-03-22 00:29:16 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-03-22 00:29:16 +0000 |
commit | 278a66c97d5a4e5090c5b0865ca3ce05c67a022a (patch) | |
tree | d6c2b787c26b4b792e268a96f74805d82039ecd7 | |
parent | fbb9c9bb18b9be9353d3232df9f3af78e7240d16 (diff) |
More accurate man page; more informative logging; use random() instead of
old internal routine (seems to minimize instant death on re-entry).
-rw-r--r-- | games/hunt/hunt/hunt.6 | 23 | ||||
-rw-r--r-- | games/hunt/huntd/answer.c | 4 | ||||
-rw-r--r-- | games/hunt/huntd/driver.c | 19 |
3 files changed, 25 insertions, 21 deletions
diff --git a/games/hunt/hunt/hunt.6 b/games/hunt/hunt/hunt.6 index 877a795705b..4b7b9b70b84 100644 --- a/games/hunt/hunt/hunt.6 +++ b/games/hunt/hunt/hunt.6 @@ -1,5 +1,5 @@ .\" $NetBSD: hunt.6,v 1.3 1997/10/10 16:32:30 lukem Exp $ -.\" $OpenBSD: hunt.6,v 1.4 1999/03/14 02:07:30 pjanzen Exp $ +.\" $OpenBSD: hunt.6,v 1.5 1999/03/22 00:29:10 pjanzen Exp $ .\" .\" hunt .\" Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold @@ -136,7 +136,7 @@ does, i.e., .Ic k , and .Ic l -for left, down, up, right respectively. +for left, down, up, right, respectively. To change which direction you're facing in the maze, use the upper case version of the movement key (i.e., .Ic HJKL ) . @@ -167,13 +167,13 @@ Throw very, very big bomb (Takes 361 charges) .It Ic @ Throw biggest bomb (Takes 441 charges) .It Ic o -Throw small slime (Takes 15 charges) +Throw small slime (Takes 5 charges) .It Ic O -Throw big slime (Takes 30 charges) +Throw big slime (Takes 10 charges) .It Ic p -Throw bigger slime (Takes 45 charges) +Throw bigger slime (Takes 15 charges) .It Ic P -Throw biggest slime (Takes 60 charges) +Throw biggest slime (Takes 20 charges) .It Ic s Scan (show where other players are) (Takes 1 charge) .It Ic c @@ -247,14 +247,19 @@ All explosions are centered around the square the shot hits and do the most damage in the center. .It Slime affects all squares it oozes over. -The number of squares is equal to the number of charges used. +The number of squares is equal to the number of charges used, +multiplied by +.Ft conf_slimefactor +as set by +.Xr huntd 6 +(default 3). .It One small mine and one large mine are placed in the maze for every new player. A mine has a 2% probability of tripping when you walk forward on to it; 50% when going sideways; 95% when backing up. -Tripping a mine costs you 5 points or 10 points respectively. -Defusing a mine is worth 1 charge or 9 charges respectively. +Tripping a mine costs you 5 points or 10 points, respectively. +Defusing a mine is worth 1 charge or 9 charges, respectively. .It You cannot see behind you. .It diff --git a/games/hunt/huntd/answer.c b/games/hunt/huntd/answer.c index f45b16d8c47..aed1e6ce5da 100644 --- a/games/hunt/huntd/answer.c +++ b/games/hunt/huntd/answer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: answer.c,v 1.5 1999/03/14 02:07:30 pjanzen Exp $ */ +/* $OpenBSD: answer.c,v 1.6 1999/03/22 00:29:15 pjanzen Exp $ */ /* $NetBSD: answer.c,v 1.3 1997/10/10 16:32:50 lukem Exp $ */ /* * Hunt @@ -57,8 +57,8 @@ answer_first() request_init(&ri, RQ_DAEMON, "huntd", RQ_FILE, newsock, 0); fromhost(&ri); if (hosts_access(&ri) == 0) { + logx(LOG_INFO, "rejected connection from %s", eval_client(&ri)); close(newsock); - logx(LOG_INFO, "rejected connection"); return; } diff --git a/games/hunt/huntd/driver.c b/games/hunt/huntd/driver.c index 1e1fbdd28e7..5618a8f3118 100644 --- a/games/hunt/huntd/driver.c +++ b/games/hunt/huntd/driver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: driver.c,v 1.5 1999/03/14 02:07:30 pjanzen Exp $ */ +/* $OpenBSD: driver.c,v 1.6 1999/03/22 00:29:15 pjanzen Exp $ */ /* $NetBSD: driver.c,v 1.5 1997/10/20 00:37:16 lukem Exp $ */ /* * Hunt @@ -26,13 +26,10 @@ #include "conf.h" #include "server.h" -int Seed = 0; - char *First_arg; /* pointer to argv[0] */ char *Last_arg; /* pointer to end of argv/environ */ u_int16_t Server_port = HUNT_PORT; int Server_socket; /* test socket to answer datagrams */ -FLAG inetd_spawned; /* invoked via inetd */ FLAG should_announce = TRUE; /* true if listening on standard port */ u_short sock_port; /* port # of tcp listen socket */ u_short stat_port; /* port # of statistics tcp socket */ @@ -373,9 +370,9 @@ init() len = sizeof (struct sockaddr_in); if (getsockname(STDIN_FILENO, (struct sockaddr *) &test_port, &len) >= 0 && test_port.sin_family == AF_INET) { - /* We are probably running from inetd: */ - inetd_spawned = TRUE; + /* We are probably running from inetd: don't log to stderr */ Server_socket = STDIN_FILENO; + conf_logerr = 0; if (test_port.sin_port != htons((u_short) Server_port)) { should_announce = FALSE; Server_port = ntohs(test_port.sin_port); @@ -401,7 +398,7 @@ init() Num_fds = Server_socket + 1; /* Initialise the random seed: */ - Seed = getpid() + time((time_t *) NULL); + srandom(getpid() + time((time_t *) NULL)); /* Dig the maze: */ makemaze(); @@ -852,8 +849,7 @@ rand_num(range) { if (range == 0) return 0; - Seed = Seed * 11109 + 13849; - return (((Seed >> 16) & 0xffff) % range); + return (random() % range); } /* @@ -952,6 +948,7 @@ send_stats() request_init(&ri, RQ_DAEMON, "huntd", RQ_FILE, s, 0); fromhost(&ri); if (hosts_access(&ri) == 0) { + logx(LOG_INFO, "rejected connection from %s", eval_client(&ri)); close(s); return; } @@ -1086,8 +1083,10 @@ handle_wkport(fd) } /* Do we allow access? */ - if (hosts_access(&ri) == 0) + if (hosts_access(&ri) == 0) { + logx(LOG_INFO, "rejected connection from %s", eval_client(&ri)); return; + } query = ntohs(query); |