--- deliantra/server/ext/login.ext 2007/05/26 15:44:03 1.48 +++ deliantra/server/ext/login.ext 2007/07/03 01:04:43 1.59 @@ -1,4 +1,4 @@ -#! perl # MANDATORY +#! perl # mandatory # login handling @@ -6,6 +6,8 @@ use Coro::AIO; use List::Util qw(min max); +our %EXT_SETUP; + # paranoia function to overwrite a string-in-place sub nuke_str { substr $_[0], 0, (length $_[0]), "x" x length $_[0] @@ -41,8 +43,8 @@ $ns->send_drawinfo ( "That player is already logged in on this server. " . "If you want to create a new player, choose another name. " - . "If you are already a registered player, make sure nobody " - . "else is using your account at this time. If you lost your conenction " + . "If you have already a registered, make sure nobody " + . "else is using your account at this time. If you lost your connection " . "then the server will likely timeout within a minute. If you still " . "cannot log-in after a minute, you are still logged in. Make sure " . "you do not have another client running. If you use windows, reboot, " @@ -205,10 +207,18 @@ $ns->smoothing ($v); } elsif ($k eq "fxix") { + $v = 2 if $v > 2; $ns->fxix ($v); + $setup{$k} = $v; } elsif ($k eq "msg") { - $ns->can_msg ($v); + $v = 2 if $v > 2; + $ns->can_msg ($v >= 2); + $setup{$k} = $v; + + } elsif ($k eq "xwidget") { + # eXperimental server-side widgets + $ns->{can_widget} = 1; } elsif ($k eq "excmd") { # we support it @@ -476,6 +486,21 @@ $pl->chargen_race_done; + while () { + my $res = query $ns, cf::CS_QUERY_SINGLECHAR, + "Now choose a gender.\nPress 'f' to become female, and 'm' to become male.\n"; + + if ($res =~ /^[fF]/) { + $pl->gender (1); + last; + } elsif ($res =~ /^[mM]/) { + $pl->gender (0); + last; + } + } + + $ob->reply (undef, "Welcome to Crossfire!"); + delete $pl->{deny_save}; last; @@ -592,29 +617,28 @@ cf::wait_for_tick_begin; $pl->save; - unless ($pl->active) { + unless ($pl->active || $pl->ns) { # check refcounts, this is tricky and needs to be adjusted to fit server internals my $ob = $pl->ob; - Scalar::Util::weaken $pl; - Scalar::Util::weaken $ob; - my $a_ = $pl->refcnt;#d# - my $b_ = $ob->refcnt;#d# + my $pl_ref = $pl->refcnt_cnt; my $ob_ref = $ob->refcnt_cnt; - ## pl_ref == one from object + one from cf::PLAYER - ## ob_ref == one from simply being an object - if ($pl_ref == 2 && $ob_ref == 1) { + ## pl_ref == $pl + ob->contr + %cf::PLAYER + ## ob_ref == $ob + pl->observe + simply being an object + if ($pl_ref == 3 && $ob_ref == 3) { warn "player-scheduler destroy ", $ob->name;#d# # remove from sight and get fresh "copies" $pl = delete $cf::PLAYER{$ob->name}; $ob = $pl->ob; - $ob->destroy; - $pl->destroy; + $pl->destroy; # destroys $ob } else { - warn "player-scheduler refcnt ", $ob->name, " pp$pl_ref,pc$a_ op$ob_ref,oc$b_\n";#d# + my $a_ = $pl->refcnt;#d# + my $b_ = $ob->refcnt;#d# + + warn "player-scheduler refcnt ", $ob->name, " pl $pl_ref ob $ob_ref (C pl $a_ ob $b_)\n";#d# } } }