1 | /* |
|
|
2 | * static char *rcsid_arch_c = |
|
|
3 | * "$Id: arch.C,v 1.13 2006/09/07 09:37:11 pippijn Exp $"; |
|
|
4 | */ |
|
|
5 | |
|
|
6 | /* |
1 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
8 | |
3 | |
9 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
10 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
36 | #include <loader.h> |
31 | #include <loader.h> |
37 | |
32 | |
38 | /* IF set, does a little timing on the archetype load. */ |
33 | /* IF set, does a little timing on the archetype load. */ |
39 | #define TIME_ARCH_LOAD 0 |
34 | #define TIME_ARCH_LOAD 0 |
40 | |
35 | |
41 | static void add_arch (archetype * at); |
36 | static void add_arch (archetype *at); |
42 | |
37 | |
43 | static archetype *arch_table[ARCHTABLE]; |
38 | static archetype *arch_table[ARCHTABLE]; |
44 | int arch_cmp = 0; /* How many strcmp's */ |
39 | int arch_cmp = 0; /* How many strcmp's */ |
45 | int arch_search = 0; /* How many searches */ |
40 | int arch_search = 0; /* How many searches */ |
46 | int arch_init; /* True if doing arch initialization */ |
41 | int arch_init; /* True if doing arch initialization */ |
… | |
… | |
53 | * MSW 2003-04-29 |
48 | * MSW 2003-04-29 |
54 | */ |
49 | */ |
55 | |
50 | |
56 | #if USE_UNORDERED_MAP |
51 | #if USE_UNORDERED_MAP |
57 | // the hashtable |
52 | // the hashtable |
58 | typedef std::tr1::unordered_map<size_t, archetype *> HT; |
53 | typedef std::tr1::unordered_map |
|
|
54 | < |
|
|
55 | std::size_t, |
|
|
56 | archetype *, |
|
|
57 | std::hash<size_t>, |
|
|
58 | std::equal_to<size_t>, |
|
|
59 | slice_allocator< std::pair<const std::size_t, archetype *> > |
|
|
60 | true, |
|
|
61 | > HT; |
59 | |
62 | |
60 | static HT ht; |
63 | static HT ht; |
61 | #endif |
64 | #endif |
62 | |
65 | |
63 | /** |
66 | /** |
… | |
… | |
72 | * - the archetype found or null if nothing was found. |
75 | * - the archetype found or null if nothing was found. |
73 | */ |
76 | */ |
74 | archetype * |
77 | archetype * |
75 | find_archetype_by_object_name (const char *name) |
78 | find_archetype_by_object_name (const char *name) |
76 | { |
79 | { |
77 | archetype *at; |
80 | archetype * |
|
|
81 | at; |
78 | |
82 | |
79 | if (name == NULL) |
83 | if (name == NULL) |
80 | return (archetype *) NULL; |
84 | return (archetype *) NULL; |
81 | |
85 | |
82 | for (at = first_archetype; at != NULL; at = at->next) |
86 | for (at = first_archetype; at != NULL; at = at->next) |
… | |
… | |
93 | * except that it considers only items of the given type. |
97 | * except that it considers only items of the given type. |
94 | */ |
98 | */ |
95 | archetype * |
99 | archetype * |
96 | find_archetype_by_object_type_name (int type, const char *name) |
100 | find_archetype_by_object_type_name (int type, const char *name) |
97 | { |
101 | { |
98 | archetype *at; |
102 | archetype * |
|
|
103 | at; |
99 | |
104 | |
100 | if (name == NULL) |
105 | if (name == NULL) |
101 | return NULL; |
106 | return NULL; |
102 | |
107 | |
103 | for (at = first_archetype; at != NULL; at = at->next) |
108 | for (at = first_archetype; at != NULL; at = at->next) |
… | |
… | |
165 | * but it otherwise had a big memory leak. |
170 | * but it otherwise had a big memory leak. |
166 | */ |
171 | */ |
167 | object * |
172 | object * |
168 | get_archetype_by_object_name (const char *name) |
173 | get_archetype_by_object_name (const char *name) |
169 | { |
174 | { |
170 | archetype * |
175 | archetype *at; |
171 | at; |
|
|
172 | char |
|
|
173 | tmpname[MAX_BUF]; |
176 | char tmpname[MAX_BUF]; |
174 | int |
177 | int i; |
175 | i; |
|
|
176 | |
178 | |
177 | strncpy (tmpname, name, MAX_BUF - 1); |
179 | assign (tmpname, name); |
178 | tmpname[MAX_BUF - 1] = 0; |
180 | |
179 | for (i = strlen (tmpname); i > 0; i--) |
181 | for (i = strlen (tmpname); i > 0; i--) |
180 | { |
182 | { |
181 | tmpname[i] = 0; |
183 | tmpname[i] = 0; |
182 | at = find_archetype_by_object_name (tmpname); |
184 | at = find_archetype_by_object_name (tmpname); |
|
|
185 | |
183 | if (at != NULL) |
186 | if (at != NULL) |
184 | { |
187 | { |
185 | return arch_to_object (at); |
188 | return arch_to_object (at); |
186 | } |
189 | } |
187 | } |
190 | } |
|
|
191 | |
188 | return create_singularity (name); |
192 | return create_singularity (name); |
189 | } |
193 | } |
190 | |
194 | |
191 | /* This is a subset of the parse_id command. Basically, name can be |
195 | /* This is a subset of the parse_id command. Basically, name can be |
192 | * a string seperated lists of things to match, with certain keywords. |
196 | * a string seperated lists of things to match, with certain keywords. |
… | |
… | |
204 | * If count is 1, make a quick check on the name. |
208 | * If count is 1, make a quick check on the name. |
205 | * IF count is >1, we need to make plural name. Return if match. |
209 | * IF count is >1, we need to make plural name. Return if match. |
206 | * Last, make a check on the full name. |
210 | * Last, make a check on the full name. |
207 | */ |
211 | */ |
208 | int |
212 | int |
209 | item_matched_string (object * pl, object * op, const char *name) |
213 | item_matched_string (object *pl, object *op, const char *name) |
210 | { |
214 | { |
211 | char * |
215 | char * |
212 | cp, |
216 | cp, |
213 | local_name[MAX_BUF]; |
217 | local_name[MAX_BUF]; |
214 | int |
218 | int |
215 | count, |
219 | count, |
216 | retval = 0; |
220 | retval = 0; |
|
|
221 | |
217 | strcpy (local_name, name); /* strtok is destructive to name */ |
222 | strcpy (local_name, name); /* strtok is destructive to name */ |
218 | |
223 | |
219 | for (cp = strtok (local_name, ","); cp; cp = strtok (NULL, ",")) |
224 | for (cp = strtok (local_name, ","); cp; cp = strtok (NULL, ",")) |
220 | { |
225 | { |
221 | while (cp[0] == ' ') |
226 | while (cp[0] == ' ') |
… | |
… | |
326 | return; |
331 | return; |
327 | arch_init = 1; |
332 | arch_init = 1; |
328 | load_archetypes (); |
333 | load_archetypes (); |
329 | arch_init = 0; |
334 | arch_init = 0; |
330 | empty_archetype = find_archetype ("empty_archetype"); |
335 | empty_archetype = find_archetype ("empty_archetype"); |
|
|
336 | |
331 | /* init_blocksview();*/ |
337 | /* init_blocksview();*/ |
332 | } |
338 | } |
333 | |
339 | |
334 | /* |
340 | /* |
335 | * Stores debug-information about how efficient the hashtable |
341 | * Stores debug-information about how efficient the hashtable |
336 | * used for archetypes has been in the static errmsg array. |
342 | * used for archetypes has been in the static errmsg array. |
337 | */ |
343 | */ |
338 | |
344 | |
339 | void |
345 | void |
340 | arch_info (object * op) |
346 | arch_info (object *op) |
341 | { |
347 | { |
342 | sprintf (errmsg, "%d searches and %d strcmp()'s", arch_search, arch_cmp); |
348 | sprintf (errmsg, "%d searches and %d strcmp()'s", arch_search, arch_cmp); |
343 | new_draw_info (NDI_BLACK, 0, op, errmsg); |
349 | new_draw_info (NDI_BLACK, 0, op, errmsg); |
344 | } |
350 | } |
345 | |
351 | |
… | |
… | |
358 | */ |
364 | */ |
359 | |
365 | |
360 | void |
366 | void |
361 | init_archetable (void) |
367 | init_archetable (void) |
362 | { |
368 | { |
363 | archetype *at; |
369 | archetype * |
|
|
370 | at; |
364 | |
371 | |
365 | LOG (llevDebug, " Setting up archetable...\n"); |
372 | LOG (llevDebug, " Setting up archetable...\n"); |
366 | |
373 | |
367 | for (at = first_archetype; at != NULL; at = (at->more == NULL) ? at->next : at->more) |
374 | for (at = first_archetype; at != NULL; at = (at->more == NULL) ? at->next : at->more) |
368 | add_arch (at); |
375 | add_arch (at); |
… | |
… | |
373 | /* |
380 | /* |
374 | * Dumps an archetype to debug-level output. |
381 | * Dumps an archetype to debug-level output. |
375 | */ |
382 | */ |
376 | |
383 | |
377 | void |
384 | void |
378 | dump_arch (archetype * at) |
385 | dump_arch (archetype *at) |
379 | { |
386 | { |
380 | dump_object (&at->clone); |
387 | dump_object (&at->clone); |
381 | } |
388 | } |
382 | |
389 | |
383 | /* |
390 | /* |
… | |
… | |
389 | void |
396 | void |
390 | dump_all_archetypes (void) |
397 | dump_all_archetypes (void) |
391 | { |
398 | { |
392 | archetype * |
399 | archetype * |
393 | at; |
400 | at; |
|
|
401 | |
394 | for (at = first_archetype; at != NULL; at = (at->more == NULL) ? at->next : at->more) |
402 | for (at = first_archetype; at != NULL; at = (at->more == NULL) ? at->next : at->more) |
395 | { |
403 | { |
396 | dump_arch (at); |
404 | dump_arch (at); |
397 | fprintf (logfile, "%s\n", errmsg); |
405 | fprintf (logfile, "%s\n", errmsg); |
398 | } |
406 | } |
… | |
… | |
414 | else |
422 | else |
415 | next = at->next; |
423 | next = at->next; |
416 | |
424 | |
417 | delete |
425 | delete |
418 | at; |
426 | at; |
|
|
427 | |
419 | i++; |
428 | i++; |
420 | } |
429 | } |
421 | LOG (llevDebug, "Freed %d archetypes, %d faces\n", i, f); |
430 | LOG (llevDebug, "Freed %d archetypes, %d faces\n", i, f); |
422 | } |
431 | } |
423 | |
432 | |
424 | /* |
433 | archetype::archetype () |
425 | * Allocates, initialises and returns the pointer to an archetype structure. |
|
|
426 | */ |
|
|
427 | // TODO: should become constructor |
|
|
428 | archetype * |
|
|
429 | get_archetype_struct (void) |
|
|
430 | { |
434 | { |
431 | archetype * |
|
|
432 | arch; |
|
|
433 | |
|
|
434 | arch = new archetype; |
|
|
435 | |
|
|
436 | clear_object (&arch->clone); /* to initial state other also */ |
435 | clear_object (&clone); /* to initial state other also */ |
437 | CLEAR_FLAG (&arch->clone, FLAG_FREED); /* This shouldn't matter, since copy_object() */ |
436 | CLEAR_FLAG (&clone, FLAG_FREED); /* This shouldn't matter, since copy_object() */ |
438 | SET_FLAG (&arch->clone, FLAG_REMOVED); /* doesn't copy these flags... */ |
437 | SET_FLAG (&clone, FLAG_REMOVED); /* doesn't copy these flags... */ |
|
|
438 | } |
439 | |
439 | |
440 | return arch; |
440 | archetype::~archetype () |
|
|
441 | { |
441 | } |
442 | } |
442 | |
443 | |
443 | /* |
444 | /* |
444 | * Reads/parses the archetype-file, and copies into a linked list |
445 | * Reads/parses the archetype-file, and copies into a linked list |
445 | * of archetype-structures. |
446 | * of archetype-structures. |
446 | */ |
447 | */ |
447 | void |
448 | void |
448 | first_arch_pass (object_thawer & fp) |
449 | first_arch_pass (object_thawer & fp) |
449 | { |
450 | { |
450 | object * |
|
|
451 | op; |
|
|
452 | archetype * |
451 | archetype * |
453 | at, * |
452 | at, * |
454 | head = NULL, *last_more = NULL; |
453 | head = NULL, *last_more = NULL; |
455 | int |
|
|
456 | i; |
|
|
457 | |
454 | |
458 | op = get_object (); |
|
|
459 | op->arch = first_archetype = at = get_archetype_struct (); |
455 | at->clone.arch = first_archetype = at = new archetype; |
460 | |
456 | |
461 | while ((i = load_object (fp, op, 0))) |
457 | while (int i = load_object (fp, &at->clone, 0)) |
462 | { |
458 | { |
463 | copy_object (op, &at->clone); |
|
|
464 | at->clone.speed_left = (float) (-0.1); |
459 | at->clone.speed_left = (float) (-0.1); |
465 | /* copy the body_info to the body_used - this is only really |
460 | /* copy the body_info to the body_used - this is only really |
466 | * need for monsters, but doesn't hurt to do it for everything. |
461 | * need for monsters, but doesn't hurt to do it for everything. |
467 | * by doing so, when a monster is created, it has good starting |
462 | * by doing so, when a monster is created, it has good starting |
468 | * values for the body_used info, so when items are created |
463 | * values for the body_used info, so when items are created |
469 | * for it, they can be properly equipped. |
464 | * for it, they can be properly equipped. |
470 | */ |
465 | */ |
471 | memcpy (&at->clone.body_used, &op->body_info, sizeof (op->body_info)); |
466 | memcpy (&at->clone.body_used, &at->clone.body_info, sizeof (at->clone.body_info)); |
472 | |
467 | |
473 | switch (i) |
468 | switch (i) |
474 | { |
469 | { |
475 | case LL_NORMAL: /* A new archetype, just link it with the previous */ |
470 | case LL_NORMAL: /* A new archetype, just link it with the previous */ |
476 | if (last_more != NULL) |
471 | if (last_more != NULL) |
477 | last_more->next = at; |
472 | last_more->next = at; |
478 | if (head != NULL) |
473 | if (head != NULL) |
479 | head->next = at; |
474 | head->next = at; |
480 | head = last_more = at; |
475 | head = last_more = at; |
481 | #if 0 |
476 | #if 0 |
482 | if (!op->type) |
477 | if (!op->type) |
483 | LOG (llevDebug, " WARNING: Archetype %s has no type info!\n", op->arch->name); |
478 | LOG (llevDebug, " WARNING: Archetype %s has no type info!\n", op->arch->name); |
484 | #endif |
479 | #endif |
485 | at->tail_x = 0; |
480 | at->tail_x = 0; |
486 | at->tail_y = 0; |
481 | at->tail_y = 0; |
487 | break; |
482 | break; |
488 | |
483 | |
489 | case LL_MORE: /* Another part of the previous archetype, link it correctly */ |
484 | case LL_MORE: /* Another part of the previous archetype, link it correctly */ |
490 | |
485 | |
491 | at->head = head; |
486 | at->head = head; |
492 | at->clone.head = &head->clone; |
487 | at->clone.head = &head->clone; |
493 | if (last_more != NULL) |
488 | if (last_more != NULL) |
494 | { |
489 | { |
495 | last_more->more = at; |
490 | last_more->more = at; |
496 | last_more->clone.more = &at->clone; |
491 | last_more->clone.more = &at->clone; |
497 | } |
492 | } |
498 | last_more = at; |
493 | last_more = at; |
499 | |
494 | |
500 | /* If this multipart image is still composed of individual small |
495 | /* If this multipart image is still composed of individual small |
501 | * images, don't set the tail_.. values. We can't use them anyways, |
496 | * images, don't set the tail_.. values. We can't use them anyways, |
502 | * and setting these to zero makes the map sending to the client much |
497 | * and setting these to zero makes the map sending to the client much |
503 | * easier as just looking at the head, we know what to do. |
498 | * easier as just looking at the head, we know what to do. |
504 | */ |
499 | */ |
505 | if (at->clone.face != head->clone.face) |
500 | if (at->clone.face != head->clone.face) |
506 | { |
501 | { |
507 | head->tail_x = 0; |
502 | head->tail_x = 0; |
508 | head->tail_y = 0; |
503 | head->tail_y = 0; |
509 | } |
504 | } |
510 | else |
505 | else |
511 | { |
506 | { |
512 | if (at->clone.x > head->tail_x) |
507 | if (at->clone.x > head->tail_x) |
513 | head->tail_x = at->clone.x; |
508 | head->tail_x = at->clone.x; |
514 | if (at->clone.y > head->tail_y) |
509 | if (at->clone.y > head->tail_y) |
515 | head->tail_y = at->clone.y; |
510 | head->tail_y = at->clone.y; |
516 | } |
511 | } |
517 | break; |
512 | break; |
518 | |
513 | |
519 | } |
514 | } |
520 | |
515 | |
521 | at = get_archetype_struct (); |
516 | at = new archetype; |
522 | clear_object (op); |
517 | |
523 | op->arch = at; |
518 | at->clone.arch = at; |
524 | } |
519 | } |
525 | |
520 | |
526 | delete |
521 | delete at; |
527 | at; |
|
|
528 | free_object (op); |
|
|
529 | } |
522 | } |
530 | |
523 | |
531 | /* |
524 | /* |
532 | * Reads the archetype file once more, and links all pointers between |
525 | * Reads the archetype file once more, and links all pointers between |
533 | * archetypes. |
526 | * archetypes. |
… | |
… | |
575 | { |
568 | { |
576 | if (at != NULL) |
569 | if (at != NULL) |
577 | { |
570 | { |
578 | treasurelist * |
571 | treasurelist * |
579 | tl = find_treasurelist (argument); |
572 | tl = find_treasurelist (argument); |
|
|
573 | |
580 | if (tl == NULL) |
574 | if (tl == NULL) |
581 | LOG (llevError, "Failed to link treasure to arch (%s): %s\n", &at->name, argument); |
575 | LOG (llevError, "Failed to link treasure to arch (%s): %s\n", &at->name, argument); |
582 | else |
576 | else |
583 | at->clone.randomitems = tl; |
577 | at->clone.randomitems = tl; |
584 | } |
578 | } |
… | |
… | |
590 | void |
584 | void |
591 | check_generators (void) |
585 | check_generators (void) |
592 | { |
586 | { |
593 | archetype * |
587 | archetype * |
594 | at; |
588 | at; |
|
|
589 | |
595 | for (at = first_archetype; at != NULL; at = at->next) |
590 | for (at = first_archetype; at != NULL; at = at->next) |
596 | if (QUERY_FLAG (&at->clone, FLAG_GENERATOR) && at->clone.other_arch == NULL) |
591 | if (QUERY_FLAG (&at->clone, FLAG_GENERATOR) && at->clone.other_arch == NULL) |
597 | LOG (llevError, "Warning: %s is generator but lacks other_arch.\n", &at->name); |
592 | LOG (llevError, "Warning: %s is generator but lacks other_arch.\n", &at->name); |
598 | } |
593 | } |
599 | #endif |
594 | #endif |
… | |
… | |
608 | void |
603 | void |
609 | load_archetypes (void) |
604 | load_archetypes (void) |
610 | { |
605 | { |
611 | char |
606 | char |
612 | filename[MAX_BUF]; |
607 | filename[MAX_BUF]; |
|
|
608 | |
613 | #if TIME_ARCH_LOAD |
609 | #if TIME_ARCH_LOAD |
614 | struct timeval |
610 | struct timeval |
615 | tv1, |
611 | tv1, |
616 | tv2; |
612 | tv2; |
617 | #endif |
613 | #endif |
… | |
… | |
652 | * Creates and returns a new object which is a copy of the given archetype. |
648 | * Creates and returns a new object which is a copy of the given archetype. |
653 | * This function returns NULL on failure. |
649 | * This function returns NULL on failure. |
654 | */ |
650 | */ |
655 | |
651 | |
656 | object * |
652 | object * |
657 | arch_to_object (archetype * at) |
653 | arch_to_object (archetype *at) |
658 | { |
654 | { |
659 | object * |
655 | object * |
660 | op; |
656 | op; |
|
|
657 | |
661 | if (at == NULL) |
658 | if (at == NULL) |
662 | { |
659 | { |
663 | if (warn_archetypes) |
660 | if (warn_archetypes) |
664 | LOG (llevError, "Couldn't find archetype.\n"); |
661 | LOG (llevError, "Couldn't find archetype.\n"); |
|
|
662 | |
665 | return NULL; |
663 | return NULL; |
666 | } |
664 | } |
|
|
665 | |
667 | op = get_object (); |
666 | op = get_object (); |
668 | copy_object (&at->clone, op); |
667 | copy_object (&at->clone, op); |
|
|
668 | op->arch = at; |
669 | op->instantiate (); |
669 | op->instantiate (); |
670 | op->arch = at; |
|
|
671 | return op; |
670 | return op; |
672 | } |
671 | } |
673 | |
672 | |
674 | /* |
673 | /* |
675 | * Creates an object. This function is called by get_archetype() |
674 | * Creates an object. This function is called by get_archetype() |
… | |
… | |
683 | { |
682 | { |
684 | object * |
683 | object * |
685 | op; |
684 | op; |
686 | char |
685 | char |
687 | buf[MAX_BUF]; |
686 | buf[MAX_BUF]; |
|
|
687 | |
688 | sprintf (buf, "%s (%s)", ARCH_SINGULARITY, name); |
688 | sprintf (buf, "%s (%s)", ARCH_SINGULARITY, name); |
689 | op = get_object (); |
689 | op = get_object (); |
690 | op->name = op->name_pl = buf; |
690 | op->name = op->name_pl = buf; |
691 | SET_FLAG (op, FLAG_NO_PICK); |
691 | SET_FLAG (op, FLAG_NO_PICK); |
692 | return op; |
692 | return op; |
… | |
… | |
700 | object * |
700 | object * |
701 | get_archetype (const char *name) |
701 | get_archetype (const char *name) |
702 | { |
702 | { |
703 | archetype * |
703 | archetype * |
704 | at; |
704 | at; |
|
|
705 | |
705 | at = find_archetype (name); |
706 | at = find_archetype (name); |
706 | if (at == NULL) |
707 | if (at == NULL) |
707 | return create_singularity (name); |
708 | return create_singularity (name); |
|
|
709 | |
708 | return arch_to_object (at); |
710 | return arch_to_object (at); |
709 | } |
711 | } |
710 | |
712 | |
711 | /* |
713 | /* |
712 | * Hash-function used by the arch-hashtable. |
714 | * Hash-function used by the arch-hashtable. |
… | |
… | |
753 | name = shstr::find (name); |
755 | name = shstr::find (name); |
754 | |
756 | |
755 | if (!name) |
757 | if (!name) |
756 | return 0; |
758 | return 0; |
757 | |
759 | |
758 | HT::const_iterator i = ht.find ((size_t)name); |
760 | HT::const_iterator i = ht.find ((size_t) name); |
759 | |
761 | |
760 | if (i == ht.end ()) |
762 | if (i == ht.end ()) |
761 | return 0; |
763 | return 0; |
762 | else |
764 | else |
763 | return i->second; |
765 | return i->second; |
764 | #endif |
766 | #endif |
765 | |
767 | |
766 | archetype *at; |
768 | archetype * |
|
|
769 | at; |
767 | unsigned long index; |
770 | unsigned long |
|
|
771 | index; |
768 | |
772 | |
769 | if (name == NULL) |
773 | if (name == NULL) |
770 | return (archetype *) NULL; |
774 | return (archetype *) NULL; |
771 | |
775 | |
772 | index = hasharch (name, ARCHTABLE); |
776 | index = hasharch (name, ARCHTABLE); |
… | |
… | |
794 | |
798 | |
795 | static void |
799 | static void |
796 | add_arch (archetype *at) |
800 | add_arch (archetype *at) |
797 | { |
801 | { |
798 | #if USE_UNORDERED_MAP |
802 | #if USE_UNORDERED_MAP |
799 | ht.insert (std::make_pair ((size_t)(const char *)at->name, at)); |
803 | ht.insert (std::make_pair ((size_t) (const char *) at->name, at)); |
800 | #endif |
804 | #endif |
801 | |
805 | |
|
|
806 | int |
802 | int index = hasharch ((const char *) at->name, ARCHTABLE), org_index = index; |
807 | index = hasharch ((const char *) at->name, ARCHTABLE), org_index = index; |
803 | |
808 | |
804 | for (;;) |
809 | for (;;) |
805 | { |
810 | { |
806 | if (arch_table[index] == NULL) |
811 | if (arch_table[index] == NULL) |
807 | { |
812 | { |
… | |
… | |
862 | /* |
867 | /* |
863 | * member: make instance from class |
868 | * member: make instance from class |
864 | */ |
869 | */ |
865 | |
870 | |
866 | object * |
871 | object * |
867 | object_create_arch (archetype * at) |
872 | object_create_arch (archetype *at) |
868 | { |
873 | { |
869 | object * |
874 | object * |
870 | op, * |
875 | op, * |
871 | prev = NULL, *head = NULL; |
876 | prev = NULL, *head = NULL; |
872 | |
877 | |