Crossfire Server, Trunk  R20513
arch.c
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
28 #include "global.h"
29 
30 #include <ctype.h>
31 #include <stdlib.h>
32 #include <string.h>
33 
34 #include "loader.h"
35 
36 static void add_arch(archetype *at);
37 
39 static int arch_cmp = 0;
40 static int arch_search = 0;
41 int arch_init;
43 static void load_archetypes(void);
44 
58  archetype *at;
59  const char *tmp;
60 
61  if (name == NULL)
62  return (archetype *)NULL;
63  tmp = add_string(name);
64  for (at = first_archetype; at != NULL; at = at->next) {
65  if (at->clone.name == tmp) {
66  free_string(tmp);
67  return at;
68  }
69  }
70  free_string(tmp);
71  return NULL;
72 }
73 
83 archetype *find_archetype_by_object_type_name(int type, const char *name) {
84  archetype *at;
85 
86  if (name == NULL)
87  return NULL;
88 
89  for (at = first_archetype; at != NULL; at = at->next) {
90  if (at->clone.type == type && strcmp(at->clone.name, name) == 0)
91  return at;
92  }
93 
94  return NULL;
95 }
96 
107 archetype *get_archetype_by_skill_name(const char *skill, int type) {
108  archetype *at;
109 
110  if (skill == NULL)
111  return NULL;
112 
113  for (at = first_archetype; at != NULL; at = at->next) {
114  if (((type == -1) || (type == at->clone.type))
115  && (at->clone.skill) && (!strcmp(at->clone.skill, skill)))
116  return at;
117  }
118  return NULL;
119 }
120 
136 archetype *get_archetype_by_type_subtype(int type, int subtype) {
137  archetype *at;
138 
139  for (at = first_archetype; at != NULL; at = at->next) {
140  if (((type == -1) || (type == at->clone.type))
141  && (subtype == -1 || subtype == at->clone.subtype))
142  return at;
143  }
144  return NULL;
145 }
146 
160 object *create_archetype_by_object_name(const char *name) {
161  archetype *at;
162  char tmpname[MAX_BUF];
163  size_t i;
164 
165  strncpy(tmpname, name, MAX_BUF-1);
166  tmpname[MAX_BUF-1] = 0;
167  for (i = strlen(tmpname); i > 0; i--) {
168  tmpname[i] = 0;
169  at = find_archetype_by_object_name(tmpname);
170  if (at != NULL) {
171  return arch_to_object(at);
172  }
173  }
174  return create_singularity(name);
175 }
176 
182 void init_archetypes(void) {
183  if (first_archetype != NULL) /* Only do this once */
184  return;
185  arch_init = 1;
186  load_archetypes();
187  arch_init = 0;
188  empty_archetype = find_archetype("empty_archetype");
189  /* init_blocksview();*/
190 }
191 
196 void arch_info(object *op) {
198  "%d searches and %d strcmp()'s",
200 }
201 
205 void clear_archetable(void) {
206  memset((void *)arch_table, 0, ARCHTABLE*sizeof(archetype *));
207 }
208 
212 static void init_archetable(void) {
213  archetype *at;
214 
215  LOG(llevDebug, "arch: setting up archetable\n");
216  for (at = first_archetype; at != NULL; at = (at->more == NULL) ? at->next : at->more) {
217  if (at->name == NULL) {
218  LOG(llevError, "archetype without name? %s\n", at->clone.name ? at->clone.name : "(no clone name)");
219  abort();
220  }
221  add_arch(at);
222  }
223 }
224 
234  object_dump(&at->clone, sb);
235 }
236 
243  archetype *at;
244 
245  for (at = first_archetype; at != NULL; at = (at->more == NULL) ? at->next : at->more) {
246  StringBuffer *sb;
247  char *diff;
248 
249  sb = stringbuffer_new();
250  dump_arch(at, sb);
251  diff = stringbuffer_finish(sb);
252  LOG(llevDebug, "%s\n", diff);
253  free(diff);
254  }
255 }
256 
263 void free_arch(archetype *at) {
264  if (at->name)
265  free_string(at->name);
266  if (at->clone.name)
267  free_string(at->clone.name);
268  if (at->clone.name_pl)
270  if (at->clone.title)
271  free_string(at->clone.title);
272  if (at->clone.race)
273  free_string(at->clone.race);
274  if (at->clone.slaying)
276  if (at->clone.msg)
277  free_string(at->clone.msg);
278  free(at->clone.discrete_damage);
280  free(at);
281 }
282 
287 void free_all_archs(void) {
288  archetype *at, *next;
289  int i = 0;
290 
291  for (at = first_archetype; at != NULL; at = next) {
292  if (at->more)
293  next = at->more;
294  else
295  next = at->next;
296  free_arch(at);
297  i++;
298  }
299  first_archetype = NULL;
300  /* Reset the hashtable */
302  LOG(llevDebug, "Freed %d archetypes\n", i);
303 }
304 
313  archetype *new;
314 
315  new = (archetype *)CALLOC(1, sizeof(archetype));
316  if (new == NULL)
318  new->next = NULL;
319  new->name = NULL;
320  new->clone.other_arch = NULL;
321  new->clone.name = NULL;
322  new->clone.name_pl = NULL;
323  new->clone.title = NULL;
324  new->clone.race = NULL;
325  new->clone.slaying = NULL;
326  new->clone.msg = NULL;
327  object_clear(&new->clone); /* to initial state other also */
328  CLEAR_FLAG((&new->clone), FLAG_FREED); /* This shouldn't matter, since object_copy() */
329  SET_FLAG((&new->clone), FLAG_REMOVED); /* doesn't copy these flags... */
330  new->head = NULL;
331  new->more = NULL;
332  new->clone.arch = new;
333  return new;
334 }
335 
346 static void first_arch_pass(FILE *fp) {
347  archetype *at, *head = NULL, *last_more = NULL;
348  int i, first = LO_NEWFILE;
349 
350  at = get_archetype_struct();
351  first_archetype = at;
352 
353  while ((i = load_object(fp, &at->clone, first, 0))) {
354  first = 0;
355  at->clone.speed_left = (float)(-0.1);
356 
357  switch (i) {
358  case LL_NORMAL: /* A new archetype, just link it with the previous */
359  if (last_more != NULL)
360  last_more->next = at;
361  if (head != NULL)
362  head->next = at;
363  head = last_more = at;
364  at->tail_x = 0;
365  at->tail_y = 0;
366  break;
367 
368  case LL_MORE: /* Another part of the previous archetype, link it correctly */
369  at->head = head;
370  at->clone.head = &head->clone;
371  if (last_more != NULL) {
372  last_more->more = at;
373  last_more->clone.more = &at->clone;
374  }
375  last_more = at;
376 
377  /* Set FLAG_MONSTER throughout parts if head has it */
378  if (QUERY_FLAG(&head->clone, FLAG_MONSTER)) {
379  SET_FLAG(&at->clone, FLAG_MONSTER);
380  }
381 
382  /* If this multipart image is still composed of individual small
383  * images, don't set the tail_.. values. We can't use them anyways,
384  * and setting these to zero makes the map sending to the client much
385  * easier as just looking at the head, we know what to do.
386  */
387  if (at->clone.face != head->clone.face) {
388  head->tail_x = 0;
389  head->tail_y = 0;
390  } else {
391  if (at->clone.x > head->tail_x)
392  head->tail_x = at->clone.x;
393  if (at->clone.y > head->tail_y)
394  head->tail_y = at->clone.y;
395  }
396  break;
397  }
398 
399  at = get_archetype_struct();
400  }
401  at->clone.arch = NULL; /* arch is checked for temporary archetypes if not NULL. */
402  free(at);
403 }
404 
414 static void second_arch_pass(FILE *fp) {
415  char buf[MAX_BUF], *variable = buf, *argument, *cp;
416  archetype *at = NULL, *other;
417  object *inv;
418 
419  while (fgets(buf, MAX_BUF, fp) != NULL) {
420  if (*buf == '#')
421  continue;
422  if ((argument = strchr(buf, ' ')) != NULL) {
423  *argument = '\0', argument++;
424  cp = argument+strlen(argument)-1;
425  while (isspace(*cp)) {
426  *cp = '\0';
427  cp--;
428  }
429  }
430  if (!strcmp("Object", variable)) {
431  if ((at = find_archetype(argument)) == NULL)
432  {
433  LOG(llevError, "Fatal: failed to find arch %s in second_arch_pass\n", argument);
435  }
436  } else if (!strcmp("other_arch", variable)) {
437  if (at != NULL && at->clone.other_arch == NULL) {
438  if ((other = find_archetype(argument)) == NULL)
439  LOG(llevError, "Warning: failed to find other_arch %s\n", argument);
440  else if (at != NULL)
441  at->clone.other_arch = other;
442  }
443  } else if (!strcmp("randomitems", variable)) {
444  if (at != NULL) {
445  treasurelist *tl = find_treasurelist(argument);
446  if (tl == NULL)
447  LOG(llevError, "Failed to link treasure to arch (%s): %s\n", at->name, argument);
448  else
449  at->clone.randomitems = tl;
450  }
451  } else if (!strcmp("arch", variable)) {
452  inv = create_archetype(argument);
453  load_object(fp, inv, LO_LINEMODE, 0);
454  if (at) {
455  object_insert_in_ob(inv, &at->clone);
456  } else {
457  LOG(llevError, "Got an arch %s not inside an Object.\n", argument);
459  }
460  }
461  }
462 }
463 
467 void check_generators(void) {
468  const archetype *at;
469  int abort = 0;
470 
471  for (at = first_archetype; at != NULL; at = at->next) {
472  if (!QUERY_FLAG(&at->clone, FLAG_GENERATOR))
473  continue;
474 
475  if (!QUERY_FLAG(&at->clone, FLAG_CONTENT_ON_GEN) && at->clone.other_arch == NULL) {
476  LOG(llevError, "Fatal: %s is generator without content_on_gen but lacks other_arch.\n", at->name);
477  abort = 1;
478  continue;
479  }
480  if (QUERY_FLAG(&at->clone, FLAG_CONTENT_ON_GEN) && at->clone.inv == NULL) {
481  LOG(llevError, "Fatal: %s is generator with content_on_gen but lacks inventory.\n", at->name);
482  abort = 1;
483  continue;
484  }
485  }
486 
487  if (abort)
489 }
490 
495 void check_summoned(void) {
496  const archetype *at;
497 
498  for (at = first_archetype; at != NULL; at = at->next) {
499  if (at->clone.type == SPELL && at->clone.subtype == SP_SUMMON_GOLEM && at->clone.other_arch) {
500  if (at->clone.other_arch->clone.move_type == 0) {
501  LOG(llevError, "Summonable archetype %s [%s] has no move_type defined!\n", at->clone.other_arch->name, at->clone.other_arch->clone.name);
503  }
504  }
505  }
506 }
507 
511 static void check_spells(void) {
512  int abort = 0;
513  const archetype *at;
514 
515  for (at = first_archetype; at != NULL; at = at->next) {
516  if (at->clone.type == SPELL && at->clone.skill == NULL) {
517  LOG(llevError, "Spell archetype %s [%s] has no skill defined!\n", at->name, at->clone.name);
518  abort = 1;
519  }
520  }
521  if (abort)
523 }
524 
532 static void load_archetypes(void) {
533  FILE *fp;
534  char filename[MAX_BUF];
535 
536  snprintf(filename, sizeof(filename), "%s/%s", settings.datadir, settings.archetypes);
537  if ((fp = fopen(filename, "r")) == NULL) {
538  LOG(llevError, " Can't open archetype file.\n");
539  return;
540  }
542 
543  LOG(llevDebug, "arch: starting pass 1...\n");
544  first_arch_pass(fp);
545  init_archetable();
546  warn_archetypes = 1;
547 
548  rewind(fp);
549 
550  LOG(llevDebug, "arch: loading treasures\n");
551  load_treasures();
552  LOG(llevDebug, "arch: starting pass 2...\n");
553  second_arch_pass(fp);
555  check_spells();
556  check_summoned();
557  fclose(fp);
558 }
559 
571 object *arch_to_object(archetype *at) {
572  object *op;
573 
574  if (at == NULL) {
575  if (warn_archetypes)
576  LOG(llevError, "Couldn't find archetype.\n");
577  return NULL;
578  }
579  op = object_new();
580  object_copy_with_inv(&at->clone, op);
581  op->arch = at;
582  return op;
583 }
584 
598 object *create_singularity(const char *name) {
599  object *op;
600  char buf[MAX_BUF];
601 
602  snprintf(buf, sizeof(buf), "%s (%s)", ARCH_SINGULARITY, name);
603  op = object_new();
604  op->name = add_string(buf);
605  op->name_pl = add_string(buf);
606  SET_FLAG(op, FLAG_NO_PICK);
607  return op;
608 }
609 
620 object *create_archetype(const char *name) {
621  archetype *at;
622 
623  at = find_archetype(name);
624  if (at == NULL)
625  return create_singularity(name);
626  return arch_to_object(at);
627 }
628 
638 static unsigned long
639 hasharch(const char *str, int tablesize) {
640  unsigned long hash = 0;
641  int i = 0;
642  const char *p;
643 
644  /* use the one-at-a-time hash function, which supposedly is
645  * better than the djb2-like one used by perl5.005, but
646  * certainly is better then the bug used here before.
647  * see http://burtleburtle.net/bob/hash/doobs.html
648  */
649  for (p = str; i < MAXSTRING && *p; p++, i++) {
650  hash += *p;
651  hash += hash<<10;
652  hash ^= hash>>6;
653  }
654  hash += hash<<3;
655  hash ^= hash>>11;
656  hash += hash<<15;
657  return hash%tablesize;
658 }
659 
666 archetype *try_find_archetype(const char *name) {
667  archetype *at;
668  unsigned long index;
669 
670  if (name == NULL)
671  return (archetype *)NULL;
672 
673  index = hasharch(name, ARCHTABLE);
674  arch_search++;
675  for (;;) {
676  at = arch_table[index];
677  if (at == NULL) {
678  return NULL;
679  }
680  arch_cmp++;
681  if (!strcmp(at->name, name))
682  return at;
683  if (++index >= ARCHTABLE)
684  index = 0;
685  }
686 }
687 
695 archetype *find_archetype(const char *name) {
696  archetype *at;
697 
698  if (name == NULL)
699  return (archetype *)NULL;
700  at = try_find_archetype(name);
701  if (at == NULL && warn_archetypes)
702  LOG(llevError, "Couldn't find archetype %s\n", name);
703  return at;
704 }
705 
710 static void add_arch(archetype *at) {
711  unsigned long index = hasharch(at->name, ARCHTABLE), org_index = index;
712 
713  for (;;) {
714  if (arch_table[index] == NULL) {
715  arch_table[index] = at;
716  return;
717  }
718  if (++index == ARCHTABLE)
719  index = 0;
720  if (index == org_index)
722  }
723 }
724 
737  object *op, *prev = NULL, *head = NULL;
738 
739  while (at) {
740  op = arch_to_object(at);
741  op->x = at->clone.x;
742  op->y = at->clone.y;
743  if (head)
744  op->head = head, prev->more = op;
745  if (!head)
746  head = op;
747  prev = op;
748  at = at->more;
749  }
750  return (head);
751 }
752 
764  if (type >= OBJECT_TYPE_MAX)
765  return 0;
766  /*
767  * There's no reason to not use a switch statement here.
768  * We don't do anything special, so why take time reloading to registers?
769  *
770  * Just skip doing the ranges, since those might actually be better in their
771  * current form.
772  */
773  switch (type){
774  case 11:
775  case 12:
776  case 19:
777  case 25:
778  case 35:
779  case 38:
780  case 44:
781  case 47:
782  case 61:
783  case 63:
784  case 76:
785  case 78:
786  case 81:
787  case 84:
788  case 86:
789  case 88:
790  case 89:
791  case 96:
792  case 97:
793  case 107:
794  case 108:
795  case 110:
796  return 0;
797  }
798  if (type >= 117 && type <= 120)
799  return 0;
800  if (type >= 125 && type <= 129)
801  return 0;
802  if (type >= 131 && type <= 137)
803  return 0;
804  if (type >= 140 && type <= 149)
805  return 0;
806  if (type >= 151 && type <= 153)
807  return 0;
808 
809  return 1;
810 }
811 
812 /*** end of arch.c ***/
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
Sends message to player(s).
Definition: main.c:315
Error, serious thing.
Definition: logger.h:11
#define ARCH_SINGULARITY
Archetype for singularity.
Definition: object.h:576
archetype * find_archetype(const char *name)
Finds, using the hashtable, which archetype matches the given name.
Definition: arch.c:695
MoveType move_type
Type of movement this object uses.
Definition: object.h:424
#define LO_LINEMODE
Definition: loader.h:16
int8_t tail_x
Definition: object.h:471
static void first_arch_pass(FILE *fp)
Reads/parses the archetype-file, and copies into a linked list of archetype-structures.
Definition: arch.c:346
treasureliststruct represents one logical group of items to be generated together.
Definition: treasure.h:82
const char * race
Human, goblin, dragon, etc.
Definition: object.h:318
#define SET_FLAG(xyz, p)
Definition: define.h:223
unsigned char uint8_t
Definition: win32.h:161
static int arch_search
How many searches.
Definition: arch.c:40
static void check_spells(void)
This ensures all spells have a skill defined, calling fatal() if any error was found.
Definition: arch.c:511
void object_copy_with_inv(const object *src_ob, object *dest_ob)
copy an object with an inventory...
Definition: object.c:975
object * create_singularity(const char *name)
Creates a dummy object.
Definition: arch.c:598
void fatal(enum fatal_error err)
fatal() is meant to be called whenever a fatal signal is intercepted.
Definition: utils.c:596
Update if you add new types.
Definition: object.h:250
treasurelist * find_treasurelist(const char *name)
Searches for the given treasurelist in the globally linked list of treasurelists which has been built...
Definition: treasure.c:292
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
Definition: stringbuffer.c:57
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
Definition: shstr.c:280
struct treasureliststruct * randomitems
Items to be generated.
Definition: object.h:385
object clone
An object from which to do object_copy()
Definition: object.h:470
static archetype * arch_table[ARCHTABLE]
Definition: arch.c:38
const char * slaying
Which race to do double damage to.
Definition: object.h:319
void init_archetypes(void)
Initialises the internal linked list of archetypes (read from file).
Definition: arch.c:182
static void init_archetable(void)
An alternative way to init the hashtable which is slower, but works...
Definition: arch.c:212
void check_summoned(void)
This checks all summonable items for move_type and other things.
Definition: arch.c:495
static void add_arch(archetype *at)
Adds an archetype to the hashtable.
Definition: arch.c:710
void dump_all_archetypes(void)
Dumps all archetypes to debug-level output.
Definition: arch.c:242
uint8_t subtype
Subtype of object.
Definition: object.h:339
int arch_init
True if doing arch initialization.
Definition: arch.c:41
object * create_archetype_by_object_name(const char *name)
Creates an object given the name that appears during the game (for example, "writing pen" instead of ...
Definition: arch.c:160
Global type definitions and header inclusions.
struct archt * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
Definition: object.h:413
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
Definition: object.h:465
int8_t tail_y
Where the lower right most portion of the object is in comparison to the head.
Definition: object.h:471
#define FLAG_REMOVED
Object is not in any map or invenory.
Definition: define.h:232
archetype * find_archetype_by_object_type_name(int type, const char *name)
This function retrieves an archetype by type and name that appears during the game.
Definition: arch.c:83
#define CALLOC(x, y)
Definition: compat.h:27
int16_t * discrete_damage
damage values, based on each attacktype.
Definition: object.h:435
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
Definition: object.c:1368
const char * title
Of foo, etc.
Definition: object.h:317
int16_t y
Position in the map for this object.
Definition: object.h:326
void clear_archetable(void)
Initialise the hashtable used by the archetypes.
Definition: arch.c:205
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
Definition: newclient.h:379
void object_dump(const object *op, StringBuffer *sb)
Dumps an object.
Definition: object.c:394
EXTERN archetype * empty_archetype
Nice to have fast access to it.
Definition: global.h:151
int is_type_valid(uint8_t type)
Checks if the specified type is a valid one for a Crossfire object.
Definition: arch.c:763
static void load_archetypes(void)
Loads all archetypes and treasures.
Definition: arch.c:532
#define ARCHTABLE
Used when hashing archetypes.
Definition: config.h:578
#define LL_NORMAL
Definition: loader.h:12
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it...
Definition: object.c:1037
const char * name_pl
The plural name of the object.
Definition: object.h:315
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
Definition: arch.c:620
void dump_arch(archetype *at, StringBuffer *sb)
Dumps an archetype to buffer.
Definition: arch.c:233
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
Definition: object.c:2690
float speed_left
How much speed is left to spend this round.
Definition: object.h:329
Defines for loader.l / loader.c.
static void second_arch_pass(FILE *fp)
Reads the archetype file once more, and links all pointers between archetypes and treasure lists...
Definition: arch.c:414
#define LO_NEWFILE
Definition: loader.h:17
#define LL_MORE
Definition: loader.h:11
void free_arch(archetype *at)
Frees archetype.
Definition: arch.c:263
#define snprintf
Definition: win32.h:46
archetype * get_archetype_by_skill_name(const char *skill, int type)
Retrieves an archetype by skill name and type.
Definition: arch.c:107
static int arch_cmp
How many strcmp&#39;s.
Definition: arch.c:39
const char * name
The name of the object, obviously...
Definition: object.h:311
struct archt * more
Next part of a linked object.
Definition: object.h:469
void load_treasures(void)
Opens LIBDIR/treasure and reads all treasure-declarations from it.
Definition: treasure.c:221
archetype * find_archetype_by_object_name(const char *name)
This function retrieves an archetype given the name that appears during the game (for example...
Definition: arch.c:57
struct archt * head
The main part of a linked object.
Definition: object.h:468
void object_clear(object *op)
Frees everything allocated by an object, and also clears all variables and flags to default settings...
Definition: object.c:759
const char * archetypes
Name of the archetypes file - libdir is prepended.
Definition: global.h:248
archetype * try_find_archetype(const char *name)
Finds, using the hashtable, which archetype matches the given name.
Definition: arch.c:666
static unsigned long hasharch(const char *str, int tablesize)
Hash-function used by the arch-hashtable.
Definition: arch.c:639
void check_generators(void)
Check all generators have the other_arch set or something in inventory.
Definition: arch.c:467
See Spell.
Definition: object.h:214
#define QUERY_FLAG(xyz, p)
Definition: define.h:225
#define CLEAR_FLAG(xyz, p)
Definition: define.h:224
#define MSG_TYPE_COMMAND_DEBUG
Various debug type commands.
Definition: newclient.h:508
#define MAX_BUF
Used for all kinds of things.
Definition: define.h:35
object * object_create_arch(archetype *at)
Create a full object using the given archetype.
Definition: arch.c:736
int16_t x
Definition: object.h:326
void free_all_archs(void)
Frees all memory allocated to archetypes.
Definition: arch.c:287
const char * skill
Name of the skill this object uses/grants.
Definition: object.h:321
const char * datadir
Read only data files.
Definition: global.h:244
#define FLAG_GENERATOR
Will generate type ob->stats.food.
Definition: define.h:248
archetype * get_archetype_by_type_subtype(int type, int subtype)
Retrieves an archetype by type and subtype.
Definition: arch.c:136
int load_object(FILE *fp, object *op, int bufstate, int map_flags)
struct archt * arch
Pointer to archetype.
Definition: object.h:412
#define MAXSTRING
Definition: config.h:579
Only for debugging purposes.
Definition: logger.h:13
uint8_t type
PLAYER, BULLET, etc.
Definition: object.h:338
struct Settings settings
Server settings.
Definition: init.c:40
void arch_info(object *op)
Stores debug-information about how efficient the hashtable used for archetypes has been in the static...
Definition: arch.c:196
struct archt * next
Next archetype in a linked list.
Definition: object.h:467
const char * msg
If this is a book/sign/magic mouth/etc.
Definition: object.h:322
sstring add_string(const char *str)
This will add &#39;str&#39; to the hash table.
Definition: shstr.c:124
#define FLAG_MONSTER
Will attack players.
Definition: define.h:245
struct obj * inv
Pointer to the first object in the inventory.
Definition: object.h:290
#define NDI_UNIQUE
Print immediately, don&#39;t buffer.
Definition: newclient.h:245
struct obj * head
Points to the main object of a large body.
Definition: object.h:296
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
Definition: logger.c:51
EXTERN long warn_archetypes
If true, write warnings when failing to find archetypes when loading from file.
Definition: global.h:132
A buffer that will be expanded as content is added to it.
Definition: stringbuffer.c:25
const New_Face * face
Face with colors.
Definition: object.h:332
#define FLAG_NO_PICK
Object can&#39;t be picked up.
Definition: define.h:239
void object_free_key_values(object *op)
Zero the key_values on op, decrementing the shared-string refcounts and freeing the links...
Definition: object.c:727
#define SP_SUMMON_GOLEM
Definition: spells.h:86
EXTERN archetype * first_archetype
First archetype.
Definition: global.h:122
struct obj * more
Pointer to the rest of a large body of objects.
Definition: object.h:295
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
Definition: arch.c:571
#define FLAG_CONTENT_ON_GEN
Definition: define.h:374
archetype * get_archetype_struct(void)
Allocates, initialises and returns the pointer to an archetype structure.
Definition: arch.c:312
const char * name
More definite name, like "generate_kobold".
Definition: object.h:466
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
Definition: stringbuffer.c:76
#define FLAG_FREED
Object is in the list of free objects.
Definition: define.h:233