… | |
… | |
28 | #define EXTERN extern |
28 | #define EXTERN extern |
29 | #endif |
29 | #endif |
30 | |
30 | |
31 | #include "includes.h" |
31 | #include "includes.h" |
32 | |
32 | |
33 | |
33 | typedef int8_t sint8; |
34 | /* Type defines for specific signed/unsigned variables of a certain number |
34 | typedef uint8_t uint8; |
35 | * of bits. Not really used anyplace, but if a certain number of bits |
35 | typedef int16_t sint16; |
36 | * is required, these type defines should then be used. This will make |
36 | typedef uint16_t uint16; |
37 | * porting to systems that have different sized data types easier. |
37 | typedef int32_t sint32; |
38 | * |
|
|
39 | * Note: The type defines should just mean that the data type has at |
|
|
40 | * least that many bits. if a uint16 is actually 32 bits, no big deal, |
|
|
41 | * it is just a waste of space. |
|
|
42 | * |
|
|
43 | * Note2: When using something that is normally stored in a character |
|
|
44 | * (ie strings), don't use the uint8/sint8 typdefs, use 'char' instead. |
|
|
45 | * The signedness for char is probably not universal, and using char |
|
|
46 | * will probably be more portable than sint8/unit8 |
|
|
47 | */ |
|
|
48 | |
|
|
49 | |
|
|
50 | typedef unsigned int uint32; |
38 | typedef uint32_t uint32; |
51 | |
39 | typedef int64_t sint64; |
52 | #ifndef UINT32_MAX |
40 | typedef uint64_t uint64; |
53 | #define UINT32_MAX 4294967295U |
|
|
54 | #endif |
|
|
55 | |
|
|
56 | typedef signed int sint32; |
|
|
57 | #define SINT32_MAX 2147483647 |
|
|
58 | |
|
|
59 | typedef unsigned short uint16; |
|
|
60 | #ifndef UINT16_MAX |
|
|
61 | #define UINT16_MAX 65535 |
|
|
62 | #endif |
|
|
63 | |
|
|
64 | typedef signed short sint16; |
|
|
65 | #define SINT16_MAX 32767 |
|
|
66 | |
|
|
67 | typedef unsigned char uint8; |
|
|
68 | #ifndef UINT8_MAX |
|
|
69 | #define UINT8_MAX 255 |
|
|
70 | #endif |
|
|
71 | |
|
|
72 | typedef signed char sint8; |
|
|
73 | #define SINT8_MAX 127 |
|
|
74 | |
41 | |
75 | typedef unsigned short Fontindex; |
42 | typedef unsigned short Fontindex; |
76 | |
|
|
77 | #ifdef WIN32 |
|
|
78 | /* Python plugin stuff defines SIZEOF_LONG_LONG as 8, and besides __int64 is a 64b type on MSVC... |
|
|
79 | * So let's force the typedef */ |
|
|
80 | typedef unsigned __int64 uint64; |
|
|
81 | typedef signed __int64 sint64; |
|
|
82 | /* Needed for experience */ |
|
|
83 | #define atoll _atoi64 |
|
|
84 | |
|
|
85 | /* To reduce number of warnings */ |
|
|
86 | #pragma warning( disable: 4244 ) /* conversion from 'xxx' to 'yyy', possible loss of data */ |
|
|
87 | #pragma warning( disable: 4305 ) /* initializing float f = 0.05; instead of f = 0.05f; */ |
|
|
88 | |
|
|
89 | #else /* WIN32 */ |
|
|
90 | |
|
|
91 | #if SIZEOF_LONG == 8 |
|
|
92 | typedef unsigned long uint64; |
|
|
93 | typedef signed long sint64; |
|
|
94 | #elif SIZEOF_LONG_LONG == 8 |
|
|
95 | typedef unsigned long long uint64; |
|
|
96 | typedef signed long long sint64; |
|
|
97 | #else |
|
|
98 | #error do not know how to get a 64 bit value on this system. |
|
|
99 | #error correct and send mail to crossfire-devel on how to do this |
|
|
100 | #endif |
|
|
101 | |
|
|
102 | #endif |
|
|
103 | |
43 | |
104 | #include <vector> |
44 | #include <vector> |
105 | |
45 | |
106 | #define ACC_CLASS(name) |
46 | #define ACC_CLASS(name) |
107 | #define ACC(meta,member) member |
47 | #define ACC(meta,member) member |
… | |
… | |
139 | #include "book.h" |
79 | #include "book.h" |
140 | /* |
80 | /* |
141 | * So far only used when dealing with artifacts. |
81 | * So far only used when dealing with artifacts. |
142 | * (now used by alchemy and other code too. Nov 95 b.t). |
82 | * (now used by alchemy and other code too. Nov 95 b.t). |
143 | */ |
83 | */ |
144 | typedef struct linked_char { |
84 | struct linked_char |
|
|
85 | { |
145 | shstr name; |
86 | shstr name; |
146 | struct linked_char *next; |
87 | struct linked_char *next; |
147 | } linked_char; |
88 | }; |
148 | |
89 | |
149 | /* Pull in artifacts */ |
90 | /* Pull in artifacts */ |
150 | #include "artifact.h" |
91 | #include "artifact.h" |
151 | |
92 | |
152 | /* Now for gods */ |
93 | /* Now for gods */ |
… | |
… | |
171 | |
112 | |
172 | /* |
113 | /* |
173 | * These are the beginnings of linked lists: |
114 | * These are the beginnings of linked lists: |
174 | */ |
115 | */ |
175 | EXTERN player *first_player; |
116 | EXTERN player *first_player; |
176 | EXTERN mapstruct *first_map; |
117 | EXTERN maptile *first_map; |
177 | EXTERN region *first_region; |
118 | EXTERN region *first_region; |
178 | EXTERN treasurelist *first_treasurelist; |
119 | EXTERN treasurelist *first_treasurelist; |
179 | EXTERN artifactlist *first_artifactlist; |
120 | EXTERN artifactlist *first_artifactlist; |
180 | EXTERN archetype *first_archetype; |
121 | EXTERN archetype *first_archetype; |
181 | EXTERN objectlink *first_friendly_object; /* Objects monsters will go after */ |
122 | EXTERN objectlink *first_friendly_object; /* Objects monsters will go after */ |
… | |
… | |
279 | #else |
220 | #else |
280 | # define CALLOC(x,y) malloc(x*y) |
221 | # define CALLOC(x,y) malloc(x*y) |
281 | # define CFREE(x) free(x) |
222 | # define CFREE(x) free(x) |
282 | #endif |
223 | #endif |
283 | |
224 | |
284 | #ifndef WIN32 /* ---win32 we define this stuff in win32.h */ |
|
|
285 | #if HAVE_DIRENT_H |
225 | #if HAVE_DIRENT_H |
286 | # include <dirent.h> |
226 | # include <dirent.h> |
287 | # define NAMLEN(dirent) strlen((dirent)->d_name) |
227 | # define NAMLEN(dirent) strlen((dirent)->d_name) |
288 | #else |
228 | #else |
289 | # define dirent direct |
229 | # define dirent direct |
… | |
… | |
295 | # include <sys/dir.h> |
235 | # include <sys/dir.h> |
296 | # endif |
236 | # endif |
297 | # if HAVE_NDIR_H |
237 | # if HAVE_NDIR_H |
298 | # include <ndir.h> |
238 | # include <ndir.h> |
299 | # endif |
239 | # endif |
300 | #endif |
|
|
301 | #endif |
240 | #endif |
302 | |
241 | |
303 | typedef struct Settings { |
242 | typedef struct Settings { |
304 | char *logfilename; /* logfile to use */ |
243 | char *logfilename; /* logfile to use */ |
305 | uint16 csport; /* port for new client/server */ |
244 | uint16 csport; /* port for new client/server */ |
… | |
… | |
403 | void free (object *); |
342 | void free (object *); |
404 | void free (archetype *); |
343 | void free (archetype *); |
405 | void free (recipe *); |
344 | void free (recipe *); |
406 | void free (linked_char *); |
345 | void free (linked_char *); |
407 | void free (godlink *); |
346 | void free (godlink *); |
|
|
347 | void free (objectlink *); |
|
|
348 | void free (oblinkpt *); |
408 | void free (mapstruct *); |
349 | void free (maptile *); |
409 | void free (key_value *); |
350 | void free (key_value *); |
410 | void free (treasure *); |
351 | void free (treasure *); |
411 | void free (materialtype_t *); |
352 | void free (materialtype_t *); |
412 | void free (player *); |
353 | void free (player *); |
413 | void free (New_Face *); |
354 | void free (New_Face *); |