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.56 by root, Sun Jun 24 04:09:29 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}
206 208
207 } elsif ($k eq "fxix") { 209 } elsif ($k eq "fxix") {
208 $ns->fxix ($v); 210 $ns->fxix ($v);
209 211
210 } elsif ($k eq "msg") { 212 } elsif ($k eq "msg") {
211 $ns->can_msg ($v); 213 $ns->can_msg ($v >= 2);
214 $setup{$k} = $ns->can_msg;
212 215
213 } elsif ($k eq "excmd") { 216 } elsif ($k eq "excmd") {
214 # we support it 217 # we support it
215 218
216 } else { 219 } else {
474 $pl->chargen_race_next; 477 $pl->chargen_race_next;
475 } 478 }
476 479
477 $pl->chargen_race_done; 480 $pl->chargen_race_done;
478 481
482 while () {
483 my $res = query $ns, cf::CS_QUERY_SINGLECHAR,
484 "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n";
485
486 if ($res =~ /^[fF]/) {
487 $pl->gender (1);
488 last;
489 } elsif ($res =~ /^[mM]/) {
490 $pl->gender (0);
491 last;
492 }
493 }
494
495 $ob->reply (undef, "Welcome to Crossfire!");
496
479 delete $pl->{deny_save}; 497 delete $pl->{deny_save};
480 498
481 last; 499 last;
482 } 500 }
483 }); 501 });
593 $pl->save; 611 $pl->save;
594 612
595 unless ($pl->active || $pl->ns) { 613 unless ($pl->active || $pl->ns) {
596 # check refcounts, this is tricky and needs to be adjusted to fit server internals 614 # check refcounts, this is tricky and needs to be adjusted to fit server internals
597 my $ob = $pl->ob; 615 my $ob = $pl->ob;
598 Scalar::Util::weaken $pl; 616
599 Scalar::Util::weaken $ob;
600 my $a_ = $pl->refcnt;#d#
601 my $b_ = $ob->refcnt;#d#
602 my $pl_ref = $pl->refcnt_cnt; 617 my $pl_ref = $pl->refcnt_cnt;
603 my $ob_ref = $ob->refcnt_cnt; 618 my $ob_ref = $ob->refcnt_cnt;
604 619
605 ## pl_ref == one from object + one from cf::PLAYER 620 ## pl_ref == $pl + ob->contr + %cf::PLAYER
606 ## ob_ref == one from simply being an object + one from pl->observe 621 ## ob_ref == $ob + pl->observe + simply being an object
607 if ($pl_ref == 2 && $ob_ref == 2) { 622 if ($pl_ref == 3 && $ob_ref == 3) {
608 warn "player-scheduler destroy ", $ob->name;#d# 623 warn "player-scheduler destroy ", $ob->name;#d#
609 624
610 # remove from sight and get fresh "copies" 625 # remove from sight and get fresh "copies"
611 $pl = delete $cf::PLAYER{$ob->name}; 626 $pl = delete $cf::PLAYER{$ob->name};
612 $ob = $pl->ob; 627 $ob = $pl->ob;
613 628
614 $ob->destroy;
615 $pl->destroy; 629 $pl->destroy; # destroys $ob
616 } else { 630 } else {
631 my $a_ = $pl->refcnt;#d#
632 my $b_ = $ob->refcnt;#d#
633
617 warn "player-scheduler refcnt ", $ob->name, " pp$pl_ref,pc$a_ op$ob_ref,oc$b_\n";#d# 634 warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d#
618 } 635 }
619 } 636 }
620 } 637 }
621 }; 638 };
622 warn $@ if $@; 639 warn $@ if $@;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines