ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/map-prefetch.ext
(Generate patch)

Comparing deliantra/maps/perl/map-prefetch.ext (file contents):
Revision 1.6 by root, Tue Jul 11 15:37:31 2006 UTC vs.
Revision 1.7 by root, Sun Jul 16 17:15:18 2006 UTC

103 $PREFETCHING = 0; 103 $PREFETCHING = 0;
104} 104}
105 105
106my %MAP_EXITS; 106my %MAP_EXITS;
107 107
108sub prefetch_map { 108sub prefetch_map($) {
109 my ($map) = @_; 109 my ($map) = @_;
110 110
111 my $exit = $MAP_EXITS{$map->path} ||= find_exits $map; 111 my $exit = $MAP_EXITS{$map->path} ||= find_exits $map;
112 prefetch map => $_ for @$exit; 112 prefetch map => $_ for @$exit;
113} 113}
125 Event->timer (interval => 0.2, cb => sub { 125 Event->timer (interval => 0.2, cb => sub {
126 @players = map $_->ob->name, cf::player::list unless @players; 126 @players = map $_->ob->name, cf::player::list unless @players;
127 my $player = cf::player::find pop @players 127 my $player = cf::player::find pop @players
128 or return; 128 or return;
129 129
130 if (my $map = $player->ob->map) {
130 prefetch_map $player->ob->map; 131 prefetch_map $map;
132 }
133
131 prefetch map => +($player->get_savebed)[0]; 134 prefetch map => +($player->get_savebed)[0];
132 }); 135 });
133} 136}
134 137
135# prefetch all .pl files every few minutes (thats only a "few" megabytes) 138# prefetch all .pl files every few minutes (thats only a "few" megabytes)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines