… | |
… | |
109 | } |
109 | } |
110 | } |
110 | } |
111 | } |
111 | } |
112 | |
112 | |
113 | static object * |
113 | static object * |
114 | find_skill (object *who, const shstr &name) |
114 | find_skill (object *who, shstr_cmp name) |
115 | { |
115 | { |
116 | if (who->chosen_skill |
116 | if (who->chosen_skill |
117 | && who->chosen_skill->skill == name |
117 | && who->chosen_skill->skill == name |
118 | && who->chosen_skill->type == SKILL) |
118 | && who->chosen_skill->type == SKILL) |
119 | return who->chosen_skill; |
119 | return who->chosen_skill; |
… | |
… | |
123 | return splay (tmp); |
123 | return splay (tmp); |
124 | |
124 | |
125 | return 0; |
125 | return 0; |
126 | } |
126 | } |
127 | |
127 | |
128 | object *player::find_skill (const shstr &name) const |
128 | object *player::find_skill (shstr_cmp name) const |
129 | { |
129 | { |
130 | // might want to use last_skill_obj at one point, or maybe not |
130 | // might want to use last_skill_obj at one point, or maybe not |
131 | return ::find_skill (ob, name); |
131 | return ::find_skill (ob, name); |
132 | } |
|
|
133 | |
|
|
134 | object *player::find_skill (const char *name) const |
|
|
135 | { |
|
|
136 | return find_skill (shstr (name)); |
|
|
137 | } |
132 | } |
138 | |
133 | |
139 | /* This returns the skill pointer of the given name (the |
134 | /* This returns the skill pointer of the given name (the |
140 | * one that accumulates exp, has the level, etc). |
135 | * one that accumulates exp, has the level, etc). |
141 | * |
136 | * |
142 | * It is presumed that the player will be needing to actually |
137 | * It is presumed that the player will be needing to actually |
143 | * use the skill, so thus if use of the skill requires a skill |
138 | * use the skill, so thus if use of the skill requires a skill |
144 | * tool, this code will equip it. |
139 | * tool, this code will equip it. |
145 | */ |
140 | */ |
146 | object * |
141 | object * |
147 | find_skill_by_name (object *who, const shstr &sh) |
142 | find_skill_by_name (object *who, shstr_cmp sh) |
148 | { |
143 | { |
149 | object *skill_tool = 0; |
144 | object *skill_tool = 0; |
150 | |
145 | |
151 | for (object *tmp = who->inv; tmp; tmp = tmp->below) |
146 | for (object *tmp = who->inv; tmp; tmp = tmp->below) |
152 | if (tmp->skill == sh) |
147 | if (tmp->skill == sh) |
… | |
… | |
179 | |
174 | |
180 | return splay (skill); |
175 | return splay (skill); |
181 | } |
176 | } |
182 | |
177 | |
183 | object * |
178 | object * |
184 | find_skill_by_name (object *who, const char *name) |
179 | find_skill_by_name_fuzzy (object *who, const char *name) |
185 | { |
180 | { |
186 | if (!name) |
181 | if (!name) |
187 | return 0; |
182 | return 0; |
188 | |
183 | |
189 | for (object *tmp = who->inv; tmp; tmp = tmp->below) |
184 | for (object *tmp = who->inv; tmp; tmp = tmp->below) |
… | |
… | |
686 | |
681 | |
687 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
682 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
688 | { |
683 | { |
689 | if (tmp->type == SKILL) |
684 | if (tmp->type == SKILL) |
690 | { |
685 | { |
691 | if (search && !strstr (tmp->name, search)) |
686 | if (search && !tmp->name.contains (search)) |
692 | continue; |
687 | continue; |
693 | |
688 | |
694 | char buf[30]; |
689 | char buf[30]; |
695 | |
690 | |
696 | /* Basically want to fill this out to 30 spaces with periods */ |
691 | /* Basically want to fill this out to 30 spaces with periods */ |