… | |
… | |
1099 | * Returns spell object (from archetypes) by name. |
1099 | * Returns spell object (from archetypes) by name. |
1100 | * Returns NULL if 0 or more than one spell matches. |
1100 | * Returns NULL if 0 or more than one spell matches. |
1101 | * Used for wizard's learn spell/prayer. |
1101 | * Used for wizard's learn spell/prayer. |
1102 | * |
1102 | * |
1103 | * op is the player issuing the command. |
1103 | * op is the player issuing the command. |
1104 | * |
|
|
1105 | * Ignores archetypes "spelldirect_xxx" since these archetypes are not used |
|
|
1106 | * anymore (but may still be present in some player's inventories and thus |
|
|
1107 | * cannot be removed). We have to ignore them here since they have the same |
|
|
1108 | * name than other "spell_xxx" archetypes and would always conflict. |
|
|
1109 | */ |
1104 | */ |
1110 | static object * |
1105 | static object * |
1111 | get_spell_by_name (object *op, const char *spell_name) |
1106 | get_spell_by_name (object *op, const char *spell_name) |
1112 | { |
1107 | { |
1113 | archetype *at; |
1108 | archetype *at; |
… | |
… | |
1121 | for_all_archetypes (at) |
1116 | for_all_archetypes (at) |
1122 | { |
1117 | { |
1123 | if (at->type != SPELL) |
1118 | if (at->type != SPELL) |
1124 | continue; |
1119 | continue; |
1125 | |
1120 | |
1126 | if (strncmp (at->archname, "spelldirect_", 12) == 0) |
|
|
1127 | continue; |
|
|
1128 | |
|
|
1129 | if (strcmp (at->object::name, spell_name) != 0) |
1121 | if (strcmp (at->object::name, spell_name) != 0) |
1130 | continue; |
1122 | continue; |
1131 | |
1123 | |
1132 | if (found != NULL) |
1124 | if (found) |
1133 | { |
1125 | { |
1134 | if (!conflict_found) |
1126 | if (!conflict_found) |
1135 | { |
1127 | { |
1136 | conflict_found = 1; |
1128 | conflict_found = 1; |
1137 | new_draw_info_format (NDI_UNIQUE, 0, op, "More than one archetype matches the spell name %s:", spell_name); |
1129 | new_draw_info_format (NDI_UNIQUE, 0, op, "More than one archetype matches the spell name %s:", spell_name); |