47 #define TIME_ARCH_LOAD 0
127 if (((type == -1) || (type == at->
clone.
type))
153 if (((type == -1) || (type == at->
clone.
type))
178 strncpy(tmpname, name,
MAX_BUF-1);
180 for (i = strlen(tmpname); i > 0; i--) {
211 "%d searches and %d strcmp()'s",
212 "%d searches and %d strcmp()'s",
331 new->clone.other_arch = NULL;
332 new->clone.name = NULL;
333 new->clone.name_pl = NULL;
334 new->clone.title = NULL;
335 new->clone.race = NULL;
336 new->clone.slaying = NULL;
337 new->clone.msg = NULL;
343 new->clone.arch =
new;
359 archetype *at, *head = NULL, *last_more = NULL;
379 if (last_more != NULL)
380 last_more->next = at;
383 head = last_more = at;
391 if (last_more != NULL) {
392 last_more->
more = at;
438 char buf[
MAX_BUF], *variable = buf, *argument, *cp;
442 while (fgets(buf,
MAX_BUF, fp) != NULL) {
445 if ((argument = strchr(buf,
' ')) != NULL) {
446 *argument =
'\0', argument++;
447 cp = argument+strlen(argument)-1;
448 while (isspace(*cp)) {
453 if (!strcmp(
"Object", variable)) {
455 LOG(
llevError,
"Warning: failed to find arch %s\n", argument);
456 }
else if (!strcmp(
"other_arch", variable)) {
459 LOG(
llevError,
"Warning: failed to find other_arch %s\n", argument);
463 }
else if (!strcmp(
"randomitems", variable)) {
467 LOG(
llevError,
"Failed to link treasure to arch (%s): %s\n", at->
name, argument);
471 }
else if (!strcmp(
"arch", variable)) {
478 LOG(
llevError,
"Got an arch %s not inside an Object.\n", argument);
496 LOG(
llevError,
"Warning: %s is generator but lacks other_arch.\n", at->
name);
512 struct timeval tv1, tv2;
516 LOG(
llevDebug,
"Reading archetypes from %s...\n", filename);
532 sec = tv2.tv_sec-tv1.tv_sec;
533 usec = tv2.tv_usec-tv1.tv_usec;
538 LOG(
llevDebug,
"Load took %d.%06d seconds\n", sec, usec);
645 unsigned long hash = 0;
654 for (p = str; i <
MAXSTRING && *p; p++, i++) {
662 return hash%tablesize;
681 at = arch_table[index];
686 if (!strcmp(at->
name, name))
719 if (arch_table[index] == NULL) {
720 arch_table[index] = at;
725 if (index == org_index)
742 object *op, *prev = NULL, *head = NULL;
archetype * find_archetype(const char *name)
static void first_arch_pass(FILE *fp)
void check_generators(void)
object * create_singularity(const char *name)
treasurelist * find_treasurelist(const char *name)
StringBuffer * stringbuffer_new(void)
void free_string(sstring str)
struct treasureliststruct * randomitems
static archetype * arch_table[ARCHTABLE]
void init_archetypes(void)
static void init_archetable(void)
static void add_arch(archetype *at)
void dump_all_archetypes(void)
void close_and_delete(FILE *fp, int compressed)
object * create_archetype_by_object_name(const char *name)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
struct archt * other_arch
archetype * find_archetype_by_object_type_name(int type, const char *name)
void clear_archetable(void)
EXTERN archetype * empty_archetype
static void load_archetypes(void)
object * create_archetype(const char *name)
void dump_arch(archetype *at, StringBuffer *sb)
static void second_arch_pass(FILE *fp)
void free_arch(archetype *at)
void dump_object(object *op, StringBuffer *sb)
archetype * get_archetype_by_skill_name(const char *skill, int type)
void load_treasures(void)
archetype * find_archetype_by_object_name(const char *name)
archetype * try_find_archetype(const char *name)
static unsigned long hasharch(const char *str, int tablesize)
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
object * insert_ob_in_ob(object *op, object *where)
object * object_create_arch(archetype *at)
object * get_object(void)
#define MSG_TYPE_COMMAND_DEBUG
void free_all_archs(void)
#define ARCHTABLE_TOO_SMALL
sint8 body_info[NUM_BODY_LOCATIONS]
int snprintf(char *dest, int max, const char *format,...)
sint8 body_used[NUM_BODY_LOCATIONS]
archetype * get_archetype_by_type_subtype(int type, int subtype)
int load_object(FILE *fp, object *op, int bufstate, int map_flags)
void arch_info(object *op)
void free_key_values(object *op)
#define GETTIMEOFDAY(last_time)
sstring add_string(const char *str)
void copy_object_with_inv(object *src_ob, object *dest_ob)
void clear_object(object *op)
void LOG(LogLevel logLevel, const char *format,...)
EXTERN long warn_archetypes
void copy_object(object *op2, object *op)
void free_object(object *ob)
EXTERN archetype * first_archetype
object * arch_to_object(archetype *at)
FILE * open_and_uncompress(const char *name, int flag, int *compressed)
archetype * get_archetype_struct(void)
char * stringbuffer_finish(StringBuffer *sb)