]> git.pond.sub.org Git - empserver/blob - src/client/misc.h
Indented with src/scripts/indent-emp.
[empserver] / src / client / misc.h
1 /*
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
5  *
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.
10  *
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.
15  *
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
19  *
20  *  ---
21  *
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.
25  *
26  *  ---
27  *
28  *  misc.h: Misc client definitions
29  * 
30  *  Known contributors to this file:
31  *     Steve McClure, 1998
32  */
33
34 #ifndef _MISC_H_
35 #define _MISC_H_
36
37 #include <ctype.h>
38 #include <sys/types.h>
39 #include <ctype.h>
40
41 #ifdef hpux
42 #include <string.h>
43 #else
44 #ifdef _WIN32
45 #include <string.h>
46
47 typedef unsigned char u_char;
48 typedef unsigned short u_short;
49 #else
50 #include <strings.h>
51 #endif
52 #endif
53
54 #define MAXNOC          100
55
56 #define WORLD_X         32
57 #define WORLD_Y         16
58
59 #define ETUS            60      /* Defined here.. may be overridden later,
60                                    but things still use this define */
61 typedef u_char natid;           /* also change NSC_NATID in nsc.h */
62 #if !defined(aix) && !defined(sgi)
63 #ifndef ultrix                  /* already defined in ultrix */
64 typedef char s_char;            /* change to signed char for aix */
65 #endif  /* ultrix */
66 #else
67 typedef signed char s_char;
68 #endif /* !aix && !sgi */
69 typedef short coord;            /* also change NSC_COORD in nsc.h */
70 /*
71  * watch it; your compiler might not like this.
72  * If you think this is bogus, look at /usr/include/struct.h
73  */
74 #define OFFSET(stype, oset) ((int)(&(((struct stype *)0)->oset)))
75 #define SETOFF(sinst, oset) ((s_char *) (sinst) + (oset))
76
77 #ifndef bit
78 #define bit(x)          (1<<(x))
79 #endif
80
81 #define minutes(x)      (60*(x))
82 #define hours(x)        (60*60*(x))
83 #define days(x)         (60*60*24*(x))
84
85 typedef void (*voidfunc) ();
86
87         /* return codes from command routines */
88 #define RET_OK          0       /* command completed sucessfully */
89 #define RET_FAIL        1       /* command completed unsucessfully [?] */
90 #define RET_SYN         2       /* syntax error in command */
91 #define RET_SYS         3       /* system error (missing file, etc) */
92
93 #define MAX_DISTPATH_LEN        10      /* Has to go somewhere */
94
95 /*
96  * references to library functions which aren't related to any
97  * particular object, and are of general interest
98  */
99 extern long random();
100
101 extern double dmax();
102 extern double dmin();
103
104 extern s_char *fmt();
105 extern s_char *copy();
106 extern s_char *numstr();
107 extern s_char *esplur();
108 extern s_char *splur();
109 extern s_char *iesplur();
110 extern s_char *plur();
111 extern s_char *getstarg();
112 extern s_char *getstring();
113
114 /*
115  * frequently used libc functions
116  */
117
118 #ifndef _WIN32
119 extern s_char *malloc();
120 extern s_char *calloc();
121 #endif
122
123 #if (!defined (aix) && !defined (sgi))
124 extern s_char *ctime();
125 extern s_char *strncpy();
126 extern s_char *strcpy();
127 #ifndef NeXT
128 extern s_char *index();
129 extern s_char *rindex();
130 #endif /* NeXT */
131 #endif /* !aix && !sgi */
132
133 extern time_t time();
134 extern double atof();
135
136 #endif