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.173 by root, Thu Apr 15 00:37:24 2010 UTC vs.
Revision 1.175 by root, Wed Apr 21 05:48:22 2010 UTC

711 * commands for now. 711 * commands for now.
712 */ 712 */
713void 713void
714esrv_update_stats (player *pl) 714esrv_update_stats (player *pl)
715{ 715{
716 char buf[MAX_BUF];
717 uint16 flags;
718
719 client *ns = pl->ns; 716 client *ns = pl->ns;
720 if (!ns) 717 if (!ns)
721 return; 718 return;
722 719
723 object *ob = pl->observe; 720 object *ob = pl->observe;
764 AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED, 1.f / TICK); 761 AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED, 1.f / TICK);
765 AddIfShort (ns->last_stats.food, ob->stats.food, CS_STAT_FOOD); 762 AddIfShort (ns->last_stats.food, ob->stats.food, CS_STAT_FOOD);
766 AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP, 1.f / TICK); 763 AddIfFloat (ns->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP, 1.f / TICK);
767 AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM); 764 AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM);
768 765
769 flags = (opl->fire_on ? SF_FIREON : 0) 766 int flags = (opl->fire_on ? SF_FIREON : 0)
770 | (opl->run_on ? SF_RUNON : 0); 767 | (opl->run_on ? SF_RUNON : 0);
771 768
772 AddIfShort (ns->last_flags, flags, CS_STAT_FLAGS); 769 AddIfShort (ns->last_flags, flags, CS_STAT_FLAGS);
773 770
774 for (int i = 0; i < NROFATTACKS; i++) 771 for (int i = 0; i < NROFATTACKS; i++)
775 /* Skip ones we won't send */ 772 /* Skip ones we won't send */
781 AddIfInt (ns->last_path_attuned, ob->path_attuned, CS_STAT_SPELL_ATTUNE); 778 AddIfInt (ns->last_path_attuned, ob->path_attuned, CS_STAT_SPELL_ATTUNE);
782 AddIfInt (ns->last_path_repelled, ob->path_repelled, CS_STAT_SPELL_REPEL); 779 AddIfInt (ns->last_path_repelled, ob->path_repelled, CS_STAT_SPELL_REPEL);
783 AddIfInt (ns->last_path_denied, ob->path_denied, CS_STAT_SPELL_DENY); 780 AddIfInt (ns->last_path_denied, ob->path_denied, CS_STAT_SPELL_DENY);
784 } 781 }
785 782
783 char buf[MAX_BUF];
786 rangetostring (opl, buf); /* we want use the new fire & run system in new client */ 784 rangetostring (opl, buf); /* we want use the new fire & run system in new client */
787 AddIfString (ns->stats.range, buf, CS_STAT_RANGE); 785 AddIfString (ns->stats.range, buf, CS_STAT_RANGE);
788 set_title (ob, buf); 786 set_title (ob, buf);
789 AddIfString (ns->stats.title, buf, CS_STAT_TITLE); 787 AddIfString (ns->stats.title, buf, CS_STAT_TITLE);
790 788
886 return 0; 884 return 0;
887} 885}
888 886
889//-GPL 887//-GPL
890 888
891// prefetch (and touch) all maps within a specific distancd 889// prefetch maps in an area of PREFETCH x PREFETCH around the player
892static void 890#define PREFETCH 40
893prefetch_surrounding_maps (maptile *map, int distance)
894{
895 map->touch ();
896
897 if (--distance)
898 for (int dir = 4; dir--; )
899 if (const shstr &path = map->tile_path [dir])
900 if (maptile *&neigh = map->tile_map [dir])
901 prefetch_surrounding_maps (neigh, distance);
902 else
903 neigh = maptile::find_async (path, map);
904}
905 891
906// prefetch a generous area around the player 892// prefetch a generous area around the player
907static void 893static void
908prefetch_surrounding_maps (object *op) 894prefetch_surrounding_maps (object *op)
909{ 895{
910 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 ();
911} 902}
912 903
913//+GPL 904//+GPL
914 905
915/** 906/**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines