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.12 by root, Sun Jan 7 21:54:59 2007 UTC vs.
Revision 1.15 by root, Mon Jan 8 12:23:32 2007 UTC

158 nuke_str $pass; 158 nuke_str $pass;
159 # password matches, wonderful 159 # password matches, wonderful
160 my $pl = cf::player::find $user or next; 160 my $pl = cf::player::find $user or next;
161 $pl->connect ($ns); 161 $pl->connect ($ns);
162 check_clean_save $pl; 162 check_clean_save $pl;
163 $pl->{clean_save} = 1;
163 last; 164 last;
164 } elsif (can_cleanup $buf, $mtime) { 165 } elsif (can_cleanup $buf, $mtime) {
165 Coro::Timer::sleep 1; 166 Coro::Timer::sleep 1;
166 167
167 $ns->send_drawinfo ( 168 $ns->send_drawinfo (
291 on_apply => sub { 292 on_apply => sub {
292 my ($bed, $ob) = @_; 293 my ($bed, $ob) = @_;
293 294
294 return cf::override 0 unless $ob->type == cf::PLAYER; 295 return cf::override 0 unless $ob->type == cf::PLAYER;
295 296
296 my $pl = $ob->pl; 297 my $pl = $ob->contr;
297 298
298 # update respawn position 299 # update respawn position
299 $pl->savebed ($bed->map->path, $bed->x, $bed->y); 300 $pl->savebed ($bed->map->path, $bed->x, $bed->y);
300 301
301 $pl->killer ("left"); 302 $pl->killer ("left");
307 if ($_[0] !~ /^[yY]/) { 308 if ($_[0] !~ /^[yY]/) {
308 $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1); 309 $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1);
309 $pl->deactivate; 310 $pl->deactivate;
310 $pl->ns->destroy; 311 $pl->ns->destroy;
311 } else { 312 } else {
312 cf::async { 313 cf::async { $pl->save };
313 $pl->{clean_save} = 1;
314 $pl->save;
315 };
316 } 314 }
317 }); 315 });
318 }, 316 },
319); 317);
320 318
365 eval { 363 eval {
366 if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { 364 if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) {
367 $pl->save; 365 $pl->save;
368 Coro::Timer::sleep $SAVE_INTERVAL; 366 Coro::Timer::sleep $SAVE_INTERVAL;
369 } 367 }
368 my $ob = $pl->ob;
369 Scalar::Util::weaken $pl; # 2 == from object + from perl
370 Scalar::Util::weaken $ob; # 2 == one from being an object + ???
371 my $a_ = $pl->refcnt;
372 my $b_ = $ob->refcnt;
373 my $a = $pl->refcnt_cnt;
374 my $b = $ob->refcnt_cnt;
375 warn "rc $a,$a_ $b,$b_\n";#d#
370 }; 376 };
371 warn $@ if $@; 377 warn $@ if $@;
372 Coro::cede; 378 Coro::cede;
373 }; 379 };
374 } 380 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines