… | |
… | |
731 | } |
731 | } |
732 | |
732 | |
733 | /* init_mon_info() - creates the linked list of pointers to |
733 | /* init_mon_info() - creates the linked list of pointers to |
734 | * monster archetype objects if not called previously |
734 | * monster archetype objects if not called previously |
735 | */ |
735 | */ |
736 | |
|
|
737 | static void |
736 | static void |
738 | init_mon_info (void) |
737 | init_mon_info () |
739 | { |
738 | { |
740 | archetype *at; |
739 | archetype *at; |
741 | static int did_init_mon_info = 0; |
740 | static int did_init_mon_info = 0; |
742 | |
741 | |
743 | if (did_init_mon_info) |
742 | if (did_init_mon_info) |
744 | return; |
743 | return; |
745 | |
744 | |
746 | did_init_mon_info = 1; |
745 | did_init_mon_info = 1; |
747 | |
746 | |
748 | for_all_archetypes (at) |
747 | for_all_archetypes (at) |
749 | { |
748 | if (at->flag [FLAG_MONSTER] |
750 | if (QUERY_FLAG (at, FLAG_MONSTER) && (!QUERY_FLAG (at, FLAG_CHANGING) || QUERY_FLAG (at, FLAG_UNAGGRESSIVE))) |
749 | && at->is_head () |
|
|
750 | && (!at->flag [FLAG_CHANGING] || at->flag [FLAG_UNAGGRESSIVE])) |
751 | { |
751 | { |
752 | objectlink *mon = new objectlink; |
752 | objectlink *mon = new objectlink; |
753 | |
753 | |
754 | mon->ob = at; |
754 | mon->ob = at; |
755 | mon->next = first_mon_info; |
755 | mon->next = first_mon_info; |
756 | first_mon_info = mon; |
756 | first_mon_info = mon; |
757 | nrofmon++; |
757 | nrofmon++; |
758 | } |
758 | } |
759 | } |
|
|
760 | |
759 | |
761 | LOG (llevDebug, "init_mon_info() got %d monsters\n", nrofmon); |
760 | LOG (llevDebug, "init_mon_info() got %d monsters\n", nrofmon); |
762 | } |
761 | } |
763 | |
762 | |
764 | /* init_readable() - initialise linked lists utilized by |
763 | /* init_readable() - initialise linked lists utilized by |
… | |
… | |
1215 | break; |
1214 | break; |
1216 | |
1215 | |
1217 | /* didn't find a match */ |
1216 | /* didn't find a match */ |
1218 | if (!mon) |
1217 | if (!mon) |
1219 | return NULL; |
1218 | return NULL; |
|
|
1219 | |
1220 | if (mon->next) |
1220 | if (mon->next) |
1221 | return mon->next->ob; |
1221 | return mon->next->ob; |
1222 | else |
1222 | else |
1223 | return first_mon_info->ob; |
1223 | return first_mon_info->ob; |
1224 | |
1224 | |