… | |
… | |
902 | * with all the checks in the 'for' portion itself. Much |
902 | * with all the checks in the 'for' portion itself. Much |
903 | * more readable to break some of the conditions out. |
903 | * more readable to break some of the conditions out. |
904 | */ |
904 | */ |
905 | for (tr = spell_ob->randomitems->items; tr; tr = tr->next) |
905 | for (tr = spell_ob->randomitems->items; tr; tr = tr->next) |
906 | { |
906 | { |
|
|
907 | if (!tr->item) |
|
|
908 | continue; |
|
|
909 | |
907 | if (level < tr->magic) |
910 | if (level < tr->magic) |
908 | break; |
911 | break; |
909 | |
912 | |
910 | lasttr = tr; |
913 | lasttr = tr; |
911 | |
914 | |
912 | if (tr->item->name == sparam) |
915 | if (tr->item->name == sparam) |
913 | break; |
|
|
914 | |
|
|
915 | if (!tr->next || !tr->next->item) |
|
|
916 | break; |
916 | break; |
917 | } |
917 | } |
918 | |
918 | |
919 | if (!lasttr) |
919 | if (!lasttr) |
920 | { |
920 | { |
… | |
… | |
922 | new_draw_info (NDI_UNIQUE, 0, op, "The spell fails to summon any monsters."); |
922 | new_draw_info (NDI_UNIQUE, 0, op, "The spell fails to summon any monsters."); |
923 | return 0; |
923 | return 0; |
924 | } |
924 | } |
925 | |
925 | |
926 | summon_arch = lasttr->item; |
926 | summon_arch = lasttr->item; |
927 | nrof = lasttr->nrof; |
927 | nrof = lasttr->nrof; |
928 | } |
928 | } |
929 | else if (spell_ob->race && !strcmp (spell_ob->race, "GODCULTMON")) |
929 | else if (spell_ob->race && !strcmp (spell_ob->race, "GODCULTMON")) |
930 | { |
930 | { |
931 | object *god = find_god (determine_god (op)), *mon, *owner; |
931 | object *god = find_god (determine_god (op)), *mon, *owner; |
932 | int summon_level, tries; |
932 | int summon_level, tries; |