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.488 by root, Wed Oct 21 00:44:39 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;
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines