… | |
… | |
118 | * If type is -1, ew don't match on type. |
118 | * If type is -1, ew don't match on type. |
119 | */ |
119 | */ |
120 | object * |
120 | object * |
121 | get_archetype_by_skill_name (const char *skill, int type) |
121 | get_archetype_by_skill_name (const char *skill, int type) |
122 | { |
122 | { |
123 | archetype * |
123 | archetype *at; |
124 | at; |
|
|
125 | |
124 | |
126 | if (skill == NULL) |
125 | if (skill) |
127 | return NULL; |
|
|
128 | |
|
|
129 | for (at = first_archetype; at != NULL; at = at->next) |
126 | for (at = first_archetype; at; at = at->next) |
130 | { |
|
|
131 | if (((type == -1) || (type == at->clone.type)) && (!strcmp (at->clone.skill, skill))) |
127 | if (((type == -1) || (type == at->clone.type)) && (!strcmp (at->clone.skill, skill))) |
132 | return arch_to_object (at); |
128 | return arch_to_object (at); |
133 | } |
129 | |
134 | return NULL; |
130 | return 0; |
135 | } |
131 | } |
136 | |
132 | |
137 | /* similiar to above - this returns the first archetype |
133 | /* similiar to above - this returns the first archetype |
138 | * that matches both the type and subtype. type and subtype |
134 | * that matches both the type and subtype. type and subtype |
139 | * can be -1 to say ignore, but in this case, the match it does |
135 | * can be -1 to say ignore, but in this case, the match it does |
… | |
… | |
179 | for (i = strlen (tmpname); i > 0; i--) |
175 | for (i = strlen (tmpname); i > 0; i--) |
180 | { |
176 | { |
181 | tmpname[i] = 0; |
177 | tmpname[i] = 0; |
182 | at = find_archetype_by_object_name (tmpname); |
178 | at = find_archetype_by_object_name (tmpname); |
183 | |
179 | |
184 | if (at != NULL) |
180 | if (at) |
185 | return arch_to_object (at); |
181 | return arch_to_object (at); |
186 | } |
182 | } |
187 | |
183 | |
188 | return create_singularity (name); |
184 | return create_singularity (name); |
189 | } |
185 | } |