… | |
… | |
72 | |
72 | |
73 | # make sure c-lzf reinitialises itself |
73 | # make sure c-lzf reinitialises itself |
74 | Compress::LZF::set_serializer "Storable", "Storable::net_mstore", "Storable::mretrieve"; |
74 | Compress::LZF::set_serializer "Storable", "Storable::net_mstore", "Storable::mretrieve"; |
75 | Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later |
75 | Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later |
76 | |
76 | |
|
|
77 | # strictly for debugging |
|
|
78 | $SIG{QUIT} = sub { Carp::cluck "SIGQUIT" }; |
|
|
79 | |
77 | sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload |
80 | sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload |
78 | |
81 | |
79 | our %COMMAND = (); |
82 | our %COMMAND = (); |
80 | our %COMMAND_TIME = (); |
83 | our %COMMAND_TIME = (); |
81 | |
84 | |
… | |
… | |
134 | our $JITTER; # average jitter |
137 | our $JITTER; # average jitter |
135 | our $TICK_START; # for load detecting purposes |
138 | our $TICK_START; # for load detecting purposes |
136 | |
139 | |
137 | our @POST_INIT; |
140 | our @POST_INIT; |
138 | |
141 | |
139 | our $REATTACH_ON_RELOAD; # ste to true to force object reattach on reload (slow) |
142 | our $REATTACH_ON_RELOAD; # set to true to force object reattach on reload (slow) |
|
|
143 | our $REALLY_UNLOOP; # never set to true, please :) |
140 | |
144 | |
141 | binmode STDOUT; |
145 | binmode STDOUT; |
142 | binmode STDERR; |
146 | binmode STDERR; |
143 | |
147 | |
144 | # read virtual server time, if available |
148 | # read virtual server time, if available |
… | |
… | |
2530 | |
2534 | |
2531 | $map->load; |
2535 | $map->load; |
2532 | $map->load_neighbours; |
2536 | $map->load_neighbours; |
2533 | |
2537 | |
2534 | return unless $self->contr->active; |
2538 | return unless $self->contr->active; |
2535 | $self->flag (cf::FLAG_DEBUG, 0);#d# temp |
|
|
2536 | $self->activate_recursive; |
|
|
2537 | |
2539 | |
2538 | local $self->{_prev_pos} = $link_pos; # ugly hack for rent.ext |
2540 | local $self->{_prev_pos} = $link_pos; # ugly hack for rent.ext |
2539 | $self->enter_map ($map, $x, $y); |
2541 | $self->enter_map ($map, $x, $y); |
|
|
2542 | |
|
|
2543 | # only activate afterwards, to support waiting in hooks |
|
|
2544 | $self->activate_recursive; |
2540 | } |
2545 | } |
2541 | |
2546 | |
2542 | =item $player_object->goto ($path, $x, $y[, $check->($map)[, $done->()]]) |
2547 | =item $player_object->goto ($path, $x, $y[, $check->($map)[, $done->()]]) |
2543 | |
2548 | |
2544 | Moves the player to the given map-path and coordinates by first freezing |
2549 | Moves the player to the given map-path and coordinates by first freezing |
… | |
… | |
3400 | |
3405 | |
3401 | seek $fh, 0, 0; |
3406 | seek $fh, 0, 0; |
3402 | print $fh $$; |
3407 | print $fh $$; |
3403 | } |
3408 | } |
3404 | |
3409 | |
|
|
3410 | sub main_loop { |
|
|
3411 | warn "EV::loop starting\n"; |
|
|
3412 | if (1) { |
|
|
3413 | EV::loop; |
|
|
3414 | } |
|
|
3415 | warn "EV::loop returned\n"; |
|
|
3416 | goto &main_loop unless $REALLY_UNLOOP; |
|
|
3417 | } |
|
|
3418 | |
3405 | sub main { |
3419 | sub main { |
3406 | cf::init_globals; # initialise logging |
3420 | cf::init_globals; # initialise logging |
3407 | |
3421 | |
3408 | LOG llevInfo, "Welcome to Deliantra, v" . VERSION; |
3422 | LOG llevInfo, "Welcome to Deliantra, v" . VERSION; |
3409 | LOG llevInfo, "Copyright (C) 2005-2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team."; |
3423 | LOG llevInfo, "Copyright (C) 2005-2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team."; |
… | |
… | |
3447 | load_extensions; |
3461 | load_extensions; |
3448 | |
3462 | |
3449 | utime time, time, $RUNTIMEFILE; |
3463 | utime time, time, $RUNTIMEFILE; |
3450 | |
3464 | |
3451 | # no (long-running) fork's whatsoever before this point(!) |
3465 | # no (long-running) fork's whatsoever before this point(!) |
|
|
3466 | use POSIX (); |
3452 | POSIX::close delete $ENV{LOCKUTIL_LOCK_FD} if exists $ENV{LOCKUTIL_LOCK_FD}; |
3467 | POSIX::close delete $ENV{LOCKUTIL_LOCK_FD} if exists $ENV{LOCKUTIL_LOCK_FD}; |
3453 | |
3468 | |
3454 | (pop @POST_INIT)->(0) while @POST_INIT; |
3469 | (pop @POST_INIT)->(0) while @POST_INIT; |
3455 | }; |
3470 | }; |
3456 | |
3471 | |
3457 | EV::loop; |
3472 | main_loop; |
3458 | } |
3473 | } |
3459 | |
3474 | |
3460 | ############################################################################# |
3475 | ############################################################################# |
3461 | # initialisation and cleanup |
3476 | # initialisation and cleanup |
3462 | |
3477 | |