Crossfire Server, Branches 1.12  R18729
bwp.c
Go to the documentation of this file.
1 /*
2  * bwp - build wiki pages
3  *
4  * This program will sort out all monster archetypes and print wiki pages
5  * for them, named 'a' through 'z'. It uses some *_template subroutines taken
6  * from Ryo's mapper.c. It should compile if installed in server/trunk/utils.
7  * Please direct all suggestions or corrections to aaron@baugher.biz (or
8  * Mhoram on #crossfire).
9  *
10  * Compile command: gcc -g -O0 bwp.c -I../include ../common/libcross.a ../socket/libsocket.a -o bwp -lz -lcrypt -lm
11  */
12 
13 /*
14  * CrossFire, A Multiplayer game for X-windows
15  *
16  * Copyright (C) 2002-2006 Mark Wedel & Crossfire Development Team
17  * Copyright (C) 1992 Frank Tore Johansen
18  *
19  * This program is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 2 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program; if not, write to the Free Software
31  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32  *
33  * The authors can be reached via e-mail at crossfire-devel@real-time.com
34  */
35 
36 #define LO_NEWFILE 2
37 #define MAX_SIZE 64
38 #define NA "n/a"
39 
40 #include <time.h>
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <global.h>
44 
45 char *monster_page_head; /* Head of wiki page of monsters */
46 char *monster_page_foot; /* Foot of wiki page of monsters */
47 char *monster_entry; /* A single monster entry */
48 char *monster_canuse_row; /* Can_use table row */
49 char *monster_protected_row; /* Protected table row */
50 char *monster_vulnerable_row; /* Vulnerable table row */
51 char *monster_special_row; /* Special table row */
52 char *monster_attack_row; /* Attack types table row */
53 char *monster_lore_row; /* Lore table row */
54 
55 typedef struct string_array {
57  char **item;
58 } String_Array;
59 
69 const char *const flag_names[NUM_FLAGS+1] = {
70  "alive", "wiz", NULL, NULL, "was_wiz", "applied", "unpaid",
71  "can_use_shield", "no_pick", "client_anim_sync", "client_anim_random", /* 10 */
72  "is_animated", NULL /* slow_move */,
73  NULL /* flying */, "monster", "friendly", "generator",
74  "is_thrown", "auto_apply", "treasure", "player sold", /* 20 */
75  "see_invisible", "can_roll", "overlay_floor",
76  "is_turnable", NULL /* walk_off */, NULL /* fly_on */,
77  NULL /*fly_off*/, "is_used_up", "identified", "reflecting", /* 30 */
78  "changing", "splitting", "hitback", "startequip",
79  "blocksview", "undead", "scared", "unaggressive",
80  "reflect_missile", "reflect_spell", /* 40 */
81  "no_magic", "no_fix_player", "is_lightable", "tear_down",
82  "run_away", NULL /*pass_thru */, NULL /*can_pass_thru*/,
83  "pick_up", "unique", "no_drop", /* 50 */
84  NULL /* wizcast*/, "can_cast_spell", "can_use_scroll", "can_use_range",
85  "can_use_bow", "can_use_armour", "can_use_weapon",
86  "can_use_ring", "has_ready_range", "has_ready_bow", /* 60 */
87  "xrays", NULL, "is_floor", "lifesave", "no_strength", "sleep",
88  "stand_still", "random_movement", "only_attack", "confused", /* 70 */
89  "stealth", NULL, NULL, "cursed", "damned",
90  "see_anywhere", "known_magical", "known_cursed",
91  "can_use_skill", "been_applied", /* 80 */
92  "has_ready_scroll", "can_use_rod", NULL,
93  "can_use_horn", "make_invisible", "inv_locked", "is_wooded",
94  "is_hilly", "has_ready_skill", "has_ready_weapon", /* 90 */
95  "no_skill_ident", "is_blind", "can_see_in_dark", "is_cauldron",
96  "is_dust", "no_steal", "one_hit", NULL, "berserk", "neutral", /* 100 */
97  "no_attack", "no_damage", NULL, NULL, "activate_on_push",
98  "activate_on_release", "is_water", "use_content_on_gen", NULL, "is_buildable", /* 110 */
99  NULL, "blessed", "known_blessed"
100 };
101 
112 static char *cat_template(char *source, char *add) {
113  if (!source)
114  return add;
115  source = realloc(source, strlen(source)+strlen(add)+1);
116  strcat(source, add);
117  free(add);
118  return source;
119 }
120 
131 static int read_template(const char *name, char **buffer) {
132  FILE *file;
133  size_t size;
134  struct stat info;
135 
136  if (stat(name, &info)) {
137  printf("Couldn't stat template %s!\n", name);
138  return 1;
139  }
140 
141  (*buffer) = calloc(1, info.st_size+1);
142  if (!(*buffer)) {
143  printf("Template %s calloc failed!\n", name);
144  return 1;
145  }
146 
147  if (info.st_size == 0) {
148  (*buffer)[0] = '\0';
149  return 0;
150  }
151 
152  file = fopen(name, "rb");
153  if (!file) {
154  printf("Couldn't open template %s!\n", name);
155  free(*buffer);
156  return 1;
157  }
158  if (fread(*buffer, info.st_size, 1, file) != 1) {
159  printf("Couldn't read template %s!\n", name);
160  free(*buffer);
161  fclose(file);
162  return 1;
163  }
164  fclose(file);
165  return 0;
166 }
167 
185 static char *do_template(const char *template, const char **vars, const char **values) {
186  int count = 0;
187  const char *sharp = template;
188  int maxlen = 0;
189  int var = 0;
190  char *result;
191  char *current_result;
192  const char *end;
193 
194  while ((sharp = strchr(sharp, '#')) != NULL) {
195  sharp++;
196  count++;
197  }
198  if (!count)
199  return strdup(template);
200  if (count%2) {
201  printf("Malformed template, mismatched #!\n");
202  return strdup(template);
203  }
204 
205  while (vars[var] != NULL) {
206  if (strlen(values[var]) > maxlen)
207  maxlen = strlen(values[var]);
208  var++;
209  }
210  result = calloc(1, strlen(template)+maxlen*(count/2)+1);
211  if (!result)
212  return NULL;
213  current_result = result;
214 
215  sharp = template;
216  while ((sharp = strchr(sharp, '#')) != NULL) {
217  end = strchr(sharp+1, '#');
218  strncpy(current_result, template, sharp-template);
219  if (end == sharp+1) {
220  strcat(current_result, "#");
221  } else {
222  current_result = current_result+strlen(current_result);
223  var = 0;
224  while (vars[var] != 0 && strncmp(vars[var], sharp+1, end-sharp-1))
225  var++;
226  if (vars[var] == 0)
227  printf("Wrong tag: %s\n", sharp);
228  else
229  strcpy(current_result, values[var]);
230  }
231  current_result = current_result+strlen(current_result);
232  sharp = end+1;
233  template = sharp;
234  }
235  strcat(current_result, template);
236  return result;
237 }
238 
239 /**** Mhoram's code starts here *****/
240 
253 static void free_if_used(char *p) {
254  if (p && strlen(p) > 0) {
255  free(p);
256  }
257 }
258 
271 static int sortbyname(const void *a, const void *b) {
272  return (strcasecmp(*(const char **)a, *(const char **)b));
273 }
274 
288 static int sort_archetypes(const void *a, const void *b) {
289  archetype *aa;
290  archetype *bb;
291 
292  aa = *(archetype **)a;
293  bb = *(archetype **)b;
294 
295  return (strcasecmp(aa->clone.name, bb->clone.name));
296 }
297 
310 void push(String_Array *array, const char *string) {
311  sint16 i = array->count;
312 
313  array->item[i] = strdup_local(string);
314  array->count++;
315 }
316 
325 void free_data(String_Array *array) {
326  int item;
327 
328  for (item = 0; item < array->count; item++)
329  free(array->item[item]);
330  free(array->item);
331  array->item = NULL;
332 }
333 
344 const char *join_with_comma(String_Array *array) {
345  char *newtext;
346  int i;
347 
348  newtext = calloc(1, 1);
349  qsort(array->item, array->count, sizeof(char *), sortbyname);
350  for (i = 0; i < array->count; i++) {
351  if (i) {
352  newtext = realloc(newtext, strlen(newtext)+strlen(", ")+1);
353  newtext = strncat(newtext, ", ", 2);
354  }
355  newtext = realloc(newtext, strlen(newtext)+strlen(array->item[i])+1);
356  newtext = strncat(newtext, array->item[i], strlen(array->item[i]));
357  }
358  return newtext;
359 }
360 
361 int main(int argc, char *argv[]) {
362 
363  archetype *at;
364  int archnum = 0;
365  archetype *monster[4000];
366  int i;
367  char letter;
368  char last_letter;
369  char *wiki_page = NULL;
370  char *monster_entries = NULL;
371 
372  FILE *fp = NULL;
373  FILE *image_list;
374  char image_list_path[128];
375  char wikifile[128];
376  char *template;
377 
378  const char *wikidir = "/tmp"; /* Should change this to come from command line? */
379 
380  init_globals();
381  init_library();
382  init_archetypes();
383  init_artifacts();
384  init_formulae();
385  init_readable();
386 
387  init_gods();
388 
389  /* Initialize templates */
390  if (read_template("templates/wiki/monster_page_head", &monster_page_head))
391  return;
392  if (read_template("templates/wiki/monster_page_foot", &monster_page_foot))
393  return;
394  if (read_template("templates/wiki/monster_entry", &monster_entry))
395  return;
396  if (read_template("templates/wiki/monster_canuse_row", &monster_canuse_row))
397  return;
398  if (read_template("templates/wiki/monster_protected_row", &monster_protected_row))
399  return;
400  if (read_template("templates/wiki/monster_vulnerable_row", &monster_vulnerable_row))
401  return;
402  if (read_template("templates/wiki/monster_special_row", &monster_special_row))
403  return;
404  if (read_template("templates/wiki/monster_attack_row", &monster_attack_row))
405  return;
406  if (read_template("templates/wiki/monster_lore_row", &monster_lore_row))
407  return;
408  sprintf(image_list_path, "%s/image_list", wikidir);
409  image_list = fopen(image_list_path, "w");
410  if (!image_list) {
411  LOG(llevError, "Unable to open image list file!\n");
412  exit(1);
413  }
414 
415  /* Pick out the monster archetypes and sort them into an array */
416  for (at = first_archetype; at != NULL; at = at->next) {
417  if (QUERY_FLAG(&at->clone, FLAG_MONSTER)
418  && QUERY_FLAG(&at->clone, FLAG_ALIVE)) {
419  monster[archnum++] = at;
420  }
421  }
422  printf("Sorting...");
423  /* Calling qsort on monster, which is archetype** */
424  qsort(&monster[0], archnum, sizeof(archetype *), sort_archetypes);
425  printf("done. %i items found\n", archnum);
426 
427  last_letter = '\0';
428 
429  for (i = 0; i < archnum; i++) {
430  at = monster[i];
431  if (at) {
432  const char *key[16] = { NULL, };
433  const char *val[16] = { NULL, };
434  char buf[16][MAX_BUF];
435  int keycount = 0;
436  int res;
437 
438  letter = tolower(at->clone.name[0]);
439 
440  LOG(llevInfo, "Doing archetype %s\n", at->name);
441 
442  if (letter != last_letter) { /* New letter, new file */
443  if (fp) {
444  keycount = 0;
445  key[keycount] = NULL;
446  template = do_template(monster_page_foot, key, val);
447  res = fprintf(fp, "%s", template);
448  free(template);
449  template = NULL;
450  if (res < 0) {
451  LOG(llevError, "Unable to write to file!\n");
452  }
453  fclose(fp);
454  }
455 
456  snprintf(wikifile, sizeof(wikifile), "%s/%c", wikidir, letter);
457  fp = fopen(wikifile, "w");
458  if (!fp) {
459  fprintf(stderr, "Unable to write to wiki file!\n");
460  exit(1);
461  }
462 
463  char letterindex[256] = "";
464  char letterindexnext[7];
465  char li;
466  letterindexnext[0] = '\0';
467  for (li = 'a'; li <= 'z'; li++) {
468  if (li == letter) {
469  sprintf(letterindexnext, "%c ", toupper(li));
470  } else {
471  sprintf(letterindexnext, "[[%c]] ", toupper(li));
472  }
473  strncat(letterindex, letterindexnext, 256);
474  }
475 
476  keycount = 0;
477  key[keycount] = "LETTER";
478  sprintf(buf[keycount], "%c", toupper(letter));
479  val[keycount++] = buf[keycount];
480  key[keycount] = "LETTERINDEX";
481  val[keycount++] = letterindex;
482  key[keycount] = NULL;
483  template = do_template(monster_page_head, key, val);
484  res = fprintf(fp, template);
485  free(template);
486  if (res < 0) {
487  LOG(llevError, "Unable to write to file!");
488  }
489  last_letter = letter;
490  }
491 
492  /* add a monster entry */
493  char *canuse_row;
494  char *protected_row;
495  char *vulnerable_row;
496  char *special_row;
497  char *attack_row;
498  char *lore_row;
499  const int CANUSE_LENGTH = 16;
500  String_Array canuse;
501  String_Array resist;
502  String_Array vulner;
503  String_Array attack;
504  String_Array special;
505  /* Some flags that seemed useful; may need to add to this list.
506  * *special_names[] is used because some of the names in
507  * define.h are a bit awkward. Last one is negative to mark end.
508  */
509  const sint8 special_flags[] = { 21, 93, 52, 38, 13, 32, 61, -1 };
510  const char *special_names[] = {
511  "see invisible",
512  "see in dark",
513  "spellcaster",
514  "unaggressive",
515  "flying",
516  "splitting",
517  "x-ray vision"
518  };
519  int j;
520 
521  canuse.item = calloc(1, sizeof(const char *)*(CANUSE_LENGTH+1));
522  resist.item = calloc(1, sizeof(const char *)*(NROFATTACKS+1));
523  vulner.item = calloc(1, sizeof(const char *)*(NROFATTACKS+1));
524  attack.item = calloc(1, sizeof(const char *)*(NROFATTACKS+1));
525  special.item = calloc(1, sizeof(const char *)*(NROFATTACKS+1));
526 
527  /* Do lore row */
528  if (at->clone.lore) {
529  key[keycount] = "LORE";
530  key[keycount+1] = NULL;
531  val[keycount] = at->clone.lore;
532  keycount++;
533  lore_row = do_template(monster_lore_row, key, val);
534  } else
535  lore_row = strdup("");
536 
537  /* Do canuse row */
538  canuse.count = 0;
539  keycount = 0;
540  for (j = 1; j <= NUM_FLAGS; j++) {
541  if (QUERY_FLAG(&at->clone, j)
542  && flag_names[j]
543  && !strncmp(flag_names[j], "can_use_", 8)) {
544  push(&canuse, flag_names[j]+8);
545  }
546  }
547  if (canuse.count) {
548  key[keycount] = "CANUSE";
549  key[keycount+1] = NULL;
550  val[keycount] = join_with_comma(&canuse);
551  canuse_row = do_template(monster_canuse_row, key, val);
552  free(val[keycount]);
553  } else
554  canuse_row = strdup("");
555 
556  /* Do protected/vulnerable rows */
557  resist.count = 0;
558  vulner.count = 0;
559  for (j = 0; j <= NROFATTACKS; j++) {
560  if (at->clone.resist[j] && attacktype_desc[j]) {
561  char rowtext[32];
562 
563  if (at->clone.resist[j] < 0) {
564  sprintf(rowtext, "%s %i", attacktype_desc[j], at->clone.resist[j]);
565  push(&vulner, rowtext);
566  } else {
567  sprintf(rowtext, "%s +%i", attacktype_desc[j], at->clone.resist[j]);
568  push(&resist, rowtext);
569  }
570  }
571  }
572  keycount = 0;
573  if (resist.count) {
574  key[keycount] = "PROTECTED";
575  key[keycount+1] = NULL;
576  val[keycount] = join_with_comma(&resist);
577  protected_row = do_template(monster_protected_row, key, val);
578  free(val[keycount]);
579  } else
580  protected_row = strdup("");
581 
582  keycount = 0;
583  if (vulner.count) {
584  key[keycount] = "VULNERABLE";
585  key[keycount+1] = NULL;
586  val[keycount] = join_with_comma(&vulner);
587  vulnerable_row = do_template(monster_vulnerable_row, key, val);
588  free(val[keycount]);
589  } else
590  vulnerable_row = strdup("");
591 
592  /* Do attacktype row */
593  attack.count = 0;
594  keycount = 0;
595  val[keycount] = NULL;
596  for (j = 0; j <= NROFATTACKS; j++) {
597  if (at->clone.attacktype&(1U<<j)) {
598  push(&attack, attacktype_desc[j]);
599  }
600  }
601  if (attack.count) {
602  key[keycount] = "ATTACKS";
603  key[keycount+1] = NULL;
604  val[keycount] = join_with_comma(&attack);
605  attack_row = do_template(monster_attack_row, key, val);
606  free(val[keycount]);
607  } else
608  attack_row = strdup("");
609 
610  /* Do special row */
611  special.count = 0;
612  keycount = 0;
613  val[keycount] = NULL;
614  for (j = 0; special_flags[j] >= 0; j++) {
615  if (QUERY_FLAG(&at->clone, special_flags[j])) {
616  push(&special, special_names[j]);
617  }
618  }
619  if (special.count) {
620  key[keycount] = "SPECIAL";
621  key[keycount+1] = NULL;
622  val[keycount] = join_with_comma(&special);
623  special_row = do_template(monster_special_row, key, val);
624  free(val[keycount]);
625  } else
626  special_row = strdup("");
627 
628  keycount = 0;
629  key[keycount] = "CANUSEROW";
630  val[keycount++] = canuse_row;
631  key[keycount] = "PROTECTEDROW";
632  val[keycount++] = protected_row;
633  key[keycount] = "VULNERABLEROW";
634  val[keycount++] = vulnerable_row;
635  key[keycount] = "SPECIALROW";
636  val[keycount++] = attack_row;
637  key[keycount] = "ATTACKROW";
638  val[keycount++] = special_row;
639  key[keycount] = "LOREROW";
640  val[keycount++] = lore_row;
641  key[keycount] = "XP";
642  sprintf(buf[keycount], "%li", at->clone.stats.exp);
643  val[keycount++] = buf[keycount];
644  key[keycount] = "HP";
645  sprintf(buf[keycount], "%i", at->clone.stats.hp);
646  val[keycount++] = buf[keycount];
647  key[keycount] = "AC";
648  sprintf(buf[keycount], "%i", at->clone.stats.ac);
649  val[keycount++] = buf[keycount];
650  key[keycount] = "NAME";
651  val[keycount++] = at->clone.name;
652  key[keycount] = "RACE";
653  if (at->clone.race) {
654  val[keycount++] = at->clone.race;
655  } else {
656  val[keycount++] = NA;
657  }
658  if (at->clone.face->name) {
659  key[keycount] = "FACE";
660  sprintf(buf[keycount], "{{http://aaron.baugher.biz/images/cf/%s.png}}", at->clone.face->name);
661  val[keycount++] = buf[keycount];
662  sprintf(buf[keycount], "%s.png\n", at->clone.face->name);
663  fprintf(image_list, buf[keycount]);
664  }
665 /* Plan to add generator face too, when I decide how */
666  key[keycount] = "GENFACE";
667  val[keycount++] = "";
668  key[keycount] = NULL;
669 
670  template = do_template(monster_entry, key, val);
671  fprintf(fp, template);
672  free(template);
673  template = NULL;
674 
675  free_data(&canuse);
676  free_data(&resist);
677  free_data(&vulner);
678  free_data(&attack);
679  free_data(&special);
680  free(canuse_row);
681  free(protected_row);
682  free(vulnerable_row);
683  free(attack_row);
684  free(special_row);
685  free(lore_row);
686  } else {
687  LOG(llevError, "Something is very wrong.\n");
688  }
689  }
690  fclose(image_list);
691 }
692 
693 void set_map_timeout(void) {
694  /* doesn't need to do anything */
695 }
696 
697 #include <global.h>
698 
699 /* some plagarized code from apply.c--I needed just these two functions
700  without all the rest of the junk, so.... */
701 int auto_apply(object *op) {
702  object *tmp = NULL;
703  int i;
704 
705  switch (op->type) {
706  case SHOP_FLOOR:
707  if (!HAS_RANDOM_ITEMS(op))
708  return 0;
709  do {
710  i = 10; /* let's give it 10 tries */
711  while ((tmp = generate_treasure(op->randomitems, op->stats.exp ? op->stats.exp : 5)) == NULL && --i)
712  ;
713  if (tmp == NULL)
714  return 0;
715  if (QUERY_FLAG(tmp, FLAG_CURSED) || QUERY_FLAG(tmp, FLAG_DAMNED)) {
716  free_object(tmp);
717  tmp = NULL;
718  }
719  } while (!tmp);
720 
721  tmp->x = op->x,
722  tmp->y = op->y;
723  SET_FLAG(tmp, FLAG_UNPAID);
724  insert_ob_in_map(tmp, op->map, NULL, 0);
726  identify(tmp);
727  break;
728 
729  case TREASURE:
730  if (HAS_RANDOM_ITEMS(op))
731  while ((op->stats.hp--) > 0)
732  create_treasure(op->randomitems, op, GT_ENVIRONMENT, op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0);
733  remove_ob(op);
734  free_object(op);
735  break;
736  }
737 
738  return tmp ? 1 : 0;
739 }
740 
741 /* fix_auto_apply goes through the entire map (only the first time
742  * when an original map is loaded) and performs special actions for
743  * certain objects (most initialization of chests and creation of
744  * treasures and stuff). Calls auto_apply if appropriate.
745  */
747  object *tmp, *above = NULL;
748  int x, y;
749 
750  for (x = 0; x < MAP_WIDTH(m); x++)
751  for (y = 0; y < MAP_HEIGHT(m); y++)
752  for (tmp = GET_MAP_OB(m, x, y); tmp != NULL; tmp = above) {
753  above = tmp->above;
754 
755  if (QUERY_FLAG(tmp, FLAG_AUTO_APPLY))
756  auto_apply(tmp);
757  else if (tmp->type == TREASURE) {
758  if (HAS_RANDOM_ITEMS(tmp))
759  while ((tmp->stats.hp--) > 0)
760  create_treasure(tmp->randomitems, tmp, 0, m->difficulty, 0);
761  }
762  if (tmp
763  && tmp->arch
764  && tmp->type != PLAYER
765  && tmp->type != TREASURE
766  && tmp->randomitems) {
767  if (tmp->type == CONTAINER) {
768  if (HAS_RANDOM_ITEMS(tmp))
769  while ((tmp->stats.hp--) > 0)
770  create_treasure(tmp->randomitems, tmp, 0, m->difficulty, 0);
771  } else if (HAS_RANDOM_ITEMS(tmp))
772  create_treasure(tmp->randomitems, tmp, GT_APPLY, m->difficulty, 0);
773  }
774  }
775  for (x = 0; x < MAP_WIDTH(m); x++)
776  for (y = 0; y < MAP_HEIGHT(m); y++)
777  for (tmp = GET_MAP_OB(m, x, y); tmp != NULL; tmp = tmp->above)
778  if (tmp->above
779  && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL))
780  check_trigger(tmp, tmp->above);
781 }
782 
783 #ifndef DOXYGEN_SHOULD_SKIP_THIS
784 
790 void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *txt, const char *txt2) {
791  fprintf(logfile, "%s\n", txt);
792 }
793 
794 void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format, ...) {
795  va_list ap;
796  va_start(ap, old_format);
797  vfprintf(logfile, old_format, ap);
798  va_end(ap);
799 }
800 
801 void ext_info_map(int color, const mapstruct *map, uint8 type, uint8 subtype, const char *str1, const char *str2) {
802  fprintf(logfile, "ext_info_map: %s\n", str2);
803 }
804 
805 void move_firewall(object *ob) {
806 }
807 
808 void emergency_save(int x) {
809 }
810 
811 void clean_tmp_files(void) {
812 }
813 
814 void esrv_send_item(object *ob, object *obx) {
815 }
816 
817 void dragon_ability_gain(object *ob, int x, int y) {
818 }
819 
821 }
822 
823 object *find_skill_by_number(object *who, int skillno) {
824  return NULL;
825 }
826 
827 void esrv_del_item(player *pl, int tag) {
828 }
829 
831 }
832 
833 void monster_check_apply(object *ob, object *obt) {
834 }
835 
836 void trap_adjust(object *ob, int x) {
837 }
838 
839 int execute_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix) {
840  return 0;
841 }
842 
843 int execute_global_event(int eventcode, ...) {
844  return 0;
845 }
846 #endif /* dummy DOXYGEN_SHOULD_SKIP_THIS */
EXTERN FILE * logfile
Definition: global.h:220
char * monster_page_foot
Definition: bwp.c:46
signed char sint8
Definition: global.h:80
Definition: player.h:146
void set_darkness_map(mapstruct *m)
Definition: bwp.c:820
#define FLAG_DAMNED
Definition: define.h:614
#define FLAG_UNPAID
Definition: define.h:532
sint8 ac
Definition: living.h:79
void move_firewall(object *ob)
Definition: bwp.c:805
signed short sint16
Definition: global.h:72
void dragon_ability_gain(object *ob, int x, int y)
Definition: bwp.c:817
void set_map_timeout(void)
Definition: bwp.c:693
const char * race
Definition: object.h:171
#define SET_FLAG(xyz, p)
Definition: define.h:510
static int read_template(const char *name, char **buffer)
Definition: bwp.c:131
void fix_auto_apply(mapstruct *m)
Definition: bwp.c:746
#define NA
Definition: bwp.c:38
struct treasureliststruct * randomitems
Definition: object.h:236
char * monster_attack_row
Definition: bwp.c:52
const char *const flag_names[NUM_FLAGS+1]
Definition: bwp.c:69
#define MAP_HEIGHT(m)
Definition: map.h:99
object clone
Definition: object.h:326
char * monster_entry
Definition: bwp.c:47
void init_archetypes(void)
Definition: arch.c:195
void init_globals(void)
Definition: init.c:263
int execute_global_event(int eventcode,...)
Definition: bwp.c:843
sint64 exp
Definition: living.h:88
struct obj * above
Definition: object.h:146
void init_library(void)
Definition: init.c:201
sint16 x
Definition: object.h:179
void esrv_update_spells(player *pl)
Definition: bwp.c:830
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
Definition: bwp.c:794
Definition: object.h:321
#define PLAYER
Definition: define.h:113
sint16 hp
Definition: living.h:81
void esrv_del_item(player *pl, int tag)
Definition: bwp.c:827
void init_formulae(void)
Definition: recipe.c:159
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
Definition: treasure.c:499
void free_data(String_Array *array)
Definition: bwp.c:325
const char * lore
Definition: object.h:176
const char * name
Definition: face.h:48
void remove_ob(object *op)
Definition: object.c:1515
#define SHOP_FLOOR
Definition: define.h:230
#define FLAG_ALIVE
Definition: define.h:526
struct mapdef * map
Definition: object.h:155
static int sort_archetypes(const void *a, const void *b)
Definition: bwp.c:288
const char * join_with_comma(String_Array *array)
Definition: bwp.c:344
void identify(object *op)
Definition: item.c:1447
char * monster_protected_row
Definition: bwp.c:49
char ** item
Definition: bwp.c:57
const char * name
Definition: object.h:167
void trap_adjust(object *ob, int x)
Definition: bwp.c:836
static char * cat_template(char *source, char *add)
Definition: bwp.c:112
uint16 difficulty
Definition: map.h:364
#define NUM_FLAGS
Definition: define.h:676
unsigned char uint8
Definition: global.h:75
sint16 count
Definition: bwp.c:56
int auto_apply(object *op)
Definition: bwp.c:701
sint16 y
Definition: object.h:179
char * monster_canuse_row
Definition: bwp.c:48
#define TRIGGER_PEDESTAL
Definition: define.h:144
#define QUERY_FLAG(xyz, p)
Definition: define.h:514
#define CLEAR_FLAG(xyz, p)
Definition: define.h:512
char * strdup_local(const char *str)
Definition: porting.c:310
void esrv_send_item(object *ob, object *obx)
Definition: bwp.c:814
EXTERN const char *const attacktype_desc[NROFATTACKS]
Definition: attack.h:165
#define TRIGGER_BUTTON
Definition: define.h:142
void init_readable(void)
Definition: readable.c:952
void monster_check_apply(object *ob, object *obt)
Definition: bwp.c:833
#define MAX_BUF
Definition: define.h:81
object * find_skill_by_number(object *who, int skillno)
Definition: bwp.c:823
object * insert_ob_in_map(object *op, mapstruct *m, object *originator, int flag)
Definition: object.c:1992
char * monster_lore_row
Definition: bwp.c:53
int main(int argc, char *argv[])
Definition: bwp.c:361
#define tolower(C)
Definition: c_new.c:42
static const flag_definition flags[]
sint16 resist[NROFATTACKS]
Definition: object.h:192
int execute_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
Definition: bwp.c:839
#define FLAG_CURSED
Definition: define.h:613
int snprintf(char *dest, int max, const char *format,...)
Definition: porting.c:498
struct string_array String_Array
#define FLAG_AUTO_APPLY
Definition: define.h:546
uint32 attacktype
Definition: object.h:193
void emergency_save(int x)
Definition: bwp.c:808
#define CONTAINER
Definition: define.h:306
char * monster_vulnerable_row
Definition: bwp.c:50
void clean_tmp_files(void)
Definition: bwp.c:811
living stats
Definition: object.h:219
struct archt * arch
Definition: object.h:263
#define MAP_WIDTH(m)
Definition: map.h:97
struct archt * next
Definition: object.h:323
#define NROFATTACKS
Definition: attack.h:45
static void free_if_used(char *p)
Definition: bwp.c:253
void init_gods(void)
Definition: holy.c:63
void ext_info_map(int color, const mapstruct *map, uint8 type, uint8 subtype, const char *str1, const char *str2)
Definition: bwp.c:801
#define GET_MAP_OB(M, X, Y)
Definition: map.h:193
int strcasecmp(const char *s1, const char *s2)
Definition: porting.c:434
#define FLAG_MONSTER
Definition: define.h:541
#define TREASURE
Definition: define.h:116
char * monster_special_row
Definition: bwp.c:51
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.c:63
static int sortbyname(const void *a, const void *b)
Definition: bwp.c:271
int check_trigger(object *op, object *cause)
Definition: button.c:525
object * generate_treasure(treasurelist *t, int difficulty)
Definition: treasure.c:524
void free_object(object *ob)
Definition: object.c:1238
Definition: map.h:346
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *txt, const char *txt2)
Definition: bwp.c:790
New_Face * face
Definition: object.h:183
static char * do_template(const char *template, const char **vars, const char **values)
Definition: bwp.c:185
void push(String_Array *array, const char *string)
Definition: bwp.c:310
EXTERN archetype * first_archetype
Definition: global.h:195
char * monster_page_head
Definition: bwp.c:45
const char * name
Definition: object.h:322
#define HAS_RANDOM_ITEMS(op)
Definition: define.h:470
uint8 type
Definition: object.h:189
void init_artifacts(void)
Definition: treasure.c:1539