xref: /netbsd-src/games/atc/struct.h (revision 1e7c0bc4d8af0d3855fcc759b0e749f548799677)
1*1e7c0bc4Sdholland /*	$NetBSD: struct.h,v 1.10 2014/03/22 22:58:56 dholland Exp $	*/
2101657d1Scgd 
361f28255Scgd /*-
4101657d1Scgd  * Copyright (c) 1990, 1993
5101657d1Scgd  *	The Regents of the University of California.  All rights reserved.
661f28255Scgd  *
761f28255Scgd  * This code is derived from software contributed to Berkeley by
861f28255Scgd  * Ed James.
961f28255Scgd  *
1061f28255Scgd  * Redistribution and use in source and binary forms, with or without
1161f28255Scgd  * modification, are permitted provided that the following conditions
1261f28255Scgd  * are met:
1361f28255Scgd  * 1. Redistributions of source code must retain the above copyright
1461f28255Scgd  *    notice, this list of conditions and the following disclaimer.
1561f28255Scgd  * 2. Redistributions in binary form must reproduce the above copyright
1661f28255Scgd  *    notice, this list of conditions and the following disclaimer in the
1761f28255Scgd  *    documentation and/or other materials provided with the distribution.
18e5aeb4eaSagc  * 3. Neither the name of the University nor the names of its contributors
1961f28255Scgd  *    may be used to endorse or promote products derived from this software
2061f28255Scgd  *    without specific prior written permission.
2161f28255Scgd  *
2261f28255Scgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2361f28255Scgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2461f28255Scgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2561f28255Scgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2661f28255Scgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2761f28255Scgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2861f28255Scgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2961f28255Scgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3061f28255Scgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3161f28255Scgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3261f28255Scgd  * SUCH DAMAGE.
3361f28255Scgd  *
34101657d1Scgd  *	@(#)struct.h	8.1 (Berkeley) 5/31/93
3561f28255Scgd  */
3661f28255Scgd 
3761f28255Scgd /*
3861f28255Scgd  * Copyright (c) 1987 by Ed James, UC Berkeley.  All rights reserved.
3961f28255Scgd  *
4061f28255Scgd  * Copy permission is hereby granted provided that this notice is
4161f28255Scgd  * retained on all partial or complete copies.
4261f28255Scgd  *
4361f28255Scgd  * For more info on this and all of my stuff, mail edjames@berkeley.edu.
4461f28255Scgd  */
4561f28255Scgd 
4666a360a4Sdholland #include <stdbool.h>
4766a360a4Sdholland 
4861f28255Scgd typedef struct {
4961f28255Scgd 	int	x, y;
5061f28255Scgd 	int	dir;	/* used only sometimes */
5161f28255Scgd } SCREEN_POS;
5261f28255Scgd 
5361f28255Scgd typedef struct {
5461f28255Scgd 	SCREEN_POS	p1, p2;
5561f28255Scgd } LINE;
5661f28255Scgd 
5761f28255Scgd typedef SCREEN_POS	EXIT;
5861f28255Scgd typedef SCREEN_POS	BEACON;
5961f28255Scgd typedef SCREEN_POS	AIRPORT;
6061f28255Scgd 
6161f28255Scgd typedef struct {
6261f28255Scgd 	int	width, height;
6361f28255Scgd 	int	update_secs;
6461f28255Scgd 	int	newplane_time;
65c1bee345Sdholland 	unsigned num_exits;
666b884adbSdholland 	unsigned num_lines;
67c1bee345Sdholland 	unsigned num_beacons;
68c1bee345Sdholland 	unsigned num_airports;
6961f28255Scgd 	EXIT	*exit;
7061f28255Scgd 	LINE	*line;
7161f28255Scgd 	BEACON	*beacon;
7261f28255Scgd 	AIRPORT	*airport;
7361f28255Scgd } C_SCREEN;
7461f28255Scgd 
75*1e7c0bc4Sdholland enum places {
76*1e7c0bc4Sdholland 	T_NODEST = 0,
77*1e7c0bc4Sdholland 	T_BEACON = 1,
78*1e7c0bc4Sdholland 	T_EXIT = 2,
79*1e7c0bc4Sdholland 	T_AIRPORT = 3
80*1e7c0bc4Sdholland };
81*1e7c0bc4Sdholland 
8261f28255Scgd typedef struct plane {
8361f28255Scgd 	struct plane	*next, *prev;
8461f28255Scgd 	int		status;
8561f28255Scgd 	int		plane_no;
8661f28255Scgd 	int		plane_type;
87*1e7c0bc4Sdholland 	unsigned orig_no;
88*1e7c0bc4Sdholland 	enum places orig_type;
89*1e7c0bc4Sdholland 	unsigned dest_no;
90*1e7c0bc4Sdholland 	enum places dest_type;
9161f28255Scgd 	int		altitude;
9261f28255Scgd 	int		new_altitude;
9361f28255Scgd 	int		dir;
9461f28255Scgd 	int		new_dir;
9561f28255Scgd 	int		fuel;
9661f28255Scgd 	int		xpos;
9761f28255Scgd 	int		ypos;
9866a360a4Sdholland 	bool delayd;
9966a360a4Sdholland 	unsigned delayd_no;
10061f28255Scgd } PLANE;
10161f28255Scgd 
10261f28255Scgd typedef struct {
10361f28255Scgd 	PLANE	*head, *tail;
10461f28255Scgd } LIST;
10561f28255Scgd 
10661f28255Scgd typedef struct {
1074ce238c9Sjnemeth 	char	name[33];
10861f28255Scgd 	char	host[256];
10961f28255Scgd 	char	game[256];
11061f28255Scgd 	int	planes;
11161f28255Scgd 	int	time;
11261f28255Scgd 	int	real_time;
11361f28255Scgd } SCORE;
11461f28255Scgd 
115d5f85ed9Shubertf #define SCORE_SCANF_FMT	"%9s %255s %255s %d %d %d"
1164ce238c9Sjnemeth #define SCORE_NAME_LEN 33
1174ce238c9Sjnemeth #define SCORE_GAME_LEN 256
118d5f85ed9Shubertf 
11961f28255Scgd typedef struct displacement {
12061f28255Scgd 	int	dx;
12161f28255Scgd 	int	dy;
12261f28255Scgd } DISPLACEMENT;
123