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.89 by root, Wed Apr 25 18:47:51 2007 UTC vs.
Revision 1.97 by root, Thu May 17 14:14:56 2007 UTC

1/* 1/*
2 * CrossFire, A Multiplayer game for X-windows 2 * CrossFire, A Multiplayer game
3 * 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 * Copyright (C) 2001 Mark Wedel 5 * Copyright (C) 2001 Mark Wedel
6 * Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (C) 1992 Frank Tore Johansen
7 * 7 *
159 { 159 {
160 if (ob->map && ob->map->path[0]) 160 if (ob->map && ob->map->path[0])
161 { 161 {
162 int flags = 0; 162 int flags = 0;
163 163
164 if (ob->map->tile_path[0]) 164 if (ob->map->tile_path[0]) flags |= 1;
165 flags |= 1;
166 if (ob->map->tile_path[1]) 165 if (ob->map->tile_path[1]) flags |= 2;
167 flags |= 2;
168 if (ob->map->tile_path[2]) 166 if (ob->map->tile_path[2]) flags |= 4;
169 flags |= 4;
170 if (ob->map->tile_path[3]) 167 if (ob->map->tile_path[3]) flags |= 8;
171 flags |= 8;
172 168
173 snprintf (buf, MAX_BUF, "mapinfo - spatial %d %d %d %d %d %s", 169 snprintf (buf, MAX_BUF, "mapinfo - spatial %d %d %d %d %d %s",
174 flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y, ob->map->width, ob->map->height, &ob->map->path); 170 flags, socket.mapx / 2 - ob->x, socket.mapy / 2 - ob->y, ob->map->width, ob->map->height, &ob->map->path);
175 } 171 }
176 else 172 else
325 snprintf (bigbuf, MAX_BUF, "mapinfo %s error", token); 321 snprintf (bigbuf, MAX_BUF, "mapinfo %s error", token);
326 else if (map && map->path[0]) 322 else if (map && map->path[0])
327 { 323 {
328 int flags = 0; 324 int flags = 0;
329 325
330 if (map->tile_path[0]) 326 if (map->tile_path[0]) flags |= 1;
331 flags |= 1;
332 if (map->tile_path[1]) 327 if (map->tile_path[1]) flags |= 2;
333 flags |= 2;
334 if (map->tile_path[2]) 328 if (map->tile_path[2]) flags |= 4;
335 flags |= 4;
336 if (map->tile_path[3]) 329 if (map->tile_path[3]) flags |= 8;
337 flags |= 8;
338 330
339 snprintf (bigbuf, MAX_BUF, "mapinfo %s spatial %d %d %d %d %d %s", token, flags, mapx, mapy, map->width, map->height, &map->path); 331 snprintf (bigbuf, MAX_BUF, "mapinfo %s spatial %d %d %d %d %d %s", token, flags, mapx, mapy, map->width, map->height, &map->path);
340 } 332 }
341 else 333 else
342 snprintf (bigbuf, MAX_BUF, "mapinfo %s nomap", token); 334 snprintf (bigbuf, MAX_BUF, "mapinfo %s nomap", token);
732 */ 724 */
733void 725void
734send_query (client *ns, uint8 flags, const char *text) 726send_query (client *ns, uint8 flags, const char *text)
735{ 727{
736 ns->send_packet_printf ("query %d %s", flags, text ? text : ""); 728 ns->send_packet_printf ("query %d %s", flags, text ? text : "");
729}
730
731/**
732 * Get player's current range attack in obuf.
733 */
734static void
735rangetostring (player *pl, char *obuf)
736{
737 dynbuf_text buf;
738
739 if (pl->ranged_ob)
740 buf << " Range" << (pl->ob->current_weapon == pl->ranged_ob ? "*" : "") << ": " << pl->ranged_ob->name;
741
742 if (pl->combat_ob)
743 buf << " Combat" << (pl->ob->current_weapon == pl->combat_ob ? "*" : "") << ": " << pl->combat_ob->name;
744
745 //TODO: maybe golem should become the current_weapon, quite simply?
746 if (pl->golem)
747 buf << " Golem*: " << pl->golem->name;
748
749 buf.linearise (obuf);
750 obuf [buf.size ()] = 0;
737} 751}
738 752
739#define AddIfInt64(Old,New,Type) if (Old != New) {\ 753#define AddIfInt64(Old,New,Type) if (Old != New) {\
740 Old = New; \ 754 Old = New; \
741 sl << uint8 (Type) << uint64 (New); \ 755 sl << uint8 (Type) << uint64 (New); \
848 AddIfInt (ns->last_path_attuned, ob->path_attuned, CS_STAT_SPELL_ATTUNE); 862 AddIfInt (ns->last_path_attuned, ob->path_attuned, CS_STAT_SPELL_ATTUNE);
849 AddIfInt (ns->last_path_repelled, ob->path_repelled, CS_STAT_SPELL_REPEL); 863 AddIfInt (ns->last_path_repelled, ob->path_repelled, CS_STAT_SPELL_REPEL);
850 AddIfInt (ns->last_path_denied, ob->path_denied, CS_STAT_SPELL_DENY); 864 AddIfInt (ns->last_path_denied, ob->path_denied, CS_STAT_SPELL_DENY);
851 } 865 }
852 866
853 rangetostring (ob, buf); /* we want use the new fire & run system in new client */ 867 rangetostring (pl, buf); /* we want use the new fire & run system in new client */
854 AddIfString (ns->stats.range, buf, CS_STAT_RANGE); 868 AddIfString (ns->stats.range, buf, CS_STAT_RANGE);
855 set_title (ob, buf); 869 set_title (ob, buf);
856 AddIfString (ns->stats.title, buf, CS_STAT_TITLE); 870 AddIfString (ns->stats.title, buf, CS_STAT_TITLE);
857 871
858 /* Only send it away if we have some actual data */ 872 /* Only send it away if we have some actual data */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines