ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/request.C
(Generate patch)

Comparing deliantra/server/socket/request.C (file contents):
Revision 1.174 by root, Thu Apr 15 00:40:34 2010 UTC vs.
Revision 1.175 by root, Wed Apr 21 05:48:22 2010 UTC

884 return 0; 884 return 0;
885} 885}
886 886
887//-GPL 887//-GPL
888 888
889// prefetch (and touch) all maps within a specific distancd 889// prefetch maps in an area of PREFETCH x PREFETCH around the player
890static void 890#define PREFETCH 40
891prefetch_surrounding_maps (maptile *map, int distance)
892{
893 map->touch ();
894
895 if (--distance)
896 for (int dir = 4; dir--; )
897 if (const shstr &path = map->tile_path [dir])
898 if (maptile *&neigh = map->tile_map [dir])
899 prefetch_surrounding_maps (neigh, distance);
900 else
901 neigh = maptile::find_async (path, map);
902}
903 891
904// prefetch a generous area around the player 892// prefetch a generous area around the player
905static void 893static void
906prefetch_surrounding_maps (object *op) 894prefetch_surrounding_maps (object *op)
907{ 895{
908 prefetch_surrounding_maps (op->map, 3); 896 for (maprect *rect = op->map->split_to_tiles (mapwalk_buf,
897 op->x - PREFETCH , op->y - PREFETCH ,
898 op->x + PREFETCH + 1, op->y + PREFETCH + 1);
899 rect->m;
900 ++rect)
901 rect->m->touch ();
909} 902}
910 903
911//+GPL 904//+GPL
912 905
913/** 906/**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines