… | |
… | |
27 | use JSON::XS 2.01 (); |
27 | use JSON::XS 2.01 (); |
28 | use BDB (); |
28 | use BDB (); |
29 | use Data::Dumper; |
29 | use Data::Dumper; |
30 | use Digest::MD5; |
30 | use Digest::MD5; |
31 | use Fcntl; |
31 | use Fcntl; |
32 | use YAML::Syck (); |
32 | use YAML (); |
33 | use IO::AIO 2.51 (); |
33 | use IO::AIO 2.51 (); |
34 | use Time::HiRes; |
34 | use Time::HiRes; |
35 | use Compress::LZF; |
35 | use Compress::LZF; |
36 | use Digest::MD5 (); |
36 | use Digest::MD5 (); |
37 | |
37 | |
38 | # configure various modules to our taste |
38 | # configure various modules to our taste |
39 | # |
39 | # |
40 | $Storable::canonical = 1; # reduce rsync transfers |
40 | $Storable::canonical = 1; # reduce rsync transfers |
41 | Coro::State::cctx_stacksize 256000; # 1-2MB stack, for deep recursions in maze generator |
41 | Coro::State::cctx_stacksize 256000; # 1-2MB stack, for deep recursions in maze generator |
42 | Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later |
42 | Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later |
43 | |
|
|
44 | # work around bug in YAML::Syck - bad news for perl6, will it be as broken wrt. unicode? |
|
|
45 | $YAML::Syck::ImplicitUnicode = 1; |
|
|
46 | |
43 | |
47 | $Coro::main->prio (Coro::PRIO_MAX); # run main coroutine ("the server") with very high priority |
44 | $Coro::main->prio (Coro::PRIO_MAX); # run main coroutine ("the server") with very high priority |
48 | |
45 | |
49 | sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload |
46 | sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload |
50 | |
47 | |
… | |
… | |
3313 | sub reload_config { |
3310 | sub reload_config { |
3314 | open my $fh, "<:utf8", "$CONFDIR/config" |
3311 | open my $fh, "<:utf8", "$CONFDIR/config" |
3315 | or return; |
3312 | or return; |
3316 | |
3313 | |
3317 | local $/; |
3314 | local $/; |
3318 | *CFG = YAML::Syck::Load <$fh>; |
3315 | *CFG = YAML::Load <$fh>; |
3319 | |
3316 | |
3320 | $EMERGENCY_POSITION = $CFG{emergency_position} || ["/world/world_105_115", 5, 37]; |
3317 | $EMERGENCY_POSITION = $CFG{emergency_position} || ["/world/world_105_115", 5, 37]; |
3321 | |
3318 | |
3322 | $cf::map::MAX_RESET = $CFG{map_max_reset} if exists $CFG{map_max_reset}; |
3319 | $cf::map::MAX_RESET = $CFG{map_max_reset} if exists $CFG{map_max_reset}; |
3323 | $cf::map::DEFAULT_RESET = $CFG{map_default_reset} if exists $CFG{map_default_reset}; |
3320 | $cf::map::DEFAULT_RESET = $CFG{map_default_reset} if exists $CFG{map_default_reset}; |