--- deliantra/server/lib/cf.pm 2007/01/01 16:00:10 1.114 +++ deliantra/server/lib/cf.pm 2007/01/02 08:26:42 1.119 @@ -819,6 +819,8 @@ $av = eval { (Storable::thaw $av)->{objs} }; } + warn sprintf "loading %s (%d)\n", + $filename, length $data, scalar @{$av || []};#d# return ($data, $av); } @@ -1142,9 +1144,11 @@ # per-player maps become, after loading, normal maps $map->per_player (0) if $path->{user_rel}; } + #Coro::Timer::sleep 1;#d# $map->path ($key); $map->{path} = $path; + $map->{last_save} = $cf::RUNTIME; $map->last_access ($cf::RUNTIME); if ($map->should_reset) { @@ -1215,13 +1219,13 @@ sub save { my ($self) = @_; - my $save = $self->{path}->save_path; utf8::encode $save; - my $uniq = $self->{path}->uniq_path; utf8::encode $uniq; - $self->{last_save} = $cf::RUNTIME; return unless $self->dirty; + my $save = $self->{path}->save_path; utf8::encode $save; + my $uniq = $self->{path}->uniq_path; utf8::encode $uniq; + $self->{load_path} = $save; return if $self->{deny_save}; @@ -1385,6 +1389,24 @@ : $cf::CFG{"may_$access"}) } +=item $player_object->enter_link + +Freezes the player and moves him/her to a special map (C<{link}>). + +The player should be reaosnably safe there for short amounts of time. You +I call C as soon as possible, though. + +=item $player_object->leave_link ($map, $x, $y) + +Moves the player out of the specila link map onto the given map. If the +map is not valid (or omitted), the player will be moved back to the +location he/she was before the call to C, or, if that fails, +to the emergency map position. + +Might block. + +=cut + sub cf::object::player::enter_link { my ($self) = @_; @@ -1403,8 +1425,6 @@ my $link_pos = delete $self->{_link_pos}; unless ($map) { - $self->message ("The exit is closed", cf::NDI_UNIQUE | cf::NDI_RED); - # restore original map position ($map, $x, $y) = @{ $link_pos || [] }; $map = cf::map::find_map $map; @@ -1429,7 +1449,7 @@ $self->enter_map ($map, $x, $y); } -=item $player_object->goto_map ($map, $x, $y) +=item $player_object->goto_map ($path, $x, $y) =cut @@ -1444,8 +1464,10 @@ my $map = cf::map::find_map $path->as_string; $map = $map->customise_for ($self) if $map; - warn "entering ", $map->path, " at ($x, $y)\n" - if $map; +# warn "entering ", $map->path, " at ($x, $y)\n" +# if $map; + + $map or $self->message ("The exit is closed", cf::NDI_UNIQUE | cf::NDI_RED); $self->leave_link ($map, $x, $y); })->prio (1); @@ -1866,7 +1888,7 @@ sub main { # we must not ever block the main coroutine local $Coro::idle = sub { - Carp::cluck "FATAL: Coro::idle was called, major BUG\n";#d# + Carp::cluck "FATAL: Coro::idle was called, major BUG, use cf::sync_job!\n";#d# (Coro::unblock_sub { Event::one_event; })->();