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

Comparing deliantra/server/server/c_object.C (file contents):
Revision 1.50 by root, Mon May 7 07:47:33 2007 UTC vs.
Revision 1.51 by root, Sat May 12 16:06:42 2007 UTC

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 */
131int 130int
138command_disarm (object *op, char *params) 137command_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 */
147int 145int
148command_throw (object *op, char *params) 146command_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
163int 156int
164command_apply (object *op, char *params) 157command_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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines