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.67 by root, Fri Jul 20 16:11:10 2007 UTC vs.
Revision 1.69 by root, Mon Jul 23 17:53:55 2007 UTC

477 }, 477 },
478); 478);
479 479
480############################################################################# 480#############################################################################
481 481
482our $SCHEDULE_INTERVAL = 10; # time the player scheduler sleeps between runs 482our $SCHEDULE_INTERVAL = $cf::CFG{player_schedule_interval} || 10; # time the player scheduler sleeps between runs
483our $SAVE_TIMEOUT = 20; # save players every n seconds 483our $SAVE_TIMEOUT = $cf::CFG{player_save_interval} || 20; # save players every n seconds
484 484
485our $SCHEDULER = cf::async_ext { 485our $SCHEDULER = cf::async_ext {
486 my $schedule_interval = Coro::Event->timer (after => 1, interval => $SCHEDULE_INTERVAL); 486 my $schedule_interval = Coro::Event->timer (after => 1);
487 while () { 487 while () {
488 $schedule_interval->interval ($SCHEDULE_INTERVAL);
488 $schedule_interval->next; 489 $schedule_interval->next;
489 490
490 # this weird form of iteration over values is used because 491 # this weird form of iteration over values is used because
491 # the hash changes underneath us frequently, and for 492 # the hash changes underneath us frequently, and for
492 # keeps a direct reference to the value without (in 5.8 perls) 493 # keeps a direct reference to the value without (in 5.8 perls)
497 or next; 498 or next;
498 $pl->valid or next; 499 $pl->valid or next;
499 500
500 eval { 501 eval {
501 if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { 502 if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) {
502 cf::wait_for_tick_begin;
503 $pl->save; 503 $pl->save;
504 504
505 unless ($pl->active || $pl->ns) { 505 unless ($pl->active || $pl->ns) {
506 # check refcounts, this is tricky and needs to be adjusted to fit server internals 506 # check refcounts, this is tricky and needs to be adjusted to fit server internals
507 my $ob = $pl->ob; 507 my $ob = $pl->ob;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines