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.114 by root, Mon Jan 1 16:00:10 2007 UTC vs.
Revision 1.115 by root, Mon Jan 1 16:50:10 2007 UTC

1383 (ref $cf::CFG{"may_$access"} 1383 (ref $cf::CFG{"may_$access"}
1384 ? scalar grep $self->name eq $_, @{$cf::CFG{"may_$access"}} 1384 ? scalar grep $self->name eq $_, @{$cf::CFG{"may_$access"}}
1385 : $cf::CFG{"may_$access"}) 1385 : $cf::CFG{"may_$access"})
1386} 1386}
1387 1387
1388=item $player_object->enter_link
1389
1390Freezes the player and moves him/her to a special map (C<{link}>).
1391
1392The player should be reaosnably safe there for short amounts of time. You
1393I<MUST> call C<leave_link> as soon as possible, though.
1394
1395=item $player_object->leave_link ($map, $x, $y)
1396
1397Moves the player out of the specila link map onto the given map. If the
1398map is not valid (or omitted), the player will be moved back to the
1399location he/she was before the call to C<enter_link>, or, if that fails,
1400to the emergency map position.
1401
1402Might block.
1403
1404=cut
1405
1388sub cf::object::player::enter_link { 1406sub cf::object::player::enter_link {
1389 my ($self) = @_; 1407 my ($self) = @_;
1390 1408
1391 return if $self->map == $LINK_MAP; 1409 return if $self->map == $LINK_MAP;
1392 1410
1401 my ($self, $map, $x, $y) = @_; 1419 my ($self, $map, $x, $y) = @_;
1402 1420
1403 my $link_pos = delete $self->{_link_pos}; 1421 my $link_pos = delete $self->{_link_pos};
1404 1422
1405 unless ($map) { 1423 unless ($map) {
1406 $self->message ("The exit is closed", cf::NDI_UNIQUE | cf::NDI_RED);
1407
1408 # restore original map position 1424 # restore original map position
1409 ($map, $x, $y) = @{ $link_pos || [] }; 1425 ($map, $x, $y) = @{ $link_pos || [] };
1410 $map = cf::map::find_map $map; 1426 $map = cf::map::find_map $map;
1411 1427
1412 unless ($map) { 1428 unless ($map) {
1444 my $map = cf::map::find_map $path->as_string; 1460 my $map = cf::map::find_map $path->as_string;
1445 $map = $map->customise_for ($self) if $map; 1461 $map = $map->customise_for ($self) if $map;
1446 1462
1447 warn "entering ", $map->path, " at ($x, $y)\n" 1463 warn "entering ", $map->path, " at ($x, $y)\n"
1448 if $map; 1464 if $map;
1465
1466 $map or $self->message ("The exit is closed", cf::NDI_UNIQUE | cf::NDI_RED);
1449 1467
1450 $self->leave_link ($map, $x, $y); 1468 $self->leave_link ($map, $x, $y);
1451 })->prio (1); 1469 })->prio (1);
1452} 1470}
1453 1471
1864} 1882}
1865 1883
1866sub main { 1884sub main {
1867 # we must not ever block the main coroutine 1885 # we must not ever block the main coroutine
1868 local $Coro::idle = sub { 1886 local $Coro::idle = sub {
1869 Carp::cluck "FATAL: Coro::idle was called, major BUG\n";#d# 1887 Carp::cluck "FATAL: Coro::idle was called, major BUG, use cf::sync_job!\n";#d#
1870 (Coro::unblock_sub { 1888 (Coro::unblock_sub {
1871 Event::one_event; 1889 Event::one_event;
1872 })->(); 1890 })->();
1873 }; 1891 };
1874 1892

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines