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.573 by root, Sun May 8 12:40:42 2011 UTC vs.
Revision 1.574 by root, Sun May 8 21:51:27 2011 UTC

2267# if $self->per_party; 2267# if $self->per_party;
2268 2268
2269 $self 2269 $self
2270} 2270}
2271 2271
2272# find and load all maps in the 3x3 area around a map
2273sub load_neighbours {
2274 my ($map) = @_;
2275
2276 my @neigh; # diagonal neighbours
2277
2278 for (0 .. 3) {
2279 my $neigh = $map->tile_path ($_)
2280 or next;
2281 $neigh = find $neigh, $map
2282 or next;
2283 $neigh->load;
2284
2285 # now find the diagonal neighbours
2286 push @neigh,
2287 [$neigh->tile_path (($_ + 3) % 4), $neigh],
2288 [$neigh->tile_path (($_ + 1) % 4), $neigh];
2289 }
2290
2291 for (grep defined $_->[0], @neigh) {
2292 my ($path, $origin) = @$_;
2293 my $neigh = find $path, $origin
2294 or next;
2295 $neigh->load;
2296 }
2297}
2298
2299sub find_sync { 2272sub find_sync {
2300 my ($path, $origin) = @_; 2273 my ($path, $origin) = @_;
2301 2274
2302 # it's a bug to call this from the main context 2275 # it's a bug to call this from the main context
2303 return cf::LOG cf::llevError | cf::logBacktrace, "do_find_sync" 2276 return cf::LOG cf::llevError | cf::logBacktrace, "do_find_sync"
2775 # use -1 or undef as default coordinates, not 0, 0 2748 # use -1 or undef as default coordinates, not 0, 0
2776 ($x, $y) = ($map->enter_x, $map->enter_y) 2749 ($x, $y) = ($map->enter_x, $map->enter_y)
2777 if $x <= 0 && $y <= 0; 2750 if $x <= 0 && $y <= 0;
2778 2751
2779 $map->load; 2752 $map->load;
2780 $map->load_neighbours;
2781 2753
2782 return unless $self->contr->active; 2754 return unless $self->contr->active;
2783 2755
2784 local $self->{_prev_pos} = $link_pos; # ugly hack for rent.ext 2756 local $self->{_prev_pos} = $link_pos; # ugly hack for rent.ext
2785 if ($self->enter_map ($map, $x, $y)) { 2757 if ($self->enter_map ($map, $x, $y)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines