186d7f5d3SJohn Marino /*- 286d7f5d3SJohn Marino * Copyright (c) 1983-2003, Regents of the University of California. 386d7f5d3SJohn Marino * All rights reserved. 486d7f5d3SJohn Marino * 586d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without 686d7f5d3SJohn Marino * modification, are permitted provided that the following conditions are 786d7f5d3SJohn Marino * met: 886d7f5d3SJohn Marino * 986d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright 1086d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer. 1186d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 1286d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the 1386d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution. 1486d7f5d3SJohn Marino * 3. Neither the name of the University of California, San Francisco nor 1586d7f5d3SJohn Marino * the names of its contributors may be used to endorse or promote 1686d7f5d3SJohn Marino * products derived from this software without specific prior written 1786d7f5d3SJohn Marino * permission. 1886d7f5d3SJohn Marino * 1986d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 2086d7f5d3SJohn Marino * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2186d7f5d3SJohn Marino * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 2286d7f5d3SJohn Marino * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2386d7f5d3SJohn Marino * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2486d7f5d3SJohn Marino * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2586d7f5d3SJohn Marino * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2686d7f5d3SJohn Marino * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2786d7f5d3SJohn Marino * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2886d7f5d3SJohn Marino * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2986d7f5d3SJohn Marino * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3086d7f5d3SJohn Marino * 3186d7f5d3SJohn Marino * $OpenBSD: extern.c,v 1.4 2003/06/11 08:45:33 pjanzen Exp $ 3286d7f5d3SJohn Marino * $NetBSD: extern.c,v 1.2 1997/10/10 16:33:24 lukem Exp $ 3386d7f5d3SJohn Marino * $DragonFly: src/games/hunt/huntd/extern.c,v 1.1 2008/09/02 21:50:21 dillon Exp $ 3486d7f5d3SJohn Marino */ 3586d7f5d3SJohn Marino 3686d7f5d3SJohn Marino #include "hunt.h" 3786d7f5d3SJohn Marino #include "server.h" 3886d7f5d3SJohn Marino 3986d7f5d3SJohn Marino FLAG Am_monitor = FALSE; /* current process is a monitor */ 4086d7f5d3SJohn Marino 4186d7f5d3SJohn Marino char Buf[BUFSIZ]; /* general scribbling buffer */ 4286d7f5d3SJohn Marino char Maze[HEIGHT][WIDTH2]; /* the maze */ 4386d7f5d3SJohn Marino char Orig_maze[HEIGHT][WIDTH2]; /* the original maze */ 4486d7f5d3SJohn Marino 4586d7f5d3SJohn Marino fd_set Fds_mask; /* mask for the file descriptors */ 4686d7f5d3SJohn Marino fd_set Have_inp; /* which file descriptors have input */ 4786d7f5d3SJohn Marino int Nplayer = 0; /* number of players */ 4886d7f5d3SJohn Marino int Num_fds; /* number of maximum file descriptor */ 4986d7f5d3SJohn Marino int Socket; /* main socket */ 5086d7f5d3SJohn Marino int Status; /* stat socket */ 5186d7f5d3SJohn Marino int See_over[NASCII]; /* lookup table for determining whether 5286d7f5d3SJohn Marino * character represents "transparent" 5386d7f5d3SJohn Marino * item */ 5486d7f5d3SJohn Marino 5586d7f5d3SJohn Marino BULLET *Bullets = NULL; /* linked list of bullets */ 5686d7f5d3SJohn Marino 5786d7f5d3SJohn Marino EXPL *Expl[EXPLEN]; /* explosion lists */ 5886d7f5d3SJohn Marino EXPL *Last_expl; /* last explosion on Expl[0] */ 5986d7f5d3SJohn Marino 6086d7f5d3SJohn Marino PLAYER Player[MAXPL]; /* all the players */ 6186d7f5d3SJohn Marino PLAYER *End_player = Player; /* last active player slot */ 6286d7f5d3SJohn Marino PLAYER Boot[NBOOTS]; /* all the boots */ 6386d7f5d3SJohn Marino IDENT *Scores; /* score cache */ 6486d7f5d3SJohn Marino PLAYER Monitor[MAXMON]; /* all the monitors */ 6586d7f5d3SJohn Marino PLAYER *End_monitor = Monitor; /* last active monitor slot */ 6686d7f5d3SJohn Marino 6786d7f5d3SJohn Marino int volcano = 0; /* Explosion size */ 6886d7f5d3SJohn Marino 6986d7f5d3SJohn Marino int shot_req[MAXBOMB] = { 7086d7f5d3SJohn Marino BULREQ, GRENREQ, SATREQ, 7186d7f5d3SJohn Marino BOMB7REQ, BOMB9REQ, BOMB11REQ, 7286d7f5d3SJohn Marino BOMB13REQ, BOMB15REQ, BOMB17REQ, 7386d7f5d3SJohn Marino BOMB19REQ, BOMB21REQ, 7486d7f5d3SJohn Marino }; 7586d7f5d3SJohn Marino int shot_type[MAXBOMB] = { 7686d7f5d3SJohn Marino SHOT, GRENADE, SATCHEL, 7786d7f5d3SJohn Marino BOMB, BOMB, BOMB, 7886d7f5d3SJohn Marino BOMB, BOMB, BOMB, 7986d7f5d3SJohn Marino BOMB, BOMB, 8086d7f5d3SJohn Marino }; 8186d7f5d3SJohn Marino 8286d7f5d3SJohn Marino int slime_req[MAXSLIME] = { 8386d7f5d3SJohn Marino SLIMEREQ, SSLIMEREQ, SLIME2REQ, SLIME3REQ, 8486d7f5d3SJohn Marino }; 85