1 | /* |
1 | /* |
2 | * static char *rcsid_readable_c = |
2 | * static char *rcsid_readable_c = |
3 | * "$Id: readable.c,v 1.1.1.1 2006/02/03 07:11:40 root Exp $"; |
3 | * "$Id: readable.c,v 1.1.1.2 2006/02/22 18:01:23 elmex Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
98 | |
98 | |
99 | /* special structure, used only by art_name_array[] */ |
99 | /* special structure, used only by art_name_array[] */ |
100 | |
100 | |
101 | typedef struct namebytype |
101 | typedef struct namebytype |
102 | { |
102 | { |
103 | char *name; /* generic name to call artifacts of this type */ |
103 | const char *name; /* generic name to call artifacts of this type */ |
104 | int type; /* matching type */ |
104 | int type; /* matching type */ |
105 | } |
105 | } |
106 | arttypename; |
106 | arttypename; |
107 | |
107 | |
108 | |
108 | |
… | |
… | |
152 | PATH_WOUNDING, |
152 | PATH_WOUNDING, |
153 | PATH_DEATH, |
153 | PATH_DEATH, |
154 | PATH_LIGHT |
154 | PATH_LIGHT |
155 | }; |
155 | }; |
156 | |
156 | |
157 | static char *path_book_name[] = |
157 | static const char* const path_book_name[] = |
158 | { |
158 | { |
159 | "codex", |
159 | "codex", |
160 | "compendium", |
160 | "compendium", |
161 | "exposition", |
161 | "exposition", |
162 | "tables", |
162 | "tables", |
163 | "treatise" |
163 | "treatise" |
164 | }; |
164 | }; |
165 | |
165 | |
166 | /* used by spellpath texts */ |
166 | /* used by spellpath texts */ |
167 | static char *path_author[] = |
167 | static const char* const path_author[] = |
168 | { |
168 | { |
169 | "aether", |
169 | "aether", |
170 | "astral byways", |
170 | "astral byways", |
171 | "connections", |
171 | "connections", |
172 | "the Grey Council", |
172 | "the Grey Council", |
… | |
… | |
207 | {"Artifact", SKILL}, |
207 | {"Artifact", SKILL}, |
208 | {"Food", FOOD}, |
208 | {"Food", FOOD}, |
209 | {"Body Armour", ARMOUR} |
209 | {"Body Armour", ARMOUR} |
210 | }; |
210 | }; |
211 | |
211 | |
212 | static char *art_book_name[] = |
212 | static const char* const art_book_name[] = |
213 | { |
213 | { |
214 | "collection", |
214 | "collection", |
215 | "file", |
215 | "file", |
216 | "files", |
216 | "files", |
217 | "guide", |
217 | "guide", |
… | |
… | |
223 | "record", |
223 | "record", |
224 | "record book" |
224 | "record book" |
225 | }; |
225 | }; |
226 | |
226 | |
227 | /* used by artifact texts */ |
227 | /* used by artifact texts */ |
228 | static char *art_author[] = |
228 | static const char* const art_author[] = |
229 | { |
229 | { |
230 | "ancient things", |
230 | "ancient things", |
231 | "artifacts", |
231 | "artifacts", |
232 | "Havlor", /* ancient warrior scribe :) */ |
232 | "Havlor", /* ancient warrior scribe :) */ |
233 | "items", |
233 | "items", |
… | |
… | |
238 | |
238 | |
239 | /* |
239 | /* |
240 | * Monster book information |
240 | * Monster book information |
241 | */ |
241 | */ |
242 | |
242 | |
243 | static char *mon_book_name[] = |
243 | static const char* const mon_book_name[] = |
244 | { |
244 | { |
245 | "beastuary", |
245 | "beastuary", |
246 | "catalog", |
246 | "catalog", |
247 | "compilation", |
247 | "compilation", |
248 | "collection", |
248 | "collection", |
… | |
… | |
257 | "volume" |
257 | "volume" |
258 | }; |
258 | }; |
259 | |
259 | |
260 | |
260 | |
261 | /* used by monster beastuary texts */ |
261 | /* used by monster beastuary texts */ |
262 | static char *mon_author[] = |
262 | static const char* const mon_author[] = |
263 | { |
263 | { |
264 | "beasts", |
264 | "beasts", |
265 | "creatures", |
265 | "creatures", |
266 | "dezidens", |
266 | "dezidens", |
267 | "dwellers", |
267 | "dwellers", |
… | |
… | |
278 | |
278 | |
279 | /* |
279 | /* |
280 | * God book information |
280 | * God book information |
281 | */ |
281 | */ |
282 | |
282 | |
283 | static char *gods_book_name[] = |
283 | static const char* const gods_book_name[] = |
284 | { |
284 | { |
285 | "devotional", |
285 | "devotional", |
286 | "devout notes", |
286 | "devout notes", |
287 | "divine text", |
287 | "divine text", |
288 | "divine work", |
288 | "divine work", |
… | |
… | |
293 | "testament", |
293 | "testament", |
294 | "transcript" |
294 | "transcript" |
295 | }; |
295 | }; |
296 | |
296 | |
297 | /* used by gods texts */ |
297 | /* used by gods texts */ |
298 | static char *gods_author[] = |
298 | static const char* const gods_author[] = |
299 | { |
299 | { |
300 | "cults", |
300 | "cults", |
301 | "joy", |
301 | "joy", |
302 | "lasting curse", |
302 | "lasting curse", |
303 | "madness", |
303 | "madness", |
… | |
… | |
314 | |
314 | |
315 | /* |
315 | /* |
316 | * Alchemy (formula) information |
316 | * Alchemy (formula) information |
317 | */ |
317 | */ |
318 | |
318 | |
319 | static char *formula_book_name[] = |
319 | static const char* const formula_book_name[] = |
320 | { |
320 | { |
321 | "cookbook", |
321 | "cookbook", |
322 | "formulary", |
322 | "formulary", |
323 | "lab book", |
323 | "lab book", |
324 | "lab notes", |
324 | "lab notes", |
… | |
… | |
327 | "work plan", |
327 | "work plan", |
328 | "design notes" |
328 | "design notes" |
329 | }; |
329 | }; |
330 | |
330 | |
331 | /* this isn't used except for empty books */ |
331 | /* this isn't used except for empty books */ |
332 | static char *formula_author[] = |
332 | static const char* const formula_author[] = |
333 | { |
333 | { |
334 | "Albertus Magnus", |
334 | "Albertus Magnus", |
335 | "alchemy", |
335 | "alchemy", |
336 | "balms", |
336 | "balms", |
337 | "creation", |
337 | "creation", |
… | |
… | |
350 | /* |
350 | /* |
351 | * Generic book information |
351 | * Generic book information |
352 | */ |
352 | */ |
353 | |
353 | |
354 | /* used by msg file and 'generic' books */ |
354 | /* used by msg file and 'generic' books */ |
355 | static char *light_book_name[] = |
355 | static const char* const light_book_name[] = |
356 | { |
356 | { |
357 | "calendar", |
357 | "calendar", |
358 | "datebook", |
358 | "datebook", |
359 | "diary", |
359 | "diary", |
360 | "guidebook", |
360 | "guidebook", |
… | |
… | |
367 | "practicum", |
367 | "practicum", |
368 | "script", |
368 | "script", |
369 | "transcript" |
369 | "transcript" |
370 | }; |
370 | }; |
371 | |
371 | |
372 | static char *heavy_book_name[] = |
372 | static const char* const heavy_book_name[] = |
373 | { |
373 | { |
374 | "catalog", |
374 | "catalog", |
375 | "compendium", |
375 | "compendium", |
376 | "guide", |
376 | "guide", |
377 | "manual", |
377 | "manual", |
… | |
… | |
382 | "work" |
382 | "work" |
383 | }; |
383 | }; |
384 | |
384 | |
385 | |
385 | |
386 | /* used by 'generic' books */ |
386 | /* used by 'generic' books */ |
387 | static char *book_author[] = |
387 | static const char* const book_author[] = |
388 | { |
388 | { |
389 | "Abdulah", |
389 | "Abdulah", |
390 | "Al'hezred", |
390 | "Al'hezred", |
391 | "Alywn", |
391 | "Alywn", |
392 | "Arundel", |
392 | "Arundel", |
… | |
… | |
428 | "Xeno", |
428 | "Xeno", |
429 | "Zardoz", |
429 | "Zardoz", |
430 | "Zagy" |
430 | "Zagy" |
431 | }; |
431 | }; |
432 | |
432 | |
433 | static char *book_descrpt[] = |
433 | static const char* const book_descrpt[] = |
434 | { |
434 | { |
435 | "ancient", |
435 | "ancient", |
436 | "cryptic", |
436 | "cryptic", |
437 | "cryptical", |
437 | "cryptical", |
438 | "dusty", |
438 | "dusty", |
… | |
… | |
893 | /* find_title() - Search the titlelist (based on msgtype) to see if |
893 | /* find_title() - Search the titlelist (based on msgtype) to see if |
894 | * book matches something already there. IF so, return that title. |
894 | * book matches something already there. IF so, return that title. |
895 | */ |
895 | */ |
896 | |
896 | |
897 | static title * |
897 | static title * |
898 | find_title (object *book, int msgtype) |
898 | find_title (const object *book, int msgtype) |
899 | { |
899 | { |
900 | title *t = NULL; |
900 | title *t = NULL; |
901 | titlelist *tl = get_titlelist (msgtype); |
901 | titlelist *tl = get_titlelist (msgtype); |
902 | int length = strlen (book->msg); |
902 | int length = strlen (book->msg); |
903 | int index = strtoint (book->msg); |
903 | int index = strtoint (book->msg); |
… | |
… | |
1027 | * go through the entire list of possibilities each time. If we find |
1027 | * go through the entire list of possibilities each time. If we find |
1028 | * a match, then unique_book returns true (because inst unique). |
1028 | * a match, then unique_book returns true (because inst unique). |
1029 | */ |
1029 | */ |
1030 | |
1030 | |
1031 | static int |
1031 | static int |
1032 | unique_book (object *book, int msgtype) |
1032 | unique_book (const object *book, int msgtype) |
1033 | { |
1033 | { |
1034 | title *test; |
1034 | title *test; |
1035 | |
1035 | |
1036 | if (!booklist) |
1036 | if (!booklist) |
1037 | return 1; /* No archival entries! Must be unique! */ |
1037 | return 1; /* No archival entries! Must be unique! */ |
… | |
… | |
1047 | } |
1047 | } |
1048 | |
1048 | |
1049 | /* add_book_to_list() */ |
1049 | /* add_book_to_list() */ |
1050 | |
1050 | |
1051 | static void |
1051 | static void |
1052 | add_book_to_list (object *book, int msgtype) |
1052 | add_book_to_list (const object *book, int msgtype) |
1053 | { |
1053 | { |
1054 | titlelist *tl = get_titlelist (msgtype); |
1054 | titlelist *tl = get_titlelist (msgtype); |
1055 | title *t; |
1055 | title *t; |
1056 | |
1056 | |
1057 | if (!tl) |
1057 | if (!tl) |
… | |
… | |
1309 | * Returns a description of the monster. This really needs to be |
1309 | * Returns a description of the monster. This really needs to be |
1310 | * redone, as describe_item really gives a pretty internal description. |
1310 | * redone, as describe_item really gives a pretty internal description. |
1311 | */ |
1311 | */ |
1312 | |
1312 | |
1313 | char * |
1313 | char * |
1314 | mon_desc (object *mon) |
1314 | mon_desc (const object *mon) |
1315 | { |
1315 | { |
1316 | static char retbuf[HUGE_BUF]; |
1316 | static char retbuf[HUGE_BUF]; |
1317 | |
1317 | |
1318 | sprintf (retbuf, " *** %s ***\n", mon->name); |
1318 | sprintf (retbuf, " *** %s ***\n", mon->name); |
1319 | strcat (retbuf, describe_item(mon, NULL)); |
1319 | strcat (retbuf, describe_item(mon, NULL)); |