… | |
… | |
467 | } |
467 | } |
468 | |
468 | |
469 | op->key_values = 0; |
469 | op->key_values = 0; |
470 | } |
470 | } |
471 | |
471 | |
472 | void object::clear () |
|
|
473 | { |
|
|
474 | attachable_base::clear (); |
|
|
475 | |
|
|
476 | free_key_values (this); |
|
|
477 | |
|
|
478 | owner = 0; |
|
|
479 | name = 0; |
|
|
480 | name_pl = 0; |
|
|
481 | title = 0; |
|
|
482 | race = 0; |
|
|
483 | slaying = 0; |
|
|
484 | skill = 0; |
|
|
485 | msg = 0; |
|
|
486 | lore = 0; |
|
|
487 | custom_name = 0; |
|
|
488 | materialname = 0; |
|
|
489 | contr = 0; |
|
|
490 | below = 0; |
|
|
491 | above = 0; |
|
|
492 | inv = 0; |
|
|
493 | container = 0; |
|
|
494 | env = 0; |
|
|
495 | more = 0; |
|
|
496 | head = 0; |
|
|
497 | map = 0; |
|
|
498 | active_next = 0; |
|
|
499 | active_prev = 0; |
|
|
500 | |
|
|
501 | memset (static_cast<object_pod *>(this), 0, sizeof (object_pod)); |
|
|
502 | |
|
|
503 | SET_FLAG (this, FLAG_REMOVED); |
|
|
504 | |
|
|
505 | /* What is not cleared is next, prev, and count */ |
|
|
506 | |
|
|
507 | expmul = 1.0; |
|
|
508 | face = blank_face; |
|
|
509 | |
|
|
510 | if (settings.casting_time) |
|
|
511 | casting_time = -1; |
|
|
512 | } |
|
|
513 | |
|
|
514 | /* |
472 | /* |
515 | * copy_to first frees everything allocated by the dst object, |
473 | * copy_to first frees everything allocated by the dst object, |
516 | * and then copies the contents of itself into the second |
474 | * and then copies the contents of itself into the second |
517 | * object, allocating what needs to be allocated. Basically, any |
475 | * object, allocating what needs to be allocated. Basically, any |
518 | * data that is malloc'd needs to be re-malloc/copied. Otherwise, |
476 | * data that is malloc'd needs to be re-malloc/copied. Otherwise, |
… | |
… | |
1012 | /* NO_FIX_PLAYER is set when a great many changes are being |
970 | /* NO_FIX_PLAYER is set when a great many changes are being |
1013 | * made to players inventory. If set, avoiding the call |
971 | * made to players inventory. If set, avoiding the call |
1014 | * to save cpu time. |
972 | * to save cpu time. |
1015 | */ |
973 | */ |
1016 | if ((otmp = in_player ()) && otmp->contr && !QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) |
974 | if ((otmp = in_player ()) && otmp->contr && !QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) |
1017 | fix_player (otmp); |
975 | otmp->update_stats (); |
1018 | |
976 | |
1019 | if (above != NULL) |
977 | if (above != NULL) |
1020 | above->below = below; |
978 | above->below = below; |
1021 | else |
979 | else |
1022 | env->inv = below; |
980 | env->inv = below; |
… | |
… | |
1724 | add_weight (this, (op->weight + op->carrying)); |
1682 | add_weight (this, (op->weight + op->carrying)); |
1725 | |
1683 | |
1726 | otmp = this->in_player (); |
1684 | otmp = this->in_player (); |
1727 | if (otmp && otmp->contr) |
1685 | if (otmp && otmp->contr) |
1728 | if (!QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) |
1686 | if (!QUERY_FLAG (otmp, FLAG_NO_FIX_PLAYER)) |
1729 | fix_player (otmp); |
1687 | otmp->update_stats (); |
1730 | |
1688 | |
1731 | op->map = 0; |
1689 | op->map = 0; |
1732 | op->env = this; |
1690 | op->env = this; |
1733 | op->above = 0; |
1691 | op->above = 0; |
1734 | op->below = 0; |
1692 | op->below = 0; |