ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/login.ext
(Generate patch)

Comparing deliantra/server/ext/login.ext (file contents):
Revision 1.49 by root, Sun Jun 10 03:11:16 2007 UTC vs.
Revision 1.55 by root, Sun Jun 24 01:09:28 2007 UTC

1#! perl # MANDATORY 1#! perl # mandatory
2 2
3# login handling 3# login handling
4 4
5use Fcntl; 5use Fcntl;
6use Coro::AIO; 6use Coro::AIO;
7use List::Util qw(min max); 7use List::Util qw(min max);
8
9our %EXT_SETUP;
8 10
9# paranoia function to overwrite a string-in-place 11# paranoia function to overwrite a string-in-place
10sub nuke_str { 12sub nuke_str {
11 substr $_[0], 0, (length $_[0]), "x" x length $_[0] 13 substr $_[0], 0, (length $_[0]), "x" x length $_[0]
12} 14}
474 $pl->chargen_race_next; 476 $pl->chargen_race_next;
475 } 477 }
476 478
477 $pl->chargen_race_done; 479 $pl->chargen_race_done;
478 480
481 while () {
482 my $res = query $ns, cf::CS_QUERY_SINGLECHAR,
483 "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n";
484
485 if ($res =~ /^[fF]/) {
486 $pl->gender (1);
487 last;
488 } elsif ($res =~ /^[mM]/) {
489 $pl->gender (0);
490 last;
491 }
492 }
493
494 $ob->reply (undef, "Welcome to Crossfire!");
495
479 delete $pl->{deny_save}; 496 delete $pl->{deny_save};
480 497
481 last; 498 last;
482 } 499 }
483 }); 500 });
593 $pl->save; 610 $pl->save;
594 611
595 unless ($pl->active || $pl->ns) { 612 unless ($pl->active || $pl->ns) {
596 # check refcounts, this is tricky and needs to be adjusted to fit server internals 613 # check refcounts, this is tricky and needs to be adjusted to fit server internals
597 my $ob = $pl->ob; 614 my $ob = $pl->ob;
598 Scalar::Util::weaken $pl; 615
599 Scalar::Util::weaken $ob;
600 my $a_ = $pl->refcnt;#d#
601 my $b_ = $ob->refcnt;#d#
602 my $pl_ref = $pl->refcnt_cnt; 616 my $pl_ref = $pl->refcnt_cnt;
603 my $ob_ref = $ob->refcnt_cnt; 617 my $ob_ref = $ob->refcnt_cnt;
604 618
605 ## pl_ref == one from object + one from cf::PLAYER 619 ## pl_ref == $pl + ob->contr + %cf::PLAYER
606 ## ob_ref == one from simply being an object + one from pl->observe 620 ## ob_ref == $ob + pl->observe + simply being an object
607 if ($pl_ref == 2 && $ob_ref == 2) { 621 if ($pl_ref == 3 && $ob_ref == 3) {
608 warn "player-scheduler destroy ", $ob->name;#d# 622 warn "player-scheduler destroy ", $ob->name;#d#
609 623
610 # remove from sight and get fresh "copies" 624 # remove from sight and get fresh "copies"
611 $pl = delete $cf::PLAYER{$ob->name}; 625 $pl = delete $cf::PLAYER{$ob->name};
612 $ob = $pl->ob; 626 $ob = $pl->ob;
613 627
614 $ob->destroy;
615 $pl->destroy; 628 $pl->destroy; # destroys $ob
616 } else { 629 } else {
630 my $a_ = $pl->refcnt;#d#
631 my $b_ = $ob->refcnt;#d#
632
617 warn "player-scheduler refcnt ", $ob->name, " pp$pl_ref,pc$a_ op$ob_ref,oc$b_\n";#d# 633 warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d#
618 } 634 }
619 } 635 }
620 } 636 }
621 }; 637 };
622 warn $@ if $@; 638 warn $@ if $@;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines