… | |
… | |
399 | } |
399 | } |
400 | |
400 | |
401 | =item cf::periodic $interval, $cb |
401 | =item cf::periodic $interval, $cb |
402 | |
402 | |
403 | Like EV::periodic, but randomly selects a starting point so that the actions |
403 | Like EV::periodic, but randomly selects a starting point so that the actions |
404 | get spread over timer. |
404 | get spread over time. |
405 | |
405 | |
406 | =cut |
406 | =cut |
407 | |
407 | |
408 | sub periodic($$) { |
408 | sub periodic($$) { |
409 | my ($interval, $cb) = @_; |
409 | my ($interval, $cb) = @_; |
… | |
… | |
587 | reset_signals; |
587 | reset_signals; |
588 | &$cb |
588 | &$cb |
589 | }, @args; |
589 | }, @args; |
590 | |
590 | |
591 | wantarray ? @res : $res[-1] |
591 | wantarray ? @res : $res[-1] |
|
|
592 | } |
|
|
593 | |
|
|
594 | sub objinfo { |
|
|
595 | ( |
|
|
596 | "counter value" => cf::object::object_count, |
|
|
597 | "objects created" => cf::object::create_count, |
|
|
598 | "objects destroyed" => cf::object::destroy_count, |
|
|
599 | "freelist size" => cf::object::free_count, |
|
|
600 | "allocated objects" => cf::object::objects_size, |
|
|
601 | "active objects" => cf::object::actives_size, |
|
|
602 | ) |
592 | } |
603 | } |
593 | |
604 | |
594 | =item $coin = coin_from_name $name |
605 | =item $coin = coin_from_name $name |
595 | |
606 | |
596 | =cut |
607 | =cut |
… | |
… | |
3532 | LOG llevInfo, "Welcome to Deliantra, v" . VERSION; |
3543 | LOG llevInfo, "Welcome to Deliantra, v" . VERSION; |
3533 | LOG llevInfo, "Copyright (C) 2005-2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team."; |
3544 | LOG llevInfo, "Copyright (C) 2005-2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team."; |
3534 | LOG llevInfo, "Copyright (C) 1994 Mark Wedel."; |
3545 | LOG llevInfo, "Copyright (C) 1994 Mark Wedel."; |
3535 | LOG llevInfo, "Copyright (C) 1992 Frank Tore Johansen."; |
3546 | LOG llevInfo, "Copyright (C) 1992 Frank Tore Johansen."; |
3536 | |
3547 | |
3537 | cf::init_experience; |
|
|
3538 | cf::init_anim; |
|
|
3539 | cf::init_attackmess; |
|
|
3540 | cf::init_dynamic; |
|
|
3541 | |
|
|
3542 | $Coro::current->prio (Coro::PRIO_MAX); # give the main loop max. priority |
3548 | $Coro::current->prio (Coro::PRIO_MAX); # give the main loop max. priority |
3543 | |
3549 | |
3544 | # we must not ever block the main coroutine |
3550 | # we must not ever block the main coroutine |
3545 | local $Coro::idle = sub { |
3551 | local $Coro::idle = sub { |
3546 | Carp::cluck "FATAL: Coro::idle was called, major BUG, use cf::sync_job!\n";#d# |
3552 | Carp::cluck "FATAL: Coro::idle was called, major BUG, use cf::sync_job!\n";#d# |
… | |
… | |
3551 | }; |
3557 | }; |
3552 | |
3558 | |
3553 | evthread_start IO::AIO::poll_fileno; |
3559 | evthread_start IO::AIO::poll_fileno; |
3554 | |
3560 | |
3555 | cf::sync_job { |
3561 | cf::sync_job { |
|
|
3562 | cf::init_experience; |
|
|
3563 | cf::init_anim; |
|
|
3564 | cf::init_attackmess; |
|
|
3565 | cf::init_dynamic; |
|
|
3566 | |
3556 | cf::load_settings; |
3567 | cf::load_settings; |
3557 | cf::load_materials; |
3568 | cf::load_materials; |
3558 | |
3569 | |
3559 | reload_resources; |
3570 | reload_resources; |
3560 | reload_config; |
3571 | reload_config; |
… | |
… | |
3576 | use POSIX (); |
3587 | use POSIX (); |
3577 | POSIX::close delete $ENV{LOCKUTIL_LOCK_FD} if exists $ENV{LOCKUTIL_LOCK_FD}; |
3588 | POSIX::close delete $ENV{LOCKUTIL_LOCK_FD} if exists $ENV{LOCKUTIL_LOCK_FD}; |
3578 | |
3589 | |
3579 | (pop @POST_INIT)->(0) while @POST_INIT; |
3590 | (pop @POST_INIT)->(0) while @POST_INIT; |
3580 | }; |
3591 | }; |
|
|
3592 | |
|
|
3593 | cf::object::thawer::errors_are_fatal 0; |
3581 | |
3594 | |
3582 | main_loop; |
3595 | main_loop; |
3583 | } |
3596 | } |
3584 | |
3597 | |
3585 | ############################################################################# |
3598 | ############################################################################# |