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 * misc.h: Misc. definitions which don't really belong anywhere,
29 * but have to go somewhere!
31 * Known contributors to this file:
40 #include <sys/types.h>
43 typedef unsigned char u_char;
44 typedef unsigned short u_short;
45 typedef char *caddr_t;
46 typedef unsigned int u_int;
48 /* integral mismatch, due to misuse of sector short */
49 #pragma warning (disable : 4761 )
62 /* This is the structure we use to keep track of the global mobility
63 things, such as when the server is supposed to start/stop updating
64 mobility and the timestamp of when the game was last up. These
65 times are in seconds. */
66 struct mob_acc_globals {
67 time_t timestamp; /* Last timestamp of when the game was up */
68 time_t starttime; /* When we should start updating mobility again. */
72 #define ATTRIBUTE(attrs) __attribute__ (attrs)
74 #define ATTRIBUTE(attrs)
77 #define ANNO_KEEP_DAYS 7 /* Keep announcements around for this many days */
78 /* This uses a lot of thread stack with some versions of GNU libc,
79 which can lead to nasty heap smashes (observed with 2.2.93).
80 Disabled for now, until we readjust thread stack sizes. */
82 #define RESOLVE_IPADDRESS /* resolve ip addresses into hostnames */
85 typedef u_char natid; /* NSC_NATID must match this */
87 #if defined(__linux__ ) || defined(__osf__)
88 #define POSIXSIGNALS 1
91 #if !defined (_EMPTH_LWP) && !defined (_EMPTH_POSIX)
95 #if defined(_EMPTH_POSIX) && !defined(POSIXSIGNALS)
100 #if !defined(aix) && !defined(sgi)
101 #ifndef ultrix /* already defined in ultrix */
102 typedef char s_char; /* change to signed char for aix */
105 typedef signed char s_char;
106 /* gcc __attribute__((format ...)) chokes on s_char * format strings */
108 #define ATTRIBUTE(attr)
109 #endif /* !aix && !sgi */
112 * watch it; your compiler might not like this.
113 * If you think this is bogus, look at /usr/include/struct.h
115 #define OFFSET(stype, oset) ((int)(&(((struct stype *)0)->oset)))
116 #define SETOFF(sinst, oset) ((s_char *) (sinst) + (oset))
119 #define bit(x) (1<<(x))
122 #define minutes(x) (60*(x))
123 #define hours(x) (60*60*(x))
124 #define days(x) (60*60*24*(x))
129 * If EXPR is true, an internal error occured.
131 * Usage: if (CANT_HAPPEN(...)) recovery_code();
133 #define CANT_HAPPEN(expr) ((expr) ? oops(#expr, __FILE__, __LINE__) : 0)
135 typedef int (*qsort_func_t) (const void *, const void *);
137 /* return codes from command routines */
138 #define RET_OK 0 /* command completed sucessfully */
139 #define RET_FAIL 1 /* command completed unsucessfully [?] */
140 #define RET_SYN 2 /* syntax error in command */
141 #define RET_SYS 3 /* system error (missing file, etc) */
143 double dmax(double n1, double n2);
144 double dmin(double n1, double n2);
146 extern s_char *numstr(s_char buf[], int n);
147 extern s_char *esplur(int n);
148 extern s_char *splur(int n);
149 extern s_char *iesplur(int n);
150 extern s_char *plur(int n, s_char *no, s_char *yes);
151 extern s_char *getstarg(s_char *input, s_char *prompt, s_char buf[]);
152 extern s_char *getstring(s_char *prompt, s_char buf[]);
153 extern s_char *prbuf(s_char *format, ...)
154 ATTRIBUTE((format (printf, 1, 2)));
158 #include "prototypes.h" /* must come at end, after defines and typedefs */
160 #endif /* _MISC_H_ */