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.177 by root, Sat Oct 16 22:51:52 2010 UTC

146 pl->ns->mapinfo_queue_clear (); 146 pl->ns->mapinfo_queue_clear ();
147 147
148 memset (&pl->ns->lastmap, 0, sizeof (pl->ns->lastmap)); 148 memset (&pl->ns->lastmap, 0, sizeof (pl->ns->lastmap));
149 149
150 pl->ns->force_newmap = false; 150 pl->ns->force_newmap = false;
151
152 if (pl->ns->newmapcmd == 1)
153 pl->ns->send_packet ("newmap"); 151 pl->ns->send_packet ("newmap");
154
155 pl->ns->floorbox_reset (); 152 pl->ns->floorbox_reset ();
156} 153}
157 154
158static void 155static void
159send_map_info (player *pl) 156send_map_info (player *pl)
246 243
247 for (int i = 0; i < skillvec.size (); ++i) 244 for (int i = 0; i < skillvec.size (); ++i)
248 sl.printf ("%d:%s\n", CS_STAT_SKILLINFO + i, &skillvec [i]->name); 245 sl.printf ("%d:%s\n", CS_STAT_SKILLINFO + i, &skillvec [i]->name);
249 246
250 if (sl.length () > MAXSOCKBUF) 247 if (sl.length () > MAXSOCKBUF)
251 {
252 LOG (llevError, "Buffer overflow in send_skill_info!\n"); 248 cleanup ("buffer overflow in send_skill_info!");
253 fatal (0);
254 }
255 249
256 ns->send_packet (sl); 250 ns->send_packet (sl);
257} 251}
258 252
259/** 253/**
269 263
270 for (int i = 0; i < NRSPELLPATHS; i++) 264 for (int i = 0; i < NRSPELLPATHS; i++)
271 sl.printf ("%d:%s\n", 1 << i, spellpathnames[i]); 265 sl.printf ("%d:%s\n", 1 << i, spellpathnames[i]);
272 266
273 if (sl.length () > MAXSOCKBUF) 267 if (sl.length () > MAXSOCKBUF)
274 {
275 LOG (llevError, "Buffer overflow in send_spell_paths!\n"); 268 cleanup ("buffer overflow in send_spell_paths!");
276 fatal (0);
277 }
278 269
279 ns->send_packet (sl); 270 ns->send_packet (sl);
280} 271}
281 272
282/** 273/**
711 * commands for now. 702 * commands for now.
712 */ 703 */
713void 704void
714esrv_update_stats (player *pl) 705esrv_update_stats (player *pl)
715{ 706{
716 char buf[MAX_BUF];
717 uint16 flags;
718
719 client *ns = pl->ns; 707 client *ns = pl->ns;
720 if (!ns) 708 if (!ns)
721 return; 709 return;
722 710
723 object *ob = pl->observe; 711 object *ob = pl->observe;
764 AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED, 1.f / TICK); 752 AddIfFloat (ns->last_speed, ob->speed, CS_STAT_SPEED, 1.f / TICK);
765 AddIfShort (ns->last_stats.food, ob->stats.food, CS_STAT_FOOD); 753 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); 754 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); 755 AddIfInt (ns->last_weight_limit, weight_limit[ob->stats.Str], CS_STAT_WEIGHT_LIM);
768 756
769 flags = (opl->fire_on ? SF_FIREON : 0) 757 int flags = (opl->fire_on ? SF_FIREON : 0)
770 | (opl->run_on ? SF_RUNON : 0); 758 | (opl->run_on ? SF_RUNON : 0);
771 759
772 AddIfShort (ns->last_flags, flags, CS_STAT_FLAGS); 760 AddIfShort (ns->last_flags, flags, CS_STAT_FLAGS);
773 761
774 for (int i = 0; i < NROFATTACKS; i++) 762 for (int i = 0; i < NROFATTACKS; i++)
775 /* Skip ones we won't send */ 763 /* Skip ones we won't send */
781 AddIfInt (ns->last_path_attuned, ob->path_attuned, CS_STAT_SPELL_ATTUNE); 769 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); 770 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); 771 AddIfInt (ns->last_path_denied, ob->path_denied, CS_STAT_SPELL_DENY);
784 } 772 }
785 773
774 char buf[MAX_BUF];
786 rangetostring (opl, buf); /* we want use the new fire & run system in new client */ 775 rangetostring (opl, buf); /* we want use the new fire & run system in new client */
787 AddIfString (ns->stats.range, buf, CS_STAT_RANGE); 776 AddIfString (ns->stats.range, buf, CS_STAT_RANGE);
788 set_title (ob, buf); 777 set_title (ob, buf);
789 AddIfString (ns->stats.title, buf, CS_STAT_TITLE); 778 AddIfString (ns->stats.title, buf, CS_STAT_TITLE);
790 779
886 return 0; 875 return 0;
887} 876}
888 877
889//-GPL 878//-GPL
890 879
891// prefetch (and touch) all maps within a specific distancd 880// prefetch maps in an area of PREFETCH x PREFETCH around the player
892static void 881#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 882
906// prefetch a generous area around the player 883// prefetch a generous area around the player
907static void 884static void
908prefetch_surrounding_maps (object *op) 885prefetch_surrounding_maps (object *op)
909{ 886{
910 prefetch_surrounding_maps (op->map, 3); 887 for (maprect *rect = op->map->split_to_tiles (mapwalk_buf,
888 op->x - PREFETCH , op->y - PREFETCH ,
889 op->x + PREFETCH + 1, op->y + PREFETCH + 1);
890 rect->m;
891 ++rect)
892 rect->m->touch ();
911} 893}
912 894
913//+GPL 895//+GPL
914 896
915/** 897/**
965 * look like. 947 * look like.
966 */ 948 */
967 949
968 client &socket = *pl->ns; 950 client &socket = *pl->ns;
969 951
970 packet sl (socket.mapmode == Map1Cmd ? "map1" : "map1a"); 952 packet sl ("map1a");
971 953
972 startlen = sl.length (); 954 startlen = sl.length ();
973 955
974 int hx = socket.mapx / 2; 956 int hx = socket.mapx / 2;
975 int hy = socket.mapy / 2; 957 int hy = socket.mapy / 2;
1358 } 1340 }
1359 else 1341 else
1360 append_spell (pl, sl, spell); 1342 append_spell (pl, sl, spell);
1361 1343
1362 if (sl.length () > MAXSOCKBUF) 1344 if (sl.length () > MAXSOCKBUF)
1363 {
1364 LOG (llevError, "Buffer overflow in esrv_add_spells!\n"); 1345 cleanup ("buffer overflow in esrv_add_spells!");
1365 fatal (0);
1366 }
1367 1346
1368 /* finally, we can send the packet */ 1347 /* finally, we can send the packet */
1369 pl->ns->flush_fx (); 1348 pl->ns->flush_fx ();
1370 pl->ns->send_packet (sl); 1349 pl->ns->send_packet (sl);
1371} 1350}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines