ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/skill_util.C
(Generate patch)

Comparing deliantra/server/server/skill_util.C (file contents):
Revision 1.69 by root, Sun Nov 16 03:52:13 2008 UTC vs.
Revision 1.73 by root, Thu Jan 1 19:42:43 2009 UTC

109 } 109 }
110 } 110 }
111} 111}
112 112
113static object * 113static object *
114find_skill (object *who, const shstr &name) 114find_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
128object *player::find_skill (const shstr &name) const 128object *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
134object *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 */
146object * 141object *
147find_skill_by_name (object *who, const shstr &sh) 142find_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
183object * 178object *
184find_skill_by_name (object *who, const char *name) 179find_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)
190 if ((tmp->type == SKILL || tmp->type == SKILL_TOOL) 185 if ((tmp->type == SKILL || tmp->type == SKILL_TOOL)
191 && tmp->skill.begins_with (name)) 186 && tmp->skill.starts_with (name))
192 if (object *skop = find_skill_by_name (who, tmp->skill)) 187 if (object *skop = find_skill_by_name (who, tmp->skill))
193 return skop; 188 return skop;
194 189
195 return 0; 190 return 0;
196} 191}
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 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines