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 | } |
… | |
… | |
39 | return unless cf::player::find_active $user; |
41 | return unless cf::player::find_active $user; |
40 | |
42 | |
41 | $ns->send_drawinfo ( |
43 | $ns->send_drawinfo ( |
42 | "That player is already logged in on this server. " |
44 | "That player is already logged in on this server. " |
43 | . "If you want to create a new player, choose another name. " |
45 | . "If you want to create a new player, choose another name. " |
44 | . "If you are already a registered player, make sure nobody " |
46 | . "If you have already a registered, make sure nobody " |
45 | . "else is using your account at this time. If you lost your conenction " |
47 | . "else is using your account at this time. If you lost your connection " |
46 | . "then the server will likely timeout within a minute. If you still " |
48 | . "then the server will likely timeout within a minute. If you still " |
47 | . "cannot log-in after a minute, you are still logged in. Make sure " |
49 | . "cannot log-in after a minute, you are still logged in. Make sure " |
48 | . "you do not have another client running. If you use windows, reboot, " |
50 | . "you do not have another client running. If you use windows, reboot, " |
49 | . "this will fix anything.", |
51 | . "this will fix anything.", |
50 | cf::NDI_RED |
52 | cf::NDI_RED |
… | |
… | |
203 | |
205 | |
204 | } elsif ($k eq "smoothing") { # cfplus-style smoothing |
206 | } elsif ($k eq "smoothing") { # cfplus-style smoothing |
205 | $ns->smoothing ($v); |
207 | $ns->smoothing ($v); |
206 | |
208 | |
207 | } elsif ($k eq "fxix") { |
209 | } elsif ($k eq "fxix") { |
|
|
210 | $v = 2 if $v > 2; |
208 | $ns->fxix ($v); |
211 | $ns->fxix ($v); |
|
|
212 | $setup{$k} = $v; |
209 | |
213 | |
210 | } elsif ($k eq "msg") { |
214 | } elsif ($k eq "msg") { |
|
|
215 | $v = 2 if $v > 2; |
211 | $ns->can_msg ($v); |
216 | $ns->can_msg ($v >= 2); |
|
|
217 | $setup{$k} = $v; |
|
|
218 | |
|
|
219 | } elsif ($k eq "xwidget") { |
|
|
220 | # eXperimental server-side widgets |
|
|
221 | $ns->{can_widget} = 1; |
212 | |
222 | |
213 | } elsif ($k eq "excmd") { |
223 | } elsif ($k eq "excmd") { |
214 | # we support it |
224 | # we support it |
215 | |
225 | |
216 | } else { |
226 | } else { |
… | |
… | |
474 | $pl->chargen_race_next; |
484 | $pl->chargen_race_next; |
475 | } |
485 | } |
476 | |
486 | |
477 | $pl->chargen_race_done; |
487 | $pl->chargen_race_done; |
478 | |
488 | |
|
|
489 | while () { |
|
|
490 | my $res = query $ns, cf::CS_QUERY_SINGLECHAR, |
|
|
491 | "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; |
|
|
492 | |
|
|
493 | if ($res =~ /^[fF]/) { |
|
|
494 | $pl->gender (1); |
|
|
495 | last; |
|
|
496 | } elsif ($res =~ /^[mM]/) { |
|
|
497 | $pl->gender (0); |
|
|
498 | last; |
|
|
499 | } |
|
|
500 | } |
|
|
501 | |
|
|
502 | $ob->reply (undef, "Welcome to Crossfire!"); |
|
|
503 | |
479 | delete $pl->{deny_save}; |
504 | delete $pl->{deny_save}; |
480 | |
505 | |
481 | last; |
506 | last; |
482 | } |
507 | } |
483 | }); |
508 | }); |
… | |
… | |
606 | |
631 | |
607 | # remove from sight and get fresh "copies" |
632 | # remove from sight and get fresh "copies" |
608 | $pl = delete $cf::PLAYER{$ob->name}; |
633 | $pl = delete $cf::PLAYER{$ob->name}; |
609 | $ob = $pl->ob; |
634 | $ob = $pl->ob; |
610 | |
635 | |
611 | $ob->destroy; |
|
|
612 | $pl->destroy; |
636 | $pl->destroy; # destroys $ob |
613 | } else { |
637 | } else { |
614 | my $a_ = $pl->refcnt;#d# |
638 | my $a_ = $pl->refcnt;#d# |
615 | my $b_ = $ob->refcnt;#d# |
639 | my $b_ = $ob->refcnt;#d# |
616 | |
640 | |
617 | warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# |
641 | warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# |