… | |
… | |
246 | |
246 | |
247 | for (int i = 0; i < skillvec.size (); ++i) |
247 | for (int i = 0; i < skillvec.size (); ++i) |
248 | sl.printf ("%d:%s\n", CS_STAT_SKILLINFO + i, &skillvec [i]->name); |
248 | sl.printf ("%d:%s\n", CS_STAT_SKILLINFO + i, &skillvec [i]->name); |
249 | |
249 | |
250 | if (sl.length () > MAXSOCKBUF) |
250 | if (sl.length () > MAXSOCKBUF) |
251 | { |
|
|
252 | LOG (llevError, "Buffer overflow in send_skill_info!\n"); |
251 | cleanup ("buffer overflow in send_skill_info!"); |
253 | fatal (0); |
|
|
254 | } |
|
|
255 | |
252 | |
256 | ns->send_packet (sl); |
253 | ns->send_packet (sl); |
257 | } |
254 | } |
258 | |
255 | |
259 | /** |
256 | /** |
… | |
… | |
269 | |
266 | |
270 | for (int i = 0; i < NRSPELLPATHS; i++) |
267 | for (int i = 0; i < NRSPELLPATHS; i++) |
271 | sl.printf ("%d:%s\n", 1 << i, spellpathnames[i]); |
268 | sl.printf ("%d:%s\n", 1 << i, spellpathnames[i]); |
272 | |
269 | |
273 | if (sl.length () > MAXSOCKBUF) |
270 | if (sl.length () > MAXSOCKBUF) |
274 | { |
|
|
275 | LOG (llevError, "Buffer overflow in send_spell_paths!\n"); |
271 | cleanup ("buffer overflow in send_spell_paths!"); |
276 | fatal (0); |
|
|
277 | } |
|
|
278 | |
272 | |
279 | ns->send_packet (sl); |
273 | ns->send_packet (sl); |
280 | } |
274 | } |
281 | |
275 | |
282 | /** |
276 | /** |
… | |
… | |
884 | return 0; |
878 | return 0; |
885 | } |
879 | } |
886 | |
880 | |
887 | //-GPL |
881 | //-GPL |
888 | |
882 | |
889 | // prefetch (and touch) all maps within a specific distancd |
883 | // prefetch maps in an area of PREFETCH x PREFETCH around the player |
890 | static void |
884 | #define PREFETCH 40 |
891 | prefetch_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 | |
885 | |
904 | // prefetch a generous area around the player |
886 | // prefetch a generous area around the player |
905 | static void |
887 | static void |
906 | prefetch_surrounding_maps (object *op) |
888 | prefetch_surrounding_maps (object *op) |
907 | { |
889 | { |
908 | prefetch_surrounding_maps (op->map, 3); |
890 | for (maprect *rect = op->map->split_to_tiles (mapwalk_buf, |
|
|
891 | op->x - PREFETCH , op->y - PREFETCH , |
|
|
892 | op->x + PREFETCH + 1, op->y + PREFETCH + 1); |
|
|
893 | rect->m; |
|
|
894 | ++rect) |
|
|
895 | rect->m->touch (); |
909 | } |
896 | } |
910 | |
897 | |
911 | //+GPL |
898 | //+GPL |
912 | |
899 | |
913 | /** |
900 | /** |
… | |
… | |
1356 | } |
1343 | } |
1357 | else |
1344 | else |
1358 | append_spell (pl, sl, spell); |
1345 | append_spell (pl, sl, spell); |
1359 | |
1346 | |
1360 | if (sl.length () > MAXSOCKBUF) |
1347 | if (sl.length () > MAXSOCKBUF) |
1361 | { |
|
|
1362 | LOG (llevError, "Buffer overflow in esrv_add_spells!\n"); |
1348 | cleanup ("buffer overflow in esrv_add_spells!"); |
1363 | fatal (0); |
|
|
1364 | } |
|
|
1365 | |
1349 | |
1366 | /* finally, we can send the packet */ |
1350 | /* finally, we can send the packet */ |
1367 | pl->ns->flush_fx (); |
1351 | pl->ns->flush_fx (); |
1368 | pl->ns->send_packet (sl); |
1352 | pl->ns->send_packet (sl); |
1369 | } |
1353 | } |