… | |
… | |
473 | object::change_weapon (object *ob) |
473 | object::change_weapon (object *ob) |
474 | { |
474 | { |
475 | if (current_weapon == ob) |
475 | if (current_weapon == ob) |
476 | return true; |
476 | return true; |
477 | |
477 | |
|
|
478 | if (chosen_skill) |
|
|
479 | chosen_skill->flag [FLAG_APPLIED] = false; |
|
|
480 | |
478 | current_weapon = ob; |
481 | current_weapon = ob; |
479 | chosen_skill = !ob || ob->type == SKILL ? ob : find_skill_by_name (this, ob->skill); |
482 | chosen_skill = !ob || ob->type == SKILL ? ob : find_skill_by_name (this, ob->skill); |
|
|
483 | |
|
|
484 | if (chosen_skill) |
|
|
485 | chosen_skill->flag [FLAG_APPLIED] = true; |
480 | |
486 | |
481 | update_stats (); |
487 | update_stats (); |
482 | |
488 | |
483 | if (ob) |
489 | if (ob) |
484 | { |
490 | { |
… | |
… | |
498 | |
504 | |
499 | //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); |
505 | //new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); |
500 | } |
506 | } |
501 | else |
507 | else |
502 | ;//new_draw_info_format (NDI_UNIQUE, 0, this, "You unwield your weapons."); |
508 | ;//new_draw_info_format (NDI_UNIQUE, 0, this, "You unwield your weapons."); |
|
|
509 | |
|
|
510 | if (ob && !ob->flag [FLAG_APPLIED] && ob->type != SPELL) |
|
|
511 | { |
|
|
512 | LOG (llevError | logBacktrace, "%s changed to unapplied weapon %s", |
|
|
513 | &name, ob->debug_desc ()); |
|
|
514 | return false; |
|
|
515 | } |
503 | |
516 | |
504 | return true; |
517 | return true; |
505 | } |
518 | } |
506 | |
519 | |
507 | /* Zero the key_values on op, decrementing the shared-string |
520 | /* Zero the key_values on op, decrementing the shared-string |
… | |
… | |
1992 | for (object *tmp = op->inv; tmp != NULL; tmp = tmp->below) |
2005 | for (object *tmp = op->inv; tmp != NULL; tmp = tmp->below) |
1993 | { |
2006 | { |
1994 | CLEAR_FLAG (tmp, flag); |
2007 | CLEAR_FLAG (tmp, flag); |
1995 | unflag_inv (tmp, flag); |
2008 | unflag_inv (tmp, flag); |
1996 | } |
2009 | } |
1997 | } |
|
|
1998 | |
|
|
1999 | /* |
|
|
2000 | * set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in |
|
|
2001 | * all it's inventory (recursively). |
|
|
2002 | * If checksums are used, a player will get set_cheat called for |
|
|
2003 | * him/her-self and all object carried by a call to this function. |
|
|
2004 | */ |
|
|
2005 | void |
|
|
2006 | set_cheat (object *op) |
|
|
2007 | { |
|
|
2008 | SET_FLAG (op, FLAG_WAS_WIZ); |
|
|
2009 | flag_inv (op, FLAG_WAS_WIZ); |
|
|
2010 | } |
2010 | } |
2011 | |
2011 | |
2012 | /* |
2012 | /* |
2013 | * find_free_spot(object, map, x, y, start, stop) will search for |
2013 | * find_free_spot(object, map, x, y, start, stop) will search for |
2014 | * a spot at the given map and coordinates which will be able to contain |
2014 | * a spot at the given map and coordinates which will be able to contain |