--- deliantra/server/ext/map-scheduler.ext 2007/01/04 17:28:49 1.13 +++ deliantra/server/ext/map-scheduler.ext 2007/01/05 19:12:01 1.16 @@ -11,10 +11,10 @@ cf::coro { $Coro::current->prio (Coro::PRIO_MIN); - # load the header of swapped-out. + # load the header of swapped-out maps. # this is not a correctness issue, it simply saves diskspace # because old files will get cleaned up on reset time - Coro::Timer::sleep 5; + Coro::Timer::sleep 1; my $files = Coro::AIO::aio_readdir cf::localdir . "/" . cf::tmpdir; @@ -70,12 +70,33 @@ $SCHEDULER->prio (-2); -# map load prefetch +# map load prefetch for tiled maps, possibly exits, too cf::map->attach ( on_enter => sub { my ($map, $pl) = @_; - # floodfill surrounging maps, asynchronously + (Coro::async_pool { + my @diag; # diagonal neighbours + + for (0 .. 3) { + my $neigh = $map->tile_path ($_) + or next; + $neigh = cf::map::find $neigh, $map + or next; + $neigh->load; + + push @diag, [$neigh->tile_path (($_ + 3) % 4), $neigh], + [$neigh->tile_path (($_ + 1) % 4), $neigh]; + } + + for (@diag) { + my $neigh = cf::map::find @$_ + or next; + $neigh->load; + } + })->prio (2); + # higher prio because prefetching is very important + # as it prefetches maps that can make the server block }, );