… | |
… | |
345 | while (*buf && map && max_distance) |
345 | while (*buf && map && max_distance) |
346 | { |
346 | { |
347 | int dir = *buf++ - '1'; |
347 | int dir = *buf++ - '1'; |
348 | |
348 | |
349 | // maybe we should only allow the four flat directions |
349 | // maybe we should only allow the four flat directions |
350 | if (dir >= 0 && dir < TILE_NUM) |
350 | if (dir >= 0 && dir < array_length (map->tile_path)) |
351 | { |
351 | { |
352 | if (!map->tile_path [dir]) |
352 | if (!map->tile_path [dir]) |
353 | map = 0; |
353 | map = 0; |
354 | else if (map->tile_available (dir, false)) |
354 | else if (map->tile_available (dir, false)) |
355 | { |
355 | { |
… | |
… | |
891 | for (maprect *rect = map->split_to_tiles (mapwalk_buf, |
891 | for (maprect *rect = map->split_to_tiles (mapwalk_buf, |
892 | op->x - range , op->y - range , |
892 | op->x - range , op->y - range , |
893 | op->x + range + 1, op->y + range + 1); |
893 | op->x + range + 1, op->y + range + 1); |
894 | rect->m; |
894 | rect->m; |
895 | ++rect) |
895 | ++rect) |
|
|
896 | { |
896 | rect->m->touch (); |
897 | rect->m->touch (); |
|
|
898 | rect->m->activate (); |
|
|
899 | } |
897 | } |
900 | } |
898 | |
901 | |
899 | // prefetch a generous area around the player, also up and down |
902 | // prefetch a generous area around the player, also up and down |
900 | static void |
903 | void |
901 | prefetch_surrounding_maps (object *op) |
904 | object::prefetch_surrounding_maps () |
902 | { |
905 | { |
903 | prefetch_surrounding_area (op, op->map, 40); |
906 | prefetch_surrounding_area (this, map, 40); |
904 | |
907 | |
905 | if (maptile *m = op->map->tile_available (TILE_DOWN)) |
908 | if (maptile *m = map->tile_available (TILE_DOWN)) |
906 | prefetch_surrounding_area (op, m, 20); |
909 | prefetch_surrounding_area (this, m, 20); |
907 | |
910 | |
908 | if (maptile *m = op->map->tile_available (TILE_UP)) |
911 | if (maptile *m = map->tile_available (TILE_UP)) |
909 | prefetch_surrounding_area (op, m, 20); |
912 | prefetch_surrounding_area (this, m, 20); |
910 | } |
913 | } |
911 | |
914 | |
912 | //+GPL |
915 | //+GPL |
913 | |
916 | |
914 | /** |
917 | /** |
… | |
… | |
923 | |
926 | |
924 | /* If player is just joining the game, he isn't here yet, so the map |
927 | /* If player is just joining the game, he isn't here yet, so the map |
925 | * can get swapped out. If so, don't try to send them a map. All will |
928 | * can get swapped out. If so, don't try to send them a map. All will |
926 | * be OK once they really log in. |
929 | * be OK once they really log in. |
927 | */ |
930 | */ |
928 | if (!ob->map || ob->map->in_memory != MAP_ACTIVE) |
931 | if (!ob->map || ob->map->state != MAP_ACTIVE) |
929 | return; |
932 | return; |
930 | |
933 | |
931 | int startlen, oldlen; |
934 | int startlen, oldlen; |
932 | |
935 | |
933 | check_map_change (pl); |
936 | check_map_change (pl); |
934 | prefetch_surrounding_maps (pl->ob); |
937 | pl->ob->prefetch_surrounding_maps (); |
935 | |
938 | |
936 | /* do LOS after calls to update_position */ |
939 | /* do LOS after calls to update_position */ |
937 | /* unfortunately, we need to udpate los when observing, currently */ |
940 | /* unfortunately, we need to udpate los when observing, currently */ |
938 | if (pl->do_los || pl->viewpoint != pl->ob) |
941 | if (pl->do_los || pl->viewpoint != pl->ob) |
939 | { |
942 | { |