… | |
… | |
482 | 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 | |
483 | |
484 | if (chosen_skill) |
484 | if (chosen_skill) |
485 | chosen_skill->flag [FLAG_APPLIED] = true; |
485 | chosen_skill->flag [FLAG_APPLIED] = true; |
486 | |
486 | |
487 | if (ob && !ob->flag [FLAG_APPLIED]) |
|
|
488 | { |
|
|
489 | LOG (llevError | logBacktrace, "%s changed to unapplied weapon %s", |
|
|
490 | &name, ob->debug_desc ()); |
|
|
491 | return false; |
|
|
492 | } |
|
|
493 | |
|
|
494 | update_stats (); |
487 | update_stats (); |
495 | |
488 | |
496 | if (ob) |
489 | if (ob) |
497 | { |
490 | { |
498 | // now check wether any body locations became invalid, in which case |
491 | // now check wether any body locations became invalid, in which case |
… | |
… | |
511 | |
504 | |
512 | //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); |
513 | } |
506 | } |
514 | else |
507 | else |
515 | ;//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 | } |
516 | |
516 | |
517 | return true; |
517 | return true; |
518 | } |
518 | } |
519 | |
519 | |
520 | /* Zero the key_values on op, decrementing the shared-string |
520 | /* Zero the key_values on op, decrementing the shared-string |
… | |
… | |
1665 | LOG (llevError, "Trying to put object in NULL.\n%s\n", dump); |
1665 | LOG (llevError, "Trying to put object in NULL.\n%s\n", dump); |
1666 | free (dump); |
1666 | free (dump); |
1667 | return op; |
1667 | return op; |
1668 | } |
1668 | } |
1669 | |
1669 | |
1670 | if (where->head) |
1670 | if (where->head_ () != where) |
1671 | { |
1671 | { |
1672 | LOG (llevDebug, "Warning: Tried to insert object into wrong part of multipart object.\n"); |
1672 | LOG (llevError | logBacktrace, "Warning: Tried to insert object into wrong part of multipart object.\n"); |
1673 | where = where->head; |
1673 | where = where->head; |
1674 | } |
1674 | } |
1675 | |
1675 | |
1676 | return where->insert (op); |
1676 | return where->insert (op); |
1677 | } |
1677 | } |
… | |
… | |
2005 | for (object *tmp = op->inv; tmp != NULL; tmp = tmp->below) |
2005 | for (object *tmp = op->inv; tmp != NULL; tmp = tmp->below) |
2006 | { |
2006 | { |
2007 | CLEAR_FLAG (tmp, flag); |
2007 | CLEAR_FLAG (tmp, flag); |
2008 | unflag_inv (tmp, flag); |
2008 | unflag_inv (tmp, flag); |
2009 | } |
2009 | } |
2010 | } |
|
|
2011 | |
|
|
2012 | /* |
|
|
2013 | * set_cheat(object) sets the cheat flag (WAS_WIZ) in the object and in |
|
|
2014 | * all it's inventory (recursively). |
|
|
2015 | * If checksums are used, a player will get set_cheat called for |
|
|
2016 | * him/her-self and all object carried by a call to this function. |
|
|
2017 | */ |
|
|
2018 | void |
|
|
2019 | set_cheat (object *op) |
|
|
2020 | { |
|
|
2021 | SET_FLAG (op, FLAG_WAS_WIZ); |
|
|
2022 | flag_inv (op, FLAG_WAS_WIZ); |
|
|
2023 | } |
2010 | } |
2024 | |
2011 | |
2025 | /* |
2012 | /* |
2026 | * 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 |
2027 | * 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 |