--- deliantra/server/socket/request.C 2010/04/15 00:36:51 1.172 +++ deliantra/server/socket/request.C 2010/04/21 05:48:22 1.175 @@ -713,9 +713,6 @@ void esrv_update_stats (player *pl) { - char buf[MAX_BUF]; - uint16 flags; - client *ns = pl->ns; if (!ns) return; @@ -766,19 +763,15 @@ AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP, 1.f / TICK); AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM); - flags = (opl->fire_on ? SF_FIREON : 0) - | (opl->run_on ? SF_RUNON : 0); + int flags = (opl->fire_on ? SF_FIREON : 0) + | (opl->run_on ? SF_RUNON : 0); AddIfShort (ns->last_flags, flags, CS_STAT_FLAGS); for (int i = 0; i < NROFATTACKS; i++) - { - /* Skip ones we won't send */ - if (atnr_cs_stat[i] == -1) - continue; - + /* Skip ones we won't send */ + if (atnr_cs_stat[i] >= 0) AddIfShort (ns->last_resist[i], ob->resist[i], atnr_cs_stat[i]); - } if (pl->ns->monitor_spells) { @@ -787,6 +780,7 @@ AddIfInt (ns->last_path_denied, ob->path_denied, CS_STAT_SPELL_DENY); } + char buf[MAX_BUF]; rangetostring (opl, buf); /* we want use the new fire & run system in new client */ AddIfString (ns->stats.range, buf, CS_STAT_RANGE); set_title (ob, buf); @@ -892,26 +886,19 @@ //-GPL -// prefetch (and touch) all maps within a specific distancd -static void -prefetch_surrounding_maps (maptile *map, int distance) -{ - map->touch (); - - if (--distance) - for (int dir = 4; dir--; ) - if (const shstr &path = map->tile_path [dir]) - if (maptile *&neigh = map->tile_map [dir]) - prefetch_surrounding_maps (neigh, distance); - else - neigh = maptile::find_async (path, map); -} +// prefetch maps in an area of PREFETCH x PREFETCH around the player +#define PREFETCH 40 // prefetch a generous area around the player static void prefetch_surrounding_maps (object *op) { - prefetch_surrounding_maps (op->map, 3); + for (maprect *rect = op->map->split_to_tiles (mapwalk_buf, + op->x - PREFETCH , op->y - PREFETCH , + op->x + PREFETCH + 1, op->y + PREFETCH + 1); + rect->m; + ++rect) + rect->m->touch (); } //+GPL