… | |
… | |
22 | * The author can be reached via e-mail to crossfire@schmorp.de |
22 | * The author can be reached via e-mail to crossfire@schmorp.de |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #ifndef GLOBAL_H |
25 | #ifndef GLOBAL_H |
26 | #define GLOBAL_H |
26 | #define GLOBAL_H |
|
|
27 | |
|
|
28 | //#define _GLIBCXX_CONCEPT_CHECKS |
27 | |
29 | |
28 | #ifndef EXTERN |
30 | #ifndef EXTERN |
29 | #define EXTERN extern |
31 | #define EXTERN extern |
30 | #endif |
32 | #endif |
31 | |
33 | |
… | |
… | |
109 | |
111 | |
110 | /***************************************************************************** |
112 | /***************************************************************************** |
111 | * GLOBAL VARIABLES: * |
113 | * GLOBAL VARIABLES: * |
112 | *****************************************************************************/ |
114 | *****************************************************************************/ |
113 | |
115 | |
114 | extern facetile *new_faces; |
|
|
115 | |
|
|
116 | /* |
116 | /* |
117 | * These are the beginnings of linked lists: |
117 | * These are the beginnings of linked lists: |
118 | */ |
118 | */ |
119 | EXTERN treasurelist *first_treasurelist; |
|
|
120 | EXTERN artifactlist *first_artifactlist; |
119 | EXTERN artifactlist *first_artifactlist; |
121 | EXTERN archetype *first_archetype; |
120 | EXTERN archetype *first_archetype; |
122 | EXTERN objectlink *first_friendly_object; /* Objects monsters will go after */ |
121 | EXTERN objectlink *first_friendly_object; /* Objects monsters will go after */ |
123 | EXTERN godlink *first_god; |
122 | EXTERN godlink *first_god; |
124 | EXTERN racelink *first_race; |
123 | EXTERN racelink *first_race; |
… | |
… | |
151 | EXTERN char errmsg[HUGE_BUF]; |
150 | EXTERN char errmsg[HUGE_BUF]; |
152 | EXTERN long ob_count; |
151 | EXTERN long ob_count; |
153 | /* |
152 | /* |
154 | * Used in treasure.c |
153 | * Used in treasure.c |
155 | */ |
154 | */ |
156 | EXTERN archetype *ring_arch,*amulet_arch,*staff_arch,*crown_arch; |
155 | EXTERN archetype *ring_arch, *amulet_arch, *staff_arch, *crown_arch; |
157 | |
156 | |
158 | EXTERN std::vector<animation> animations; |
|
|
159 | EXTERN int num_animations,animations_allocated, bmaps_checksum; |
|
|
160 | |
|
|
161 | /* Rotate right. This is used in various places for checksumming */ |
|
|
162 | static inline uint32_t |
|
|
163 | ROTATE_RIGHT (uint32_t c) |
|
|
164 | { |
|
|
165 | return (c >> 31) | (c << 1); |
|
|
166 | } |
|
|
167 | |
|
|
168 | #define SET_ANIMATION(ob,newanim) ob->face = new_faces + animations [ob->animation_id].faces [newanim] |
157 | #define SET_ANIMATION(ob,newanim) ob->face = animations [ob->animation_id].faces [newanim] |
169 | #define GET_ANIMATION(ob,anim) animations [ob->animation_id].faces [anim] |
158 | #define GET_ANIMATION(ob,anim) animations [ob->animation_id].faces [anim] |
170 | #define GET_ANIM_ID(ob) (ob->animation_id) |
159 | #define GET_ANIM_ID(ob) (ob->animation_id) |
171 | /* NUM_ANIMATIONS returns the number of animations allocated. The last |
160 | /* NUM_ANIMATIONS returns the number of animations allocated. The last |
172 | * usuable animation will be NUM_ANIMATIONS-1 (for example, if an object |
161 | * usuable animation will be NUM_ANIMATIONS-1 (for example, if an object |
173 | * has 8 animations, NUM_ANIMATIONS will return 8, but the values will |
162 | * has 8 animations, NUM_ANIMATIONS will return 8, but the values will |
… | |
… | |
179 | extern short freearr_x[SIZEOFFREE], freearr_y[SIZEOFFREE]; |
168 | extern short freearr_x[SIZEOFFREE], freearr_y[SIZEOFFREE]; |
180 | extern int maxfree[SIZEOFFREE], freedir[SIZEOFFREE]; |
169 | extern int maxfree[SIZEOFFREE], freedir[SIZEOFFREE]; |
181 | extern int rightof_x[9], rightof_y[9]; |
170 | extern int rightof_x[9], rightof_y[9]; |
182 | extern int leftof_x[9], leftof_y[9]; |
171 | extern int leftof_x[9], leftof_y[9]; |
183 | |
172 | |
184 | extern facetile *blank_face, *empty_face; |
|
|
185 | extern facetile *dark_faces[]; |
|
|
186 | extern facetile *smooth_face; |
|
|
187 | |
|
|
188 | extern client *init_sockets; |
|
|
189 | |
|
|
190 | extern void emergency_save (); |
173 | extern void emergency_save (); |
191 | extern void cleanup (const char *cause, bool make_core = false); |
174 | extern void cleanup (const char *cause, bool make_core = false); |
192 | |
175 | |
193 | #include "libproto.h" |
176 | #include "libproto.h" |
194 | #include "sockproto.h" |
177 | #include "sockproto.h" |
195 | |
178 | |
196 | #define decrease_ob(xyz) decrease_ob_nr(xyz,1) |
179 | #define decrease_ob(xyz) decrease_ob_nr(xyz,1) |
197 | |
180 | |
198 | INTERFACE_CLASS (Settings) |
181 | INTERFACE_CLASS (Settings) |
199 | struct Settings { |
182 | struct Settings { |
200 | char *ACC (RO, logfilename); /* logfile to use */ |
183 | const char *ACC (RO, logfilename); /* logfile to use */ |
201 | int ACC (RW, csport); /* port for new client/server */ |
184 | int ACC (RW, csport); /* port for new client/server */ |
202 | int ACC (RW, debug); /* Default debugging level */ |
185 | int ACC (RW, debug); /* Default debugging level */ |
203 | uint8 dumpvalues; /* Set to dump various values/tables */ |
186 | uint8 dumpvalues; /* Set to dump various values/tables */ |
204 | char *dumparg; /* additional argument for some dump functions */ |
187 | const char *dumparg; /* additional argument for some dump functions */ |
205 | uint8 daemonmode; /* If true, detach and become daemon */ |
188 | uint8 daemonmode; /* If true, detach and become daemon */ |
206 | int argc; /* parameters that were passed to the program */ |
189 | int argc; /* parameters that were passed to the program */ |
207 | char **argv; /* Only used by xio.c, so will go away at some time */ |
190 | char **argv; /* Only used by xio.c, so will go away at some time */ |
208 | char *ACC (RO, confdir); /* configuration files */ |
191 | const char *ACC (RO, confdir); /* configuration files */ |
209 | char *ACC (RO, datadir); /* read only data files */ |
192 | const char *ACC (RO, datadir); /* read only data files */ |
210 | char *ACC (RO, localdir); /* read/write data files */ |
193 | const char *ACC (RO, localdir); /* read/write data files */ |
211 | char *ACC (RO, playerdir); /* Where the player files are */ |
194 | const char *ACC (RO, playerdir); /* Where the player files are */ |
212 | char *ACC (RO, mapdir); /* Where the map files are */ |
195 | const char *ACC (RO, mapdir); /* Where the map files are */ |
213 | char *ACC (RO, archetypes); /* name of the archetypes file - libdir is prepended */ |
196 | const char *ACC (RO, archetypes); /* name of the archetypes file - libdir is prepended */ |
214 | char *ACC (RO, regions); /* name of the regions file - libdir is prepended */ |
197 | const char *ACC (RO, regions); /* name of the regions file - libdir is prepended */ |
215 | char *ACC (RO, treasures); /* location of the treasures file. */ |
198 | const char *ACC (RO, treasures); /* location of the treasures file. */ |
216 | char *ACC (RO, uniquedir); /* directory for the unique items */ |
199 | const char *ACC (RO, uniquedir); /* directory for the unique items */ |
217 | char *ACC (RO, templatedir); /* directory for the template map */ |
200 | const char *ACC (RO, templatedir); /* directory for the template map */ |
218 | char *ACC (RO, tmpdir); /* Directory to use for temporary files */ |
201 | const char *ACC (RO, tmpdir); /* Directory to use for temporary files */ |
219 | sint16 ACC (RW, pk_luck_penalty); /* Amount by which player luck is reduced if they PK */ |
202 | sint16 ACC (RW, pk_luck_penalty); /* Amount by which player luck is reduced if they PK */ |
220 | uint8 ACC (RW, stat_loss_on_death); /* If true, chars lose a random stat when they die */ |
203 | uint8 ACC (RW, stat_loss_on_death); /* If true, chars lose a random stat when they die */ |
221 | uint8 ACC (RW, permanent_exp_ratio); /* how much exp should be 'permenant' and unable to be lost*/ |
204 | uint8 ACC (RW, permanent_exp_ratio); /* how much exp should be 'permenant' and unable to be lost*/ |
222 | uint8 ACC (RW, death_penalty_ratio); /* how much exp should be lost at death */ |
205 | uint8 ACC (RW, death_penalty_ratio); /* how much exp should be lost at death */ |
223 | uint8 ACC (RW, death_penalty_level); /* how many levels worth of exp may be lost on one death */ |
206 | uint8 ACC (RW, death_penalty_level); /* how many levels worth of exp may be lost on one death */ |
224 | uint8 ACC (RW, balanced_stat_loss); /* If true, Death stat depletion based on level etc */ |
207 | uint8 ACC (RW, balanced_stat_loss); /* If true, Death stat depletion based on level etc */ |
225 | uint8 ACC (RW, not_permadeth); /* if true, death is non-permament */ |
208 | uint8 ACC (RW, not_permadeth); /* if true, death is non-permament */ |
226 | uint8 ACC (RW, simple_exp); /* If true, use the simple experience system */ |
209 | uint8 ACC (RW, simple_exp); /* If true, use the simple experience system */ |
227 | int ACC (RW, reset_loc_time); /* Number of seconds to put player back at home */ |
|
|
228 | uint8 ACC (RW, set_title); /* players can set thier title */ |
210 | uint8 ACC (RW, set_title); /* players can set thier title */ |
229 | uint8 ACC (RW, resurrection); /* ressurection possible w/ permadeth on */ |
211 | uint8 ACC (RW, resurrection); /* ressurection possible w/ permadeth on */ |
230 | uint8 ACC (RW, search_items); /* search_items command */ |
212 | uint8 ACC (RW, search_items); /* search_items command */ |
231 | uint8 ACC (RW, spell_encumbrance); /* encumbrance effects spells */ |
213 | uint8 ACC (RW, spell_encumbrance); /* encumbrance effects spells */ |
232 | uint8 ACC (RW, spell_failure_effects); /* nasty backlash to spell failures */ |
214 | uint8 ACC (RW, spell_failure_effects); /* nasty backlash to spell failures */ |
233 | uint16 ACC (RW, set_friendly_fire); /* Percent of damage done by peaceful player vs player damage */ |
215 | uint16 ACC (RW, set_friendly_fire); /* Percent of damage done by peaceful player vs player damage */ |
234 | uint8 ACC (RW, casting_time); /* it takes awhile to cast a spell */ |
216 | uint8 ACC (RW, casting_time); /* it takes awhile to cast a spell */ |
235 | uint8 ACC (RW, real_wiz); /* use mud-like wizards */ |
217 | uint8 ACC (RW, real_wiz); /* use mud-like wizards */ |
236 | uint8 dummy_000; |
218 | uint8 dummy_000; |
237 | uint8 ACC (RW, spellpoint_level_depend); /* spell costs go up with level */ |
219 | uint8 ACC (RW, spellpoint_level_depend); /* spell costs go up with level */ |
238 | char ACC (RW, motd)[MAX_BUF]; /* name of the motd file */ |
220 | char ACC (RW, motd)[MAX_BUF]; /* name of the motd file */ |
239 | char *ACC (RO, rules); /* name of rules file*/ |
221 | const char *ACC (RO, rules); /* name of rules file*/ |
240 | char *ACC (RO, news); /* name of news file*/ |
222 | const char *ACC (RO, news); /* name of news file*/ |
241 | char ACC (RW, dm_mail)[MAX_BUF]; /* DM's Email address */ |
223 | char ACC (RW, dm_mail)[MAX_BUF]; /* DM's Email address */ |
242 | |
224 | |
243 | uint32 ACC (RW, worldmapstartx); /* starting x tile for the worldmap */ |
225 | uint32 ACC (RW, worldmapstartx); /* starting x tile for the worldmap */ |
244 | uint32 ACC (RW, worldmapstarty); /* starting y tile for the worldmap */ |
226 | uint32 ACC (RW, worldmapstarty); /* starting y tile for the worldmap */ |
245 | uint32 ACC (RW, worldmaptilesx); /* number of tiles wide the worldmap is */ |
227 | uint32 ACC (RW, worldmaptilesx); /* number of tiles wide the worldmap is */ |
246 | uint32 ACC (RW, worldmaptilesy); /* number of tiles high the worldmap is */ |
228 | uint32 ACC (RW, worldmaptilesy); /* number of tiles high the worldmap is */ |