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.11 by root, Wed Sep 20 21:53:50 2006 UTC vs.
Revision 1.13 by root, Wed Dec 13 21:27:09 2006 UTC

214{ 214{
215 215
216 if (flags & NDI_ALL) 216 if (flags & NDI_ALL)
217 { 217 {
218 player *tmppl; 218 player *tmppl;
219 int i;
220 219
221 for (tmppl = first_player; tmppl != NULL; tmppl = tmppl->next) 220 for (tmppl = first_player; tmppl != NULL; tmppl = tmppl->next)
222 new_draw_info ((flags & ~NDI_ALL), pri, tmppl->ob, buf); 221 new_draw_info ((flags & ~NDI_ALL), pri, tmppl->ob, buf);
223 222
224 return; 223 return;
606 */ 605 */
607 606
608void 607void
609draw_magic_map (object *pl) 608draw_magic_map (object *pl)
610{ 609{
611 int x, y;
612 char *map_mark = (char *) calloc (MAGIC_MAP_SIZE * MAGIC_MAP_SIZE, 1); 610 char *map_mark = (char *)calloc (MAGIC_MAP_SIZE * MAGIC_MAP_SIZE, 1);
613 int xmin, xmax, ymin, ymax; 611 int xmin, xmax, ymin, ymax;
614 SockList sl;
615 612
616 if (pl->type != PLAYER) 613 if (pl->type != PLAYER)
617 { 614 {
618 LOG (llevError, "Non player object called draw_map.\n"); 615 LOG (llevError, "Non player object called draw_map.\n");
619 return; 616 return;
629 */ 626 */
630 xmin = MAGIC_MAP_SIZE; 627 xmin = MAGIC_MAP_SIZE;
631 ymin = MAGIC_MAP_SIZE; 628 ymin = MAGIC_MAP_SIZE;
632 xmax = 0; 629 xmax = 0;
633 ymax = 0; 630 ymax = 0;
631
634 for (x = 0; x < MAGIC_MAP_SIZE; x++) 632 for (int x = 0; x < MAGIC_MAP_SIZE; x++)
635 {
636 for (y = 0; y < MAGIC_MAP_SIZE; y++) 633 for (int y = 0; y < MAGIC_MAP_SIZE; y++)
637 {
638 if (map_mark[x + MAP_WIDTH (pl->map) * y] | FACE_FLOOR) 634 if (map_mark[x + MAP_WIDTH (pl->map) * y] | FACE_FLOOR)
639 { 635 {
640 xmin = x < xmin ? x : xmin; 636 xmin = x < xmin ? x : xmin;
641 xmax = x > xmax ? x : xmax; 637 xmax = x > xmax ? x : xmax;
642 ymin = y < ymin ? y : ymin; 638 ymin = y < ymin ? y : ymin;
643 ymax = y > ymax ? y : ymax; 639 ymax = y > ymax ? y : ymax;
644 } 640 }
645 }
646 }
647 641
648 sl.buf = (unsigned char *) malloc (MAXSOCKBUF); 642 SockList sl (MAXSOCKBUF);
649 snprintf ((char *) sl.buf, MAXSOCKBUF, "magicmap %d %d %d %d ", (xmax - xmin + 1), (ymax - ymin + 1), 643 sl.printf ("magicmap %d %d %d %d ", (xmax - xmin + 1), (ymax - ymin + 1),
650 MAGIC_MAP_HALF - xmin, MAGIC_MAP_HALF - ymin); 644 MAGIC_MAP_HALF - xmin, MAGIC_MAP_HALF - ymin);
651 sl.len = strlen ((char *) sl.buf);
652 645
653 for (y = ymin; y <= ymax; y++) 646 for (int y = ymin; y <= ymax; y++)
654 {
655 for (x = xmin; x <= xmax; x++) 647 for (int x = xmin; x <= xmax; x++)
656 {
657 sl.buf[sl.len++] = map_mark[x + MAGIC_MAP_SIZE * y] & ~FACE_FLOOR; 648 sl << uint8 (map_mark[x + MAGIC_MAP_SIZE * y] & ~FACE_FLOOR);
658 } /* x loop */
659 } /* y loop */
660 649
661 Send_With_Handling (&pl->contr->socket, &sl); 650 Send_With_Handling (&pl->contr->socket, &sl);
662 free (sl.buf); 651
652 sl.free ();
653
663 free (map_mark); 654 free (map_mark);
664} 655}
665 656
666 657
667/** 658/**
669 */ 660 */
670 661
671void 662void
672Log_Kill (const char *Who, const char *What, int WhatType, const char *With, int WithType) 663Log_Kill (const char *Who, const char *What, int WhatType, const char *With, int WithType)
673{ 664{
674 int i;
675 size_t len; 665 size_t len;
676 char buf[MAX_BUF]; 666 char buf[MAX_BUF];
677 667
678 if (With != NULL) 668 if (With != NULL)
679 snprintf (buf, MAX_BUF, "%s\t%s\t%d\t%s\t%d\n", Who, What, WhatType, With, WithType); 669 snprintf (buf, MAX_BUF, "%s\t%s\t%d\t%s\t%d\n", Who, What, WhatType, With, WithType);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines