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