1 | /* |
1 | /* |
2 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
3 | |
3 | |
|
|
4 | Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | Copyright (C) 1992 Frank Tore Johansen |
6 | Copyright (C) 1992 Frank Tore Johansen |
6 | |
7 | |
7 | This program is free software; you can redistribute it and/or modify |
8 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by |
9 | it under the terms of the GNU General Public License as published by |
… | |
… | |
118 | * If type is -1, ew don't match on type. |
119 | * If type is -1, ew don't match on type. |
119 | */ |
120 | */ |
120 | object * |
121 | object * |
121 | get_archetype_by_skill_name (const char *skill, int type) |
122 | get_archetype_by_skill_name (const char *skill, int type) |
122 | { |
123 | { |
123 | archetype * |
124 | archetype *at; |
124 | at; |
|
|
125 | |
125 | |
126 | if (skill == NULL) |
126 | if (skill) |
127 | return NULL; |
|
|
128 | |
|
|
129 | for (at = first_archetype; at != NULL; at = at->next) |
127 | for (at = first_archetype; at; at = at->next) |
130 | { |
|
|
131 | if (((type == -1) || (type == at->clone.type)) && (!strcmp (at->clone.skill, skill))) |
128 | if (((type == -1) || (type == at->clone.type)) && (!strcmp (at->clone.skill, skill))) |
132 | return arch_to_object (at); |
129 | return arch_to_object (at); |
133 | } |
130 | |
134 | return NULL; |
131 | return 0; |
135 | } |
132 | } |
136 | |
133 | |
137 | /* similiar to above - this returns the first archetype |
134 | /* similiar to above - this returns the first archetype |
138 | * that matches both the type and subtype. type and subtype |
135 | * 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 |
136 | * can be -1 to say ignore, but in this case, the match it does |
… | |
… | |
179 | for (i = strlen (tmpname); i > 0; i--) |
176 | for (i = strlen (tmpname); i > 0; i--) |
180 | { |
177 | { |
181 | tmpname[i] = 0; |
178 | tmpname[i] = 0; |
182 | at = find_archetype_by_object_name (tmpname); |
179 | at = find_archetype_by_object_name (tmpname); |
183 | |
180 | |
184 | if (at != NULL) |
181 | if (at) |
185 | return arch_to_object (at); |
182 | return arch_to_object (at); |
186 | } |
183 | } |
187 | |
184 | |
188 | return create_singularity (name); |
185 | return create_singularity (name); |
189 | } |
186 | } |