ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.473 by root, Fri Jun 26 16:32:10 2009 UTC vs.
Revision 1.476 by root, Wed Sep 2 16:54:20 2009 UTC

72 72
73# make sure c-lzf reinitialises itself 73# make sure c-lzf reinitialises itself
74Compress::LZF::set_serializer "Storable", "Storable::net_mstore", "Storable::mretrieve"; 74Compress::LZF::set_serializer "Storable", "Storable::net_mstore", "Storable::mretrieve";
75Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later 75Compress::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
77sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload 80sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload
78 81
79our %COMMAND = (); 82our %COMMAND = ();
80our %COMMAND_TIME = (); 83our %COMMAND_TIME = ();
81 84
134our $JITTER; # average jitter 137our $JITTER; # average jitter
135our $TICK_START; # for load detecting purposes 138our $TICK_START; # for load detecting purposes
136 139
137our @POST_INIT; 140our @POST_INIT;
138 141
139our $REATTACH_ON_RELOAD; # ste to true to force object reattach on reload (slow) 142our $REATTACH_ON_RELOAD; # set to true to force object reattach on reload (slow)
143our $REALLY_UNLOOP; # never set to true, please :)
140 144
141binmode STDOUT; 145binmode STDOUT;
142binmode STDERR; 146binmode 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
2544Moves the player to the given map-path and coordinates by first freezing 2549Moves 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
3410sub 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
3405sub main { 3419sub 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines