xref: /netbsd/games/atc/struct.h (revision ebb2bc86)
1 /*	$NetBSD: struct.h,v 1.10 2014/03/22 22:58:56 dholland Exp $	*/
2 
3 /*-
4  * Copyright (c) 1990, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Ed James.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *	@(#)struct.h	8.1 (Berkeley) 5/31/93
35  */
36 
37 /*
38  * Copyright (c) 1987 by Ed James, UC Berkeley.  All rights reserved.
39  *
40  * Copy permission is hereby granted provided that this notice is
41  * retained on all partial or complete copies.
42  *
43  * For more info on this and all of my stuff, mail edjames@berkeley.edu.
44  */
45 
46 #include <stdbool.h>
47 
48 typedef struct {
49 	int	x, y;
50 	int	dir;	/* used only sometimes */
51 } SCREEN_POS;
52 
53 typedef struct {
54 	SCREEN_POS	p1, p2;
55 } LINE;
56 
57 typedef SCREEN_POS	EXIT;
58 typedef SCREEN_POS	BEACON;
59 typedef SCREEN_POS	AIRPORT;
60 
61 typedef struct {
62 	int	width, height;
63 	int	update_secs;
64 	int	newplane_time;
65 	unsigned num_exits;
66 	unsigned num_lines;
67 	unsigned num_beacons;
68 	unsigned num_airports;
69 	EXIT	*exit;
70 	LINE	*line;
71 	BEACON	*beacon;
72 	AIRPORT	*airport;
73 } C_SCREEN;
74 
75 enum places {
76 	T_NODEST = 0,
77 	T_BEACON = 1,
78 	T_EXIT = 2,
79 	T_AIRPORT = 3
80 };
81 
82 typedef struct plane {
83 	struct plane	*next, *prev;
84 	int		status;
85 	int		plane_no;
86 	int		plane_type;
87 	unsigned orig_no;
88 	enum places orig_type;
89 	unsigned dest_no;
90 	enum places dest_type;
91 	int		altitude;
92 	int		new_altitude;
93 	int		dir;
94 	int		new_dir;
95 	int		fuel;
96 	int		xpos;
97 	int		ypos;
98 	bool delayd;
99 	unsigned delayd_no;
100 } PLANE;
101 
102 typedef struct {
103 	PLANE	*head, *tail;
104 } LIST;
105 
106 typedef struct {
107 	char	name[33];
108 	char	host[256];
109 	char	game[256];
110 	int	planes;
111 	int	time;
112 	int	real_time;
113 } SCORE;
114 
115 #define SCORE_SCANF_FMT	"%9s %255s %255s %d %d %d"
116 #define SCORE_NAME_LEN 33
117 #define SCORE_GAME_LEN 256
118 
119 typedef struct displacement {
120 	int	dx;
121 	int	dy;
122 } DISPLACEMENT;
123