… | |
… | |
121 | } |
121 | } |
122 | |
122 | |
123 | return change_skill (pl, skill, 0); |
123 | return change_skill (pl, skill, 0); |
124 | } |
124 | } |
125 | |
125 | |
126 | |
|
|
127 | /* These functions (command_search, command_disarm) are really just wrappers for |
126 | /* These functions (command_search, command_disarm) are really just wrappers for |
128 | * things like 'use_skill ...'). In fact, they should really be obsoleted |
127 | * things like 'use_skill ...'). In fact, they should really be obsoleted |
129 | * and replaced with those. |
128 | * and replaced with those. |
130 | */ |
129 | */ |
131 | int |
130 | int |
… | |
… | |
138 | command_disarm (object *op, char *params) |
137 | command_disarm (object *op, char *params) |
139 | { |
138 | { |
140 | return use_skill (op, skill_names[SK_DISARM_TRAPS]); |
139 | return use_skill (op, skill_names[SK_DISARM_TRAPS]); |
141 | } |
140 | } |
142 | |
141 | |
143 | |
|
|
144 | /* A little special because we do want to pass the full params along |
142 | /* A little special because we do want to pass the full params along |
145 | * as it includes the object to throw. |
143 | * as it includes the object to throw. |
146 | */ |
144 | */ |
147 | int |
145 | int |
148 | command_throw (object *op, char *params) |
146 | command_throw (object *op, char *params) |
149 | { |
147 | { |
150 | object *skop; |
|
|
151 | |
|
|
152 | skop = find_skill_by_name (op, skill_names[SK_THROWING]); |
148 | if (object *skop = find_skill_by_name (op, skill_names[SK_THROWING])) |
153 | if (skop) |
|
|
154 | return do_skill (op, op, skop, op->facing, params); |
149 | return do_skill (op, op, skop, op->facing, params); |
155 | else |
150 | else |
156 | { |
|
|
157 | new_draw_info (NDI_UNIQUE, 0, op, "You have no knowledge of the skill throwing."); |
151 | new_draw_info (NDI_UNIQUE, 0, op, "You have no knowledge of the skill throwing."); |
158 | } |
152 | |
159 | return 0; |
153 | return 0; |
160 | } |
154 | } |
161 | |
|
|
162 | |
155 | |
163 | int |
156 | int |
164 | command_apply (object *op, char *params) |
157 | command_apply (object *op, char *params) |
165 | { |
158 | { |
166 | if (!params) |
159 | if (!params) |
… | |
… | |
168 | player_apply_below (op); |
161 | player_apply_below (op); |
169 | return 0; |
162 | return 0; |
170 | } |
163 | } |
171 | else |
164 | else |
172 | { |
165 | { |
173 | apply_flag aflag = (apply_flag) 0; |
166 | apply_flag aflag = (apply_flag)0; |
174 | object *inv; |
|
|
175 | |
167 | |
176 | while (*params == ' ') |
168 | while (*params == ' ') |
177 | params++; |
169 | params++; |
|
|
170 | |
178 | if (!strncmp (params, "-a ", 3)) |
171 | if (!strncmp (params, "-a ", 3)) |
179 | { |
172 | { |
180 | aflag = AP_APPLY; |
173 | aflag = AP_APPLY; |
181 | params += 3; |
174 | params += 3; |
182 | } |
175 | } |
|
|
176 | |
183 | if (!strncmp (params, "-u ", 3)) |
177 | if (!strncmp (params, "-u ", 3)) |
184 | { |
178 | { |
185 | aflag = AP_UNAPPLY; |
179 | aflag = AP_UNAPPLY; |
186 | params += 3; |
180 | params += 3; |
187 | } |
181 | } |
|
|
182 | |
188 | while (*params == ' ') |
183 | while (*params == ' ') |
189 | params++; |
184 | params++; |
190 | |
185 | |
191 | inv = find_best_apply_object_match (op, params, aflag); |
186 | if (object *inv = find_best_apply_object_match (op, params, aflag)) |
192 | if (inv) |
|
|
193 | { |
|
|
194 | player_apply (op, inv, aflag, 0); |
187 | player_apply (op, inv, aflag, 0); |
195 | } |
|
|
196 | else |
188 | else |
197 | new_draw_info_format (NDI_UNIQUE, 0, op, "Could not find any match to the %s.", params); |
189 | new_draw_info_format (NDI_UNIQUE, 0, op, "Could not find any match to the %s.", params); |
198 | } |
190 | } |
|
|
191 | |
199 | return 0; |
192 | return 0; |
200 | } |
193 | } |
201 | |
194 | |
202 | /* |
195 | /* |
203 | * Check if an item op can be put into a sack. If pl exists then tell |
196 | * Check if an item op can be put into a sack. If pl exists then tell |