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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines