1 | #! perl # MANDATORY |
1 | #! perl # mandatory |
2 | |
2 | |
3 | # login handling |
3 | # login handling |
4 | |
4 | |
5 | use Fcntl; |
5 | use Fcntl; |
6 | use Coro::AIO; |
6 | use Coro::AIO; |
7 | use List::Util qw(min max); |
7 | use List::Util qw(min max); |
|
|
8 | |
|
|
9 | our %EXT_SETUP; |
8 | |
10 | |
9 | # paranoia function to overwrite a string-in-place |
11 | # paranoia function to overwrite a string-in-place |
10 | sub nuke_str { |
12 | sub nuke_str { |
11 | substr $_[0], 0, (length $_[0]), "x" x length $_[0] |
13 | substr $_[0], 0, (length $_[0]), "x" x length $_[0] |
12 | } |
14 | } |
… | |
… | |
597 | my $ob = $pl->ob; |
599 | my $ob = $pl->ob; |
598 | |
600 | |
599 | my $pl_ref = $pl->refcnt_cnt; |
601 | my $pl_ref = $pl->refcnt_cnt; |
600 | my $ob_ref = $ob->refcnt_cnt; |
602 | my $ob_ref = $ob->refcnt_cnt; |
601 | |
603 | |
602 | ## pl_ref == object + cf::PLAYER + $pl |
604 | ## pl_ref == $pl + ob->contr + %cf::PLAYER |
603 | ## ob_ref == being an object + pl->observe + $ob |
605 | ## ob_ref == $ob + pl->observe + simply being an object |
604 | if ($pl_ref == 3 && $ob_ref == 3) { |
606 | if ($pl_ref == 3 && $ob_ref == 3) { |
605 | warn "player-scheduler destroy ", $ob->name;#d# |
607 | warn "player-scheduler destroy ", $ob->name;#d# |
606 | |
608 | |
607 | # remove from sight and get fresh "copies" |
609 | # remove from sight and get fresh "copies" |
608 | $pl = delete $cf::PLAYER{$ob->name}; |
610 | $pl = delete $cf::PLAYER{$ob->name}; |
609 | $ob = $pl->ob; |
611 | $ob = $pl->ob; |
610 | |
612 | |
611 | $ob->destroy; |
|
|
612 | $pl->destroy; |
613 | $pl->destroy; # destroys $ob |
613 | } else { |
614 | } else { |
614 | my $a_ = $pl->refcnt;#d# |
615 | my $a_ = $pl->refcnt;#d# |
615 | my $b_ = $ob->refcnt;#d# |
616 | my $b_ = $ob->refcnt;#d# |
616 | |
617 | |
617 | warn "player-scheduler refcnt ", $ob->name, " pp$pl_ref,pc$a_ op$ob_ref,oc$b_\n";#d# |
618 | warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# |
618 | } |
619 | } |
619 | } |
620 | } |
620 | } |
621 | } |
621 | }; |
622 | }; |
622 | warn $@ if $@; |
623 | warn $@ if $@; |