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 | } |
… | |
… | |
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 | }); |
… | |
… | |
606 | |
623 | |
607 | # remove from sight and get fresh "copies" |
624 | # remove from sight and get fresh "copies" |
608 | $pl = delete $cf::PLAYER{$ob->name}; |
625 | $pl = delete $cf::PLAYER{$ob->name}; |
609 | $ob = $pl->ob; |
626 | $ob = $pl->ob; |
610 | |
627 | |
611 | $ob->destroy; |
|
|
612 | $pl->destroy; |
628 | $pl->destroy; # destroys $ob |
613 | } else { |
629 | } else { |
614 | my $a_ = $pl->refcnt;#d# |
630 | my $a_ = $pl->refcnt;#d# |
615 | my $b_ = $ob->refcnt;#d# |
631 | my $b_ = $ob->refcnt;#d# |
616 | |
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 $@; |