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.73 by root, Thu Jan 1 19:42:43 2009 UTC vs.
Revision 1.75 by elmex, Sun Jan 4 20:23:07 2009 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * 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
260 */ 260 */
261int 261int
262do_skill (object *op, object *part, object *skill, int dir, const char *string) 262do_skill (object *op, object *part, object *skill, int dir, const char *string)
263{ 263{
264 int success = 0, exp = 0; 264 int success = 0, exp = 0;
265 int did_alc = 0;
266 265
267 if (!skill) 266 if (!skill)
268 return 0; 267 return 0;
269 268
270 /* The code below presumes that the skill points to the object that 269 /* The code below presumes that the skill points to the object that
395 case SK_LITERACY: 394 case SK_LITERACY:
396 case SK_WOODSMAN: 395 case SK_WOODSMAN:
397 /* first, we try to find a cauldron, and do the alchemy thing. 396 /* first, we try to find a cauldron, and do the alchemy thing.
398 * failing that, we go and identify stuff. 397 * failing that, we go and identify stuff.
399 */ 398 */
399 {
400 bool found_cauldron = false;
401
400 for (object *next, *tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = next) 402 for (object *next, *tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = next)
401 { 403 {
402 next = tmp->above; 404 next = tmp->above;
403 405
404 if (QUERY_FLAG (tmp, FLAG_IS_CAULDRON)) 406 if (QUERY_FLAG (tmp, FLAG_IS_CAULDRON))
405 { 407 {
408 found_cauldron = true;
409
410 if (tmp->skill != skill->skill)
411 {
412 op->failmsg (format ("You can't use the %s with the %s skill!",
413 query_name (tmp),
414 query_name (skill)));
415 break;
416 }
417
406 attempt_do_alchemy (op, tmp); 418 attempt_do_alchemy (op, tmp, skill);
407 419
408 if (QUERY_FLAG (tmp, FLAG_APPLIED)) 420 if (QUERY_FLAG (tmp, FLAG_APPLIED))
409 esrv_send_inventory (op, tmp); 421 esrv_send_inventory (op, tmp);
410
411 did_alc = 1;
412 } 422 }
413 } 423 }
414 424
415 if (did_alc == 0) 425 if (!found_cauldron)
416 exp = success = skill_ident (op, skill); 426 exp = success = skill_ident (op, skill);
417 427 }
418 break; 428 break;
419 429
420 case SK_DET_MAGIC: 430 case SK_DET_MAGIC:
421 case SK_DET_CURSE: 431 case SK_DET_CURSE:
422 exp = success = skill_ident (op, skill); 432 exp = success = skill_ident (op, skill);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines