… | |
… | |
4 | use strict; |
4 | use strict; |
5 | |
5 | |
6 | use Symbol; |
6 | use Symbol; |
7 | use List::Util; |
7 | use List::Util; |
8 | use Storable; |
8 | use Storable; |
|
|
9 | use Event; |
9 | use Opcode; |
10 | use Opcode; |
10 | use Safe; |
11 | use Safe; |
11 | use Safe::Hole; |
12 | use Safe::Hole; |
12 | |
13 | |
13 | use Coro 3.5 (); |
14 | use Coro 3.52 (); |
|
|
15 | use Coro::State; |
14 | use Coro::Event; |
16 | use Coro::Event; |
15 | use Coro::Timer; |
17 | use Coro::Timer; |
16 | use Coro::Signal; |
18 | use Coro::Signal; |
17 | use Coro::Semaphore; |
19 | use Coro::Semaphore; |
18 | use Coro::AIO; |
20 | use Coro::AIO; |
… | |
… | |
24 | use IO::AIO 2.32 (); |
26 | use IO::AIO 2.32 (); |
25 | use YAML::Syck (); |
27 | use YAML::Syck (); |
26 | use Time::HiRes; |
28 | use Time::HiRes; |
27 | use Compress::LZF; |
29 | use Compress::LZF; |
28 | |
30 | |
|
|
31 | Coro::State::cctx_stacksize 256000; # 1-2MB stack, for deep recursions in maze generator |
29 | Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later |
32 | Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later |
30 | |
|
|
31 | use Event; $Event::Eval = 1; # no idea why this is required, but it is |
33 | $Event::Eval = 1; # no idea why this is required, but it is |
32 | |
34 | |
33 | sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload |
35 | sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload |
34 | |
36 | |
35 | # work around bug in YAML::Syck - bad news for perl6, will it be as broken wrt. unicode? |
37 | # work around bug in YAML::Syck - bad news for perl6, will it be as broken wrt. unicode? |
36 | $YAML::Syck::ImplicitUnicode = 1; |
38 | $YAML::Syck::ImplicitUnicode = 1; |
… | |
… | |
1993 | |
1995 | |
1994 | sub cf::client::send_drawinfo { |
1996 | sub cf::client::send_drawinfo { |
1995 | my ($self, $text, $flags) = @_; |
1997 | my ($self, $text, $flags) = @_; |
1996 | |
1998 | |
1997 | utf8::encode $text; |
1999 | utf8::encode $text; |
1998 | $self->send_packet (sprintf "drawinfo %d %s", $flags, $text); |
2000 | $self->send_packet (sprintf "drawinfo %d %s", $flags || cf::NDI_BLACK, $text); |
1999 | } |
2001 | } |
2000 | |
2002 | |
2001 | |
2003 | |
2002 | =item $success = $client->query ($flags, "text", \&cb) |
2004 | =item $success = $client->query ($flags, "text", \&cb) |
2003 | |
2005 | |
… | |
… | |
2280 | |
2282 | |
2281 | Coro::cede; |
2283 | Coro::cede; |
2282 | $faces = Storable::thaw $faces; |
2284 | $faces = Storable::thaw $faces; |
2283 | Coro::cede; |
2285 | Coro::cede; |
2284 | |
2286 | |
|
|
2287 | my $meta = delete $faces->{""}; |
|
|
2288 | $meta->{version} == 1 |
|
|
2289 | or cf::cleanup "$path: version mismatch, cannot proceed."; |
|
|
2290 | |
2285 | while (my ($face, $info) = each %$faces) { |
2291 | while (my ($face, $info) = each %$faces) { |
2286 | my $idx = (cf::face::find $face) || cf::face::alloc $face; |
2292 | my $idx = (cf::face::find $face) || cf::face::alloc $face; |
2287 | cf::face::set $idx, $info->{visibility}, $info->{magicmap}; |
2293 | cf::face::set $idx, $info->{visibility}, $info->{magicmap}; |
2288 | cf::face::set_data $idx, 0, $info->{data32}, $info->{chksum32}; |
2294 | cf::face::set_data $idx, 0, $info->{data32}, $info->{chksum32}; |
|
|
2295 | Coro::cede; |
|
|
2296 | } |
|
|
2297 | |
|
|
2298 | while (my ($face, $info) = each %$faces) { |
|
|
2299 | next unless $info->{smooth}; |
|
|
2300 | my $idx = cf::face::find $face |
|
|
2301 | or next; |
|
|
2302 | if (my $smooth = cf::face::find $info->{smooth}) { |
|
|
2303 | cf::face::set_smooth $idx, $smooth; |
|
|
2304 | } else { |
|
|
2305 | warn "smooth face '$info->{smooth}' not found for face '$face'"; |
|
|
2306 | } |
2289 | Coro::cede; |
2307 | Coro::cede; |
2290 | } |
2308 | } |
2291 | |
2309 | |
2292 | 1 |
2310 | 1 |
2293 | } |
2311 | } |