/*
* Copyright (c) 1983, 1993
* The 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:
* 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. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)externs.h 8.1 (Berkeley) 5/31/93
*/
#include <sys/types.h>
#include <stdbool.h>
#include "machdep.h"
/* program mode */
extern int mode;
#define MODE_PLAYER 1
#define MODE_DRIVER 2
#define MODE_LOGGER 3
/* command line flags */
extern bool randomize; /* -x, give first available ship */
extern bool longfmt; /* -l, print score in long format */
extern bool nobells; /* -b, don't ring bell before Signal */
/* other initial data */
extern gid_t gid;
extern gid_t egid;
#define MAXNAMESIZE 20
extern char myname[MAXNAMESIZE];
#define grappled2(a, b) ((a)->file->grap[(b)->file->index].sn_count)
#define fouled2(a, b) ((a)->file->foul[(b)->file->index].sn_count)
#define snagged2(a, b) (grappled2(a, b) + fouled2(a, b))
#define Xgrappled2(a, b) ((a)->file->grap[(b)->file->index].sn_turn < turn-1 \
? grappled2(a, b) : 0)
#define Xfouled2(a, b) ((a)->file->foul[(b)->file->index].sn_turn < turn-1 \
? fouled2(a, b) : 0)
#define Xsnagged2(a, b) (Xgrappled2(a, b) + Xfouled2(a, b))
#define cleangrapple(a, b, c) Cleansnag(a, b, c, 1)
#define cleanfoul(a, b, c) Cleansnag(a, b, c, 2)
#define cleansnag(a, b, c) Cleansnag(a, b, c, 3)
void send_captain(struct ship *ship, const char *astr);
void send_captured(struct ship *ship, long a);
void send_class(struct ship *ship, long a);
void send_crew(struct ship *ship, long a, long b, long c);
void send_dbp(struct ship *ship, long a, long b, long c, long d);
void send_drift(struct ship *ship, long a);
void send_explode(struct ship *ship, long a);
void send_foul(struct ship *ship, long a);
void send_gunl(struct ship *ship, long a, long b);
void send_gunr(struct ship *ship, long a, long b);
void send_hull(struct ship *ship, long a);
void send_move(struct ship *ship, const char *astr);
void send_obp(struct ship *ship, long a, long b, long c, long d);
void send_pcrew(struct ship *ship, long a);
void send_unfoul(struct ship *ship, long a, long b);
void send_points(struct ship *ship, long a);
void send_qual(struct ship *ship, long a);
void send_ungrap(struct ship *ship, long a, long b);
void send_rigg(struct ship *ship, long a, long b, long c, long d);
void send_col(struct ship *ship, long a);
void send_dir(struct ship *ship, long a);
void send_row(struct ship *ship, long a);
void send_signal(struct ship *ship, const char *astr);
void send_sink(struct ship *ship, long a);
void send_struck(struct ship *ship, long a);
void send_ta(struct ship *ship, long a);
void send_alive(void);
void send_turn(long a);
void send_wind(long a, long b);
void send_fs(struct ship *ship, long a);
void send_grap(struct ship *ship, long a);
void send_rig1(struct ship *ship, long a);
void send_rig2(struct ship *ship, long a);
void send_rig3(struct ship *ship, long a);
void send_rig4(struct ship *ship, long a);
void send_begin(struct ship *ship);
void send_end(struct ship *ship);
void send_ddead(void);