… | |
… | |
105 | $ns->send_drawinfo ( |
105 | $ns->send_drawinfo ( |
106 | "That username is currently used in another login session. " |
106 | "That username is currently used in another login session. " |
107 | . "Chose another, or wait till the other session has ended.", |
107 | . "Chose another, or wait till the other session has ended.", |
108 | cf::NDI_RED |
108 | cf::NDI_RED |
109 | ); |
109 | ); |
110 | } elsif ($user =~ /^[a-zA-Z0-9][a-zA-Z0-9\-_]{2,17}$/) { |
110 | } elsif ($user =~ /^[a-zA-Z0-9][a-zA-Z0-9\-_]{2,17}\z/) { |
111 | last; |
111 | last; |
112 | } else { |
112 | } else { |
113 | $ns->send_drawinfo ( |
113 | $ns->send_drawinfo ( |
114 | "Your username contains illegal characters " |
114 | "Your username contains illegal characters " |
115 | . "(only a-z, A-Z and 0-9 are allowed), " |
115 | . "(only a-z, A-Z and 0-9 are allowed), " |
… | |
… | |
283 | } else { |
283 | } else { |
284 | $ob->reply (undef, |
284 | $ob->reply (undef, |
285 | "Ok, quitting, hope to see you again.", |
285 | "Ok, quitting, hope to see you again.", |
286 | cf::NDI_UNIQUE | cf::NDI_RED); |
286 | cf::NDI_UNIQUE | cf::NDI_RED); |
287 | $pl->ns->flush; |
287 | $pl->ns->flush; |
288 | $pl->quit_character; |
288 | cf::async { $pl->quit_character }; |
289 | } |
289 | } |
290 | }); |
290 | }); |
291 | }; |
291 | }; |
292 | |
292 | |
293 | cf::object->attach ( |
293 | cf::object->attach ( |
… | |
… | |
379 | my $pl_ref = $pl->refcnt_cnt; |
379 | my $pl_ref = $pl->refcnt_cnt; |
380 | my $ob_ref = $ob->refcnt_cnt; |
380 | my $ob_ref = $ob->refcnt_cnt; |
381 | |
381 | |
382 | ## pl_ref == one from object + one from cf::PLAYER |
382 | ## pl_ref == one from object + one from cf::PLAYER |
383 | ## ob_ref == one from simply being an object |
383 | ## ob_ref == one from simply being an object |
384 | #TODO: the above should be correct, understand the 1/0, respectively |
|
|
385 | if ($pl_ref == 1 && $ob_ref == 0) { |
384 | if ($pl_ref == 2 && $ob_ref == 1) { |
386 | warn "player-scheduler destroy ", $ob->name;#d# |
385 | warn "player-scheduler destroy ", $ob->name;#d# |
387 | |
386 | |
388 | # remove from sight and get fresh "copies" |
387 | # remove from sight and get fresh "copies" |
389 | $pl = delete $cf::PLAYER{$ob->name}; |
388 | $pl = delete $cf::PLAYER{$ob->name}; |
390 | $ob = $pl->ob; |
389 | $ob = $pl->ob; |