2 * Empire - A multi-player, client/server Internet based war game.
3 * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
4 * Ken Stevens, Steve McClure
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23 * related information and legal notices. It is expected that any future
24 * projects/authors will amend these files as needed.
28 * nsc.h: Definitions for Empire conditionals
30 * Known contributors to this file:
37 #include "prototype.h"
44 long fld1; /* first commodity or number */
45 long fld2; /* second commodity or number */
46 int oper; /* required relationship operator */
50 coord x, y; /* current x-y */
51 coord dx, dy; /* accumlated x,y travel */
52 int id; /* return value of sctoff */
53 int type; /* type of query */
54 int curdist; /* dist query: current range */
55 struct range range; /* area of coverage */
56 int dist; /* dist query: range */
57 coord cx, cy; /* dist query: center x-y */
58 int (*read)(); /* read function */
59 int ncond; /* # of selection conditions */
60 struct nscstr cond[NS_NCOND]; /* selection conditions */
64 int cur; /* current item */
65 int sel; /* selection type */
66 int type; /* item type being selected */
67 int curdist; /* if NS_DIST, current item's dist */
68 struct range range; /* NS_AREA/NS_DIST: range selector */
69 int dist; /* NS_DIST: distance selector */
70 coord cx, cy; /* NS_DIST: center x-y, NS_XY: xy */
71 int group; /* NS_GROUP: fleet/wing match */
72 int size; /* NS_LIST: size of list */
73 int index; /* NS_LIST: index */
74 int list[NS_LSIZE]; /* NS_LIST: item list */
75 int (*read)(); /* read function */
76 int flags; /* EFF_ flags */
77 int ncond; /* # of selection conditions */
78 struct nscstr cond[NS_NCOND]; /* selection conditions */
90 * looks something like this:
91 * D: only deity can query on this field
92 * R: round this value to the nearest 10 if not owner
94 * C: catagory of value.
99 * xxxx xxxx xxxx xxxx xxxx xxxx
100 * DRTT TTCC VVVV VVVV VVVV VVVV
106 #define NSC_VAL (0) /* normal number */
107 #define NSC_VAR (1<<16) /* is a vtype */
108 #define NSC_OFF (2<<16) /* is an offset */
109 #define NSC_CMASK (3<<16)
112 * how to interpret "offset" fields
114 #define NSC_CHAR (1<<18) /* pointer to s_char */
115 #define NSC_UCHAR (2<<18) /* pointer to uchar */
116 #define NSC_SHORT (3<<18) /* pointer to short */
117 #define NSC_USHORT (4<<18) /* pointer to unsigned short */
118 #define NSC_INT (5<<18) /* pointer to int */
119 #define NSC_LONG (6<<18) /* pointer to long */
120 #define NSC_XCOORD (7<<18) /* pointer to short that needs x conversion */
121 #define NSC_YCOORD (8<<18) /* pointer to short that needs y conversion */
122 #define NSC_FLOAT (9<<18) /* pointer to float */
123 #define NSC_CHARP (10<<18) /* pointer to string pointer */
124 #define NSC_TIME (11<<18) /* pointer to time_t */
125 #define NSC_TMASK (15<<18)
127 #define NSC_NATID NSC_UCHAR /* change if natid typedef changes */
129 #define NSC_MASK (0xffff0000)
131 #define NSC_ROUND (1<<22)
132 #define NSC_DEITY (1<<23)
135 long ca_code; /* encoded form */
136 s_char *ca_name; /* name used for matches */
137 u_short ca_len; /* Used for arrays */
138 long ca_edv; /* which commands is this field visible to? */
141 /* variables using the above */
143 extern struct castr var_ca[];
144 extern struct castr sect_ca[];
145 extern struct castr ship_ca[];
146 extern struct castr plane_ca[];
147 extern struct castr land_ca[];
148 extern struct castr nuke_ca[];
149 extern struct castr news_ca[];
150 extern struct castr nat_ca[];
151 extern struct castr treaty_ca[];
152 extern struct castr trade_ca[];
153 extern struct castr loan_ca[];
154 extern struct castr genitem_ca[];
155 extern struct castr map_ca[];
156 extern struct castr bmp_ca[];
157 extern struct castr ca[];
158 extern struct castr commodity_ca[];
160 /* src/lib/subs/nstr.c */
161 extern s_char * nstr_comp(struct nscstr * , int * , int , s_char * );
162 extern int encode(register s_char * , long * , int );
165 extern s_char *decodep _PROTO((register long code, register void *addr));