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.485 by root, Mon Oct 12 14:12:54 2009 UTC vs.
Revision 1.493 by root, Mon Oct 26 02:34:37 2009 UTC

32use EV; 32use EV;
33use Opcode; 33use Opcode;
34use Safe; 34use Safe;
35use Safe::Hole; 35use Safe::Hole;
36use Storable (); 36use Storable ();
37use Carp ();
37 38
38use Guard (); 39use Guard ();
39use Coro (); 40use Coro ();
40use Coro::State; 41use Coro::State;
41use Coro::Handle; 42use Coro::Handle;
228returns directly I<after> the tick processing (and consequently, can only wake one process 229returns directly I<after> the tick processing (and consequently, can only wake one process
229per tick), while cf::wait_for_tick wakes up all waiters after tick processing. 230per tick), while cf::wait_for_tick wakes up all waiters after tick processing.
230 231
231=item @cf::INVOKE_RESULTS 232=item @cf::INVOKE_RESULTS
232 233
233This array contains the results of the last C<invoke ()> call. When 234This array contains the results of the last C<invoke ()> call. When
234C<cf::override> is called C<@cf::INVOKE_RESULTS> is set to the parameters of 235C<cf::override> is called C<@cf::INVOKE_RESULTS> is set to the parameters of
235that call. 236that call.
236 237
237=item %cf::REFLECT 238=item %cf::REFLECT
238 239
289)) { 290)) {
290 @{"safe::$pkg\::wrap::ISA"} = @{"$pkg\::wrap::ISA"} = $pkg; 291 @{"safe::$pkg\::wrap::ISA"} = @{"$pkg\::wrap::ISA"} = $pkg;
291} 292}
292 293
293$EV::DIED = sub { 294$EV::DIED = sub {
294 warn "error in event callback: @_"; 295 Carp::cluck "error in event callback: @_";
295}; 296};
296 297
297############################################################################# 298#############################################################################
298 299
299=head2 UTILITY FUNCTIONS 300=head2 UTILITY FUNCTIONS
2341 : normalise $_ 2342 : normalise $_
2342 } @{ aio_readdir $UNIQUEDIR or [] } 2343 } @{ aio_readdir $UNIQUEDIR or [] }
2343 ] 2344 ]
2344} 2345}
2345 2346
2347=item cf::map::static_maps
2348
2349Returns an arrayref if paths of all static maps (all preinstalled F<.map>
2350file in the shared directory excluding F</styles> and F</editor>). May
2351block.
2352
2353=cut
2354
2355sub static_maps() {
2356 my @dirs = "";
2357 my @maps;
2358
2359 while (@dirs) {
2360 my $dir = shift @dirs;
2361
2362 next if $dir eq "/styles" || $dir eq "/editor";
2363
2364 my ($dirs, $files) = Coro::AIO::aio_scandir "$MAPDIR$dir", 2
2365 or return;
2366
2367 for (@$files) {
2368 s/\.map$// or next;
2369 utf8::decode $_;
2370 push @maps, "$dir/$_";
2371 }
2372
2373 push @dirs, map "$dir/$_", @$dirs;
2374 }
2375
2376 \@maps
2377}
2378
2346=back 2379=back
2347 2380
2348=head3 cf::object 2381=head3 cf::object
2349 2382
2350=cut 2383=cut
2545 ($x, $y) = (-1, -1) 2578 ($x, $y) = (-1, -1)
2546 unless (defined $x) && (defined $y); 2579 unless (defined $x) && (defined $y);
2547 2580
2548 # use -1 or undef as default coordinates, not 0, 0 2581 # use -1 or undef as default coordinates, not 0, 0
2549 ($x, $y) = ($map->enter_x, $map->enter_y) 2582 ($x, $y) = ($map->enter_x, $map->enter_y)
2550 if $x <=0 && $y <= 0; 2583 if $x <= 0 && $y <= 0;
2551 2584
2552 $map->load; 2585 $map->load;
2553 $map->load_neighbours; 2586 $map->load_neighbours;
2554 2587
2555 return unless $self->contr->active; 2588 return unless $self->contr->active;
2765 2798
2766=cut 2799=cut
2767 2800
2768# non-persistent channels (usually the info channel) 2801# non-persistent channels (usually the info channel)
2769our %CHANNEL = ( 2802our %CHANNEL = (
2803 "c/motd" => {
2804 id => "infobox",
2805 title => "MOTD",
2806 reply => undef,
2807 tooltip => "The message of the day",
2808 },
2770 "c/identify" => { 2809 "c/identify" => {
2771 id => "infobox", 2810 id => "infobox",
2772 title => "Identify", 2811 title => "Identify",
2773 reply => undef, 2812 reply => undef,
2774 tooltip => "Items recently identified", 2813 tooltip => "Items recently identified",
2776 "c/examine" => { 2815 "c/examine" => {
2777 id => "infobox", 2816 id => "infobox",
2778 title => "Examine", 2817 title => "Examine",
2779 reply => undef, 2818 reply => undef,
2780 tooltip => "Signs and other items you examined", 2819 tooltip => "Signs and other items you examined",
2820 },
2821 "c/shopinfo" => {
2822 id => "infobox",
2823 title => "Shop Info",
2824 reply => undef,
2825 tooltip => "What your bargaining skill tells you about the shop",
2781 }, 2826 },
2782 "c/book" => { 2827 "c/book" => {
2783 id => "infobox", 2828 id => "infobox",
2784 title => "Book", 2829 title => "Book",
2785 reply => undef, 2830 reply => undef,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines