ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/info.C
(Generate patch)

Comparing deliantra/server/socket/info.C (file contents):
Revision 1.13 by root, Wed Dec 13 21:27:09 2006 UTC vs.
Revision 1.15 by root, Thu Dec 14 01:21:58 2006 UTC

45 * replaced with this, just using black as the color. 45 * replaced with this, just using black as the color.
46 */ 46 */
47static void 47static void
48esrv_print_msg (NewSocket * ns, int color, const char *str) 48esrv_print_msg (NewSocket * ns, int color, const char *str)
49{ 49{
50 char buf[HUGE_BUF]; 50 packet sl;
51 51
52 if (ns->status == Ns_Old) 52 if (ns->status == Ns_Old)
53 { 53 sl.printf ("%s\n", str);
54 snprintf (buf, HUGE_BUF, "%s\n", str);
55 }
56 else 54 else
57 {
58 snprintf (buf, HUGE_BUF, "drawinfo %d %s", color, str); 55 sl.printf ("drawinfo %d %s", color, str);
59 }
60 56
61/* LOG(llevDebug,"sending %s to socket, len=%d\n", buf, strlen(buf));*/ 57 ns->send_packet (sl);
62 Write_String_To_Socket (ns, buf, strlen (buf));
63} 58}
64 59
65/** 60/**
66 * Draws an extended message on the client. 61 * Draws an extended message on the client.
67 * ns the socket to send message to 62 * ns the socket to send message to
72 * message The main message 67 * message The main message
73 */ 68 */
74static void 69static void
75esrv_print_ext_msg (NewSocket * ns, int color, uint8 type, uint8 subtype, const char *message) 70esrv_print_ext_msg (NewSocket * ns, int color, uint8 type, uint8 subtype, const char *message)
76{ 71{
77 char buf[HUGE_BUF]; 72 packet sl;
78 73
79 snprintf (buf, HUGE_BUF, "drawextinfo %d %hhu %hhu %s", color, type, subtype, message); 74 sl.printf ("drawextinfo %d %hhu %hhu %s", color, type, subtype, message);
80 Write_String_To_Socket (ns, buf, strlen (buf)); 75 ns->send_packet (sl);
81
82/* LOG(llevDebug,"sending %s to socket, len=%d", buf, strlen(buf));*/
83
84} 76}
85 77
86/** 78/**
87 * Frontend for esrv_print_msg 79 * Frontend for esrv_print_msg
88 * \param colr message color 80 * \param colr message color
637 xmax = x > xmax ? x : xmax; 629 xmax = x > xmax ? x : xmax;
638 ymin = y < ymin ? y : ymin; 630 ymin = y < ymin ? y : ymin;
639 ymax = y > ymax ? y : ymax; 631 ymax = y > ymax ? y : ymax;
640 } 632 }
641 633
642 SockList sl (MAXSOCKBUF); 634 packet sl;
643 sl.printf ("magicmap %d %d %d %d ", (xmax - xmin + 1), (ymax - ymin + 1), 635 sl.printf ("magicmap %d %d %d %d ", (xmax - xmin + 1), (ymax - ymin + 1),
644 MAGIC_MAP_HALF - xmin, MAGIC_MAP_HALF - ymin); 636 MAGIC_MAP_HALF - xmin, MAGIC_MAP_HALF - ymin);
645 637
646 for (int y = ymin; y <= ymax; y++) 638 for (int y = ymin; y <= ymax; y++)
647 for (int x = xmin; x <= xmax; x++) 639 for (int x = xmin; x <= xmax; x++)
648 sl << uint8 (map_mark[x + MAGIC_MAP_SIZE * y] & ~FACE_FLOOR); 640 sl << uint8 (map_mark[x + MAGIC_MAP_SIZE * y] & ~FACE_FLOOR);
649 641
650 Send_With_Handling (&pl->contr->socket, &sl); 642 Send_With_Handling (&pl->contr->socket, &sl);
651 643
652 sl.free ();
653 644
654 free (map_mark); 645 free (map_mark);
655} 646}
656 647
657 648

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines