密猟オンラインサーバープログラム
サーバー送出メッセージの調整
@@ -121,7 +121,7 @@ | ||
121 | 121 | #define SENDPACKET(u,p,s) send_packet_c (User[(u)].session.handle,(p),(s)) |
122 | 122 | #endif |
123 | 123 | |
124 | -#define CUTTAIL(s) cut_tail(s,USERNAME_LEN) | |
124 | +#define CUTTAIL(s) cut_tail(s,sizeof(s)) | |
125 | 125 | |
126 | 126 | #define ALLOCATE_CHUNK 16 |
127 | 127 | #define BUFFER_SIZE 256 |
@@ -4428,8 +4428,8 @@ | ||
4428 | 4428 | if (User[nowner].myshop[nshop].count[n][i]) |
4429 | 4429 | { |
4430 | 4430 | sprintf (work, |
4431 | - n ? MESG ("<%2d:%-32.24s:%10luP %4ucount (stock:%4u)>") : | |
4432 | - MESG ("<%2d:%-32.24s:%10luP %4uround (stock:%4u)>"), | |
4431 | + n ? MESG ("<%2d:%-32.32s:%10luP %4ucount (stock:%4u)>") : | |
4432 | + MESG ("<%2d:%-32.32s:%10luP %4uround (stock:%4u)>"), | |
4433 | 4433 | i, |
4434 | 4434 | (n ? Item[User[nowner].myshop[nshop].list[n][i]].name : |
4435 | 4435 | Weapon[User[nowner].myshop[nshop].list[n][i]].name), |
@@ -4472,7 +4472,7 @@ | ||
4472 | 4472 | { |
4473 | 4473 | WEAPONINFO *pw = Weapon + plist[i]; |
4474 | 4474 | sprintf (work, |
4475 | - MESG ("<%3d:%-32.24s:%10luP %4uround HP%4u/Moral%4u " | |
4475 | + MESG ("<%3d:%-32.32s:%10luP %4uround HP%4u/Moral%4u " | |
4476 | 4476 | "Range:%4ublock>"), |
4477 | 4477 | i, pw->name, pw->cost, pw->bullette, |
4478 | 4478 | pw->firepower, pw->moral, pw->range); |
@@ -4513,7 +4513,7 @@ | ||
4513 | 4513 | { |
4514 | 4514 | ITEMINFO *pi = Item + plist[i]; |
4515 | 4515 | sprintf (work, |
4516 | - MESG ("<%3d:%-32.24s:%10luP %4ucount>"), | |
4516 | + MESG ("<%3d:%-32.32s:%10luP %4ucount>"), | |
4517 | 4517 | i, pi->name, pi->cost, pi->count); |
4518 | 4518 | SendSystemMessagePacket (nuser, work); |
4519 | 4519 | } |
@@ -5791,21 +5791,21 @@ | ||
5791 | 5791 | if (ntarget != -1) |
5792 | 5792 | { |
5793 | 5793 | char uname[USERNAME_LEN]; |
5794 | - memcpy (uname, User[nuser].name, USERNAME_LEN); | |
5794 | + memcpy (uname, User[ntarget].name, USERNAME_LEN); | |
5795 | 5795 | printf ("Delete User name:%-.24s\n", uname); |
5796 | - DeleteUser (nuser); | |
5797 | - SendResultPacket (User[nuser].session.handle, 0); | |
5796 | + DeleteUser (ntarget); | |
5797 | + SendSystemMessagePacket (nuser, "[Delete complete]"); | |
5798 | 5798 | } |
5799 | 5799 | else |
5800 | 5800 | { |
5801 | 5801 | puts ("no user."); |
5802 | - SendResultPacket (User[nuser].session.handle, -1); | |
5802 | + SendSystemMessagePacket (nuser, "[no user]"); | |
5803 | 5803 | } |
5804 | 5804 | } |
5805 | 5805 | else |
5806 | 5806 | { |
5807 | 5807 | printf ("User:%d [%-.24s] is cracking!\n", nuser, User[nuser].name); |
5808 | - SendResultPacket (User[nuser].session.handle, -1); | |
5808 | + SendSystemMessagePacket (nuser, "[uh?]"); | |
5809 | 5809 | } |
5810 | 5810 | break; |
5811 | 5811 | case HCLIT_LOGOFF: |
@@ -6246,7 +6246,8 @@ | ||
6246 | 6246 | } |
6247 | 6247 | User[nuser].myshop[nshop].count[isitem][i]++; |
6248 | 6248 | sprintf (work, MESG ("[%-.24s stocked]"), |
6249 | - isitem ? Item[n].name : Weapon[n].name); | |
6249 | + isitem ? CUTTAIL (Item[n].name) : CUTTAIL (Weapon[n]. | |
6250 | + name)); | |
6250 | 6251 | SendSystemMessagePacket (nuser, work); |
6251 | 6252 | } |
6252 | 6253 | else |
@@ -6549,7 +6550,7 @@ | ||
6549 | 6550 | else |
6550 | 6551 | { |
6551 | 6552 | char work[PACKET_DATA_MAX]; |
6552 | - sprintf (work, MESG ("[Weapon:%-32.24s NOT READY]"), | |
6553 | + sprintf (work, MESG ("[Weapon:%-32.32s NOT READY]"), | |
6553 | 6554 | Weapon[User[nuser].weapon[nweapon]].name); |
6554 | 6555 | SendSystemMessagePacket (nuser, work); |
6555 | 6556 | } |
@@ -6601,8 +6602,9 @@ | ||
6601 | 6602 | { |
6602 | 6603 | /* list up this */ |
6603 | 6604 | int relpos = get_rel_position_in (dx1, dx2, dy1, dy2); |
6604 | - sprintf (work, MESG ("<%-16.24s %10s %5dBlock>"), | |
6605 | - Animal[i].name, MESG (RelDirection[relpos]), n); | |
6605 | + sprintf (work, MESG ("<%-.24s %10s %5dBlock>"), | |
6606 | + CUTTAIL (Animal[i].name), | |
6607 | + MESG (RelDirection[relpos]), n); | |
6606 | 6608 | SendSystemMessagePacket (nuser, work); |
6607 | 6609 | } |
6608 | 6610 | } |
@@ -6641,15 +6643,17 @@ | ||
6641 | 6643 | if (User[i].c_type == Hunter) |
6642 | 6644 | { |
6643 | 6645 | sprintf (work, |
6644 | - MESG ("<Hunter:%-16.24s %10s %5dBlock crime:%lu>"), | |
6645 | - User[i].name, MESG (RelDirection[relpos]), n, | |
6646 | + MESG ("<Hunter:%-.24s %10s %5dBlock crime:%lu>"), | |
6647 | + CUTTAIL (User[i].name), | |
6648 | + MESG (RelDirection[relpos]), n, | |
6646 | 6649 | User[i].maybearrest); |
6647 | 6650 | } |
6648 | 6651 | else |
6649 | 6652 | { |
6650 | 6653 | sprintf (work, |
6651 | - MESG ("<Guard :%-16.24s %10s %5dBlock>"), | |
6652 | - User[i].name, MESG (RelDirection[relpos]), n); | |
6654 | + MESG ("<Guard :%-.24s %10s %5dBlock>"), | |
6655 | + CUTTAIL (User[i].name), | |
6656 | + MESG (RelDirection[relpos]), n); | |
6653 | 6657 | } |
6654 | 6658 | SendSystemMessagePacket (nuser, work); |
6655 | 6659 | } |
@@ -6682,13 +6686,15 @@ | ||
6682 | 6686 | if (Npc[i].c_type == NpcHunter) |
6683 | 6687 | { |
6684 | 6688 | sprintf (work, |
6685 | - MESG ("<Hunter:%-16.24s %10s %5dBlock crime:NA>"), | |
6686 | - Npc[i].name, MESG (RelDirection[relpos]), n); | |
6689 | + MESG ("<Hunter:%-.24s %10s %5dBlock crime:NA>"), | |
6690 | + CUTTAIL (Npc[i].name), | |
6691 | + MESG (RelDirection[relpos]), n); | |
6687 | 6692 | } |
6688 | 6693 | else |
6689 | 6694 | { |
6690 | - sprintf (work, MESG ("<Guard :%-16.24s %10s %5dBlock>"), | |
6691 | - Npc[i].name, MESG (RelDirection[relpos]), n); | |
6695 | + sprintf (work, MESG ("<Guard :%-.24s %10s %5dBlock>"), | |
6696 | + CUTTAIL (Npc[i].name), | |
6697 | + MESG (RelDirection[relpos]), n); | |
6692 | 6698 | } |
6693 | 6699 | SendSystemMessagePacket (nuser, work); |
6694 | 6700 | } |
@@ -6921,13 +6927,13 @@ | ||
6921 | 6927 | } |
6922 | 6928 | break; |
6923 | 6929 | case Vehicle: |
6924 | - sprintf (work, MESG ("You ride on %-.24s"), pitem->name); | |
6930 | + sprintf (work, MESG ("You ride on %-.24s"), CUTTAIL (pitem->name)); | |
6925 | 6931 | rideVehicle (nuser, pitem->effect % 100, pitem->effect / 100, |
6926 | 6932 | pitem->pattern); |
6927 | 6933 | break; |
6928 | 6934 | case Food: |
6929 | 6935 | cause_eat (nuser, pitem->effect); |
6930 | - sprintf (work, MESG ("You eat %-.24s..."), pitem->name); | |
6936 | + sprintf (work, MESG ("You eat %-.24s..."), CUTTAIL (pitem->name)); | |
6931 | 6937 | if (pitem->effect > 100) |
6932 | 6938 | { |
6933 | 6939 | strcat (work, MESG ("Delicious!")); |
@@ -6991,7 +6997,7 @@ | ||
6991 | 6997 | User[nuser].item[i] = nitem; |
6992 | 6998 | User[nuser].itemcount[i] = Item[User[nuser].item[i]].count; |
6993 | 6999 | sprintf (work, MESG ("[Get item%1d:%-.24s]"), |
6994 | - i + 1, Item[User[nuser].item[i]].name); | |
7000 | + i + 1, CUTTAIL (Item[User[nuser].item[i]].name)); | |
6995 | 7001 | SendSystemMessagePacket (nuser, work); |
6996 | 7002 | return i; |
6997 | 7003 | } |
@@ -7019,7 +7025,7 @@ | ||
7019 | 7025 | User[nuser].bullette[i] = Weapon[User[nuser].weapon[i]].bullette; |
7020 | 7026 | User[nuser].reload[i] = 0; |
7021 | 7027 | sprintf (work, MESG ("[Get weapon%1d:%-.24s]"), |
7022 | - i + 1, Weapon[User[nuser].weapon[i]].name); | |
7028 | + i + 1, CUTTAIL (Weapon[User[nuser].weapon[i]].name)); | |
7023 | 7029 | SendSystemMessagePacket (nuser, work); |
7024 | 7030 | return i; |
7025 | 7031 | } |
@@ -7115,7 +7121,8 @@ | ||
7115 | 7121 | /* can't get this. drop original position */ |
7116 | 7122 | char work[MESG_BUFFER]; |
7117 | 7123 | sprintf (work, MESG ("[You have no space to get %-.24s!]"), |
7118 | - isitem ? Item[nitem].name : Weapon[nitem].name); | |
7124 | + isitem ? CUTTAIL (Item[nitem].name) : | |
7125 | + CUTTAIL (Weapon[nitem].name)); | |
7119 | 7126 | SendSystemMessagePacket (nuser, work); |
7120 | 7127 | addUserItemBox (x, y, isitem, nitem, nleft, NULL); |
7121 | 7128 | } |
@@ -7564,8 +7571,8 @@ | ||
7564 | 7571 | { |
7565 | 7572 | char work[MESG_BUFFER]; |
7566 | 7573 | sprintf (work, |
7567 | - MESG ("<%d:%-16.24s (%3d,%3d)>"), i + 1, | |
7568 | - User[nuser].myshop[i].name, | |
7574 | + MESG ("<%d:%-.24s (%3d,%3d)>"), i + 1, | |
7575 | + CUTTAIL (User[nuser].myshop[i].name), | |
7569 | 7576 | User[nuser].myshop[i].pos.x, User[nuser].myshop[i].pos.y); |
7570 | 7577 | SendSystemMessagePacket (nuser, work); |
7571 | 7578 | } |
@@ -7580,6 +7587,7 @@ | ||
7580 | 7587 | { |
7581 | 7588 | int i; |
7582 | 7589 | char work[MESG_BUFFER]; |
7590 | + char namebuffer[24]; | |
7583 | 7591 | SendSystemMessagePacket (nuser, MESG ("<CAPTURED ANIMAL>")); |
7584 | 7592 | for (i = 0; i < User[nuser].animal_slot; i++) |
7585 | 7593 | { |
@@ -7586,8 +7594,9 @@ | ||
7586 | 7594 | ANIMALDATA *p = User[nuser].lastPickupAnimal[i]; |
7587 | 7595 | if (p != NULL) |
7588 | 7596 | { |
7589 | - sprintf (work, MESG ("<%d:%-16.24s(%-.24s)>"), i + 1, p->name, | |
7590 | - Item[p->forsell_item].name); | |
7597 | + strncpy (namebuffer, CUTTAIL (p->name), sizeof (namebuffer)); | |
7598 | + sprintf (work, MESG ("<%d:%-.24s(%-.24s)>"), i + 1, namebuffer, | |
7599 | + CUTTAIL (Item[p->forsell_item].name)); | |
7591 | 7600 | SendSystemMessagePacket (nuser, work); |
7592 | 7601 | } |
7593 | 7602 | else |
@@ -7691,8 +7700,8 @@ | ||
7691 | 7700 | { |
7692 | 7701 | if (animal[i]) |
7693 | 7702 | { |
7694 | - sprintf (work, MESG ("<'%-16.24s' lives:%3d rate:%3u value:%5u>"), | |
7695 | - AnimalData[i].name, animal[i], | |
7703 | + sprintf (work, MESG ("<'%-.24s' lives:%3d rate:%3u value:%5u>"), | |
7704 | + CUTTAIL (AnimalData[i].name), animal[i], | |
7696 | 7705 | AnimalData[i].rate, AnimalData[i].value); |
7697 | 7706 | SendSystemMessagePacket (nuser, work); |
7698 | 7707 | } |
@@ -7735,9 +7744,9 @@ | ||
7735 | 7744 | { |
7736 | 7745 | strcpy (subjectbuffer, "NO SUBJECT"); |
7737 | 7746 | } |
7738 | - sprintf (work, "<%c%2d:%-16.24s %-.24s>", | |
7747 | + sprintf (work, "<%c%2d:%-.24s %-.32s>", | |
7739 | 7748 | pmail->readflag ? ' ' : '*', i + 1, |
7740 | - User[pmail->fromuser].name, subjectbuffer); | |
7749 | + CUTTAIL (User[pmail->fromuser].name), subjectbuffer); | |
7741 | 7750 | SendSystemMessagePacket (nuser, work); |
7742 | 7751 | f = 1; |
7743 | 7752 | } |
@@ -7829,8 +7838,9 @@ | ||
7829 | 7838 | { |
7830 | 7839 | strcpy (subjectbuffer, "NO SUBJECT"); |
7831 | 7840 | } |
7832 | - sprintf (work, "<%2d:%-16.24s %-.24s>", | |
7833 | - i + 1, User[pmail->fromuser].name, subjectbuffer); | |
7841 | + sprintf (work, "<%2d:%-.24s %-.32s>", | |
7842 | + i + 1, CUTTAIL (User[pmail->fromuser].name), | |
7843 | + subjectbuffer); | |
7834 | 7844 | SendSystemMessagePacket (nuser, work); |
7835 | 7845 | f = 1; |
7836 | 7846 | } |
@@ -8293,9 +8303,12 @@ | ||
8293 | 8303 | { |
8294 | 8304 | if (pb->nuser != -1 && pb->t_type == TargetNpc) |
8295 | 8305 | { |
8306 | + char namebuffer[24]; | |
8307 | + strncpy (namebuffer, CUTTAIL (Npc[npc].name), | |
8308 | + sizeof (namebuffer)); | |
8296 | 8309 | sprintf (work, |
8297 | 8310 | MESG ("'%-.24s' killed by %-.24s!"), |
8298 | - CUTTAIL (Npc[npc].name), | |
8311 | + namebuffer, | |
8299 | 8312 | CUTTAIL (Npc[pb->nuser].name)); |
8300 | 8313 | } |
8301 | 8314 | else |
@@ -8689,7 +8702,7 @@ | ||
8689 | 8702 | /* perhaps,disconnect session. */ |
8690 | 8703 | char work[USERNAME_LEN]; |
8691 | 8704 | memcpy (work, User[i].name, USERNAME_LEN); |
8692 | - printf ("user(%d)[%-16.24s] no response\n", i, work); | |
8705 | + printf ("user(%d)[%-.24s] no response\n", i, work); | |
8693 | 8706 | DisconnectUser (i); |
8694 | 8707 | } |
8695 | 8708 | } |
@@ -8886,8 +8899,10 @@ | ||
8886 | 8899 | { |
8887 | 8900 | /* eat meat */ |
8888 | 8901 | char work[MESG_BUFFER]; |
8889 | - sprintf (work, MESG ("animal '%-.24s' eat %-.24s"), | |
8890 | - CUTTAIL (Animal[nanimal].name), | |
8902 | + char namebuffer[24]; | |
8903 | + strncpy (namebuffer, CUTTAIL (Animal[nanimal].name), | |
8904 | + sizeof (namebuffer)); | |
8905 | + sprintf (work, MESG ("animal '%-.24s' eat %-.24s"), namebuffer, | |
8891 | 8906 | CUTTAIL (Animal[targetanimal].name)); |
8892 | 8907 | SendMessageNearUserPosition (Animal[nanimal].pos, work); |
8893 | 8908 | MAP (Animal[targetanimal].pos.x, Animal[targetanimal].pos.y)->id &= |
@@ -9988,7 +10003,7 @@ | ||
9988 | 10003 | MAP (x, y)->id &= ~MAP_THERE_HOLE; |
9989 | 10004 | Npc[n].hold_count = HoldCount; |
9990 | 10005 | sprintf (work, MESG ("[You hear sound %-.24s fall in hole!]"), |
9991 | - Npc[n].name); | |
10006 | + CUTTAIL (Npc[n].name)); | |
9992 | 10007 | SendMessageNearUserPosition (Npc[n].pos, work); |
9993 | 10008 | } |
9994 | 10009 | } |