… | |
… | |
593 | $pl->save; |
593 | $pl->save; |
594 | |
594 | |
595 | unless ($pl->active || $pl->ns) { |
595 | unless ($pl->active || $pl->ns) { |
596 | # check refcounts, this is tricky and needs to be adjusted to fit server internals |
596 | # check refcounts, this is tricky and needs to be adjusted to fit server internals |
597 | my $ob = $pl->ob; |
597 | my $ob = $pl->ob; |
598 | Scalar::Util::weaken $pl; |
598 | |
599 | Scalar::Util::weaken $ob; |
|
|
600 | my $a_ = $pl->refcnt;#d# |
|
|
601 | my $b_ = $ob->refcnt;#d# |
|
|
602 | my $pl_ref = $pl->refcnt_cnt; |
599 | my $pl_ref = $pl->refcnt_cnt; |
603 | my $ob_ref = $ob->refcnt_cnt; |
600 | my $ob_ref = $ob->refcnt_cnt; |
604 | |
601 | |
605 | ## pl_ref == one from object + one from cf::PLAYER |
602 | ## pl_ref == $pl + ob->contr + %cf::PLAYER |
606 | ## ob_ref == one from simply being an object + one from pl->observe |
603 | ## ob_ref == $ob + pl->observe + simply being an object |
607 | if ($pl_ref == 2 && $ob_ref == 2) { |
604 | if ($pl_ref == 3 && $ob_ref == 3) { |
608 | warn "player-scheduler destroy ", $ob->name;#d# |
605 | warn "player-scheduler destroy ", $ob->name;#d# |
609 | |
606 | |
610 | # remove from sight and get fresh "copies" |
607 | # remove from sight and get fresh "copies" |
611 | $pl = delete $cf::PLAYER{$ob->name}; |
608 | $pl = delete $cf::PLAYER{$ob->name}; |
612 | $ob = $pl->ob; |
609 | $ob = $pl->ob; |
613 | |
610 | |
614 | $ob->destroy; |
611 | $ob->destroy; |
615 | $pl->destroy; |
612 | $pl->destroy; |
616 | } else { |
613 | } else { |
|
|
614 | my $a_ = $pl->refcnt;#d# |
|
|
615 | my $b_ = $ob->refcnt;#d# |
|
|
616 | |
617 | warn "player-scheduler refcnt ", $ob->name, " pp$pl_ref,pc$a_ op$ob_ref,oc$b_\n";#d# |
617 | warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# |
618 | } |
618 | } |
619 | } |
619 | } |
620 | } |
620 | } |
621 | }; |
621 | }; |
622 | warn $@ if $@; |
622 | warn $@ if $@; |