• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

密猟オンラインサーバープログラム


Commit MetaInfo

Revision9 (tree)
Time2016-02-01 01:39:42
Authormanjihq

Log Message

サーバー送出メッセージの調整

Change Summary

Incremental Difference

--- trunk/huntserv.c (revision 8)
+++ trunk/huntserv.c (revision 9)
@@ -121,7 +121,7 @@
121121 #define SENDPACKET(u,p,s) send_packet_c (User[(u)].session.handle,(p),(s))
122122 #endif
123123
124-#define CUTTAIL(s) cut_tail(s,USERNAME_LEN)
124+#define CUTTAIL(s) cut_tail(s,sizeof(s))
125125
126126 #define ALLOCATE_CHUNK 16
127127 #define BUFFER_SIZE 256
@@ -4428,8 +4428,8 @@
44284428 if (User[nowner].myshop[nshop].count[n][i])
44294429 {
44304430 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)>"),
44334433 i,
44344434 (n ? Item[User[nowner].myshop[nshop].list[n][i]].name :
44354435 Weapon[User[nowner].myshop[nshop].list[n][i]].name),
@@ -4472,7 +4472,7 @@
44724472 {
44734473 WEAPONINFO *pw = Weapon + plist[i];
44744474 sprintf (work,
4475- MESG ("<%3d:%-32.24s:%10luP %4uround HP%4u/Moral%4u "
4475+ MESG ("<%3d:%-32.32s:%10luP %4uround HP%4u/Moral%4u "
44764476 "Range:%4ublock>"),
44774477 i, pw->name, pw->cost, pw->bullette,
44784478 pw->firepower, pw->moral, pw->range);
@@ -4513,7 +4513,7 @@
45134513 {
45144514 ITEMINFO *pi = Item + plist[i];
45154515 sprintf (work,
4516- MESG ("<%3d:%-32.24s:%10luP %4ucount>"),
4516+ MESG ("<%3d:%-32.32s:%10luP %4ucount>"),
45174517 i, pi->name, pi->cost, pi->count);
45184518 SendSystemMessagePacket (nuser, work);
45194519 }
@@ -5791,21 +5791,21 @@
57915791 if (ntarget != -1)
57925792 {
57935793 char uname[USERNAME_LEN];
5794- memcpy (uname, User[nuser].name, USERNAME_LEN);
5794+ memcpy (uname, User[ntarget].name, USERNAME_LEN);
57955795 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]");
57985798 }
57995799 else
58005800 {
58015801 puts ("no user.");
5802- SendResultPacket (User[nuser].session.handle, -1);
5802+ SendSystemMessagePacket (nuser, "[no user]");
58035803 }
58045804 }
58055805 else
58065806 {
58075807 printf ("User:%d [%-.24s] is cracking!\n", nuser, User[nuser].name);
5808- SendResultPacket (User[nuser].session.handle, -1);
5808+ SendSystemMessagePacket (nuser, "[uh?]");
58095809 }
58105810 break;
58115811 case HCLIT_LOGOFF:
@@ -6246,7 +6246,8 @@
62466246 }
62476247 User[nuser].myshop[nshop].count[isitem][i]++;
62486248 sprintf (work, MESG ("[%-.24s stocked]"),
6249- isitem ? Item[n].name : Weapon[n].name);
6249+ isitem ? CUTTAIL (Item[n].name) : CUTTAIL (Weapon[n].
6250+ name));
62506251 SendSystemMessagePacket (nuser, work);
62516252 }
62526253 else
@@ -6549,7 +6550,7 @@
65496550 else
65506551 {
65516552 char work[PACKET_DATA_MAX];
6552- sprintf (work, MESG ("[Weapon:%-32.24s NOT READY]"),
6553+ sprintf (work, MESG ("[Weapon:%-32.32s NOT READY]"),
65536554 Weapon[User[nuser].weapon[nweapon]].name);
65546555 SendSystemMessagePacket (nuser, work);
65556556 }
@@ -6601,8 +6602,9 @@
66016602 {
66026603 /* list up this */
66036604 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);
66066608 SendSystemMessagePacket (nuser, work);
66076609 }
66086610 }
@@ -6641,15 +6643,17 @@
66416643 if (User[i].c_type == Hunter)
66426644 {
66436645 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,
66466649 User[i].maybearrest);
66476650 }
66486651 else
66496652 {
66506653 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);
66536657 }
66546658 SendSystemMessagePacket (nuser, work);
66556659 }
@@ -6682,13 +6686,15 @@
66826686 if (Npc[i].c_type == NpcHunter)
66836687 {
66846688 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);
66876692 }
66886693 else
66896694 {
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);
66926698 }
66936699 SendSystemMessagePacket (nuser, work);
66946700 }
@@ -6921,13 +6927,13 @@
69216927 }
69226928 break;
69236929 case Vehicle:
6924- sprintf (work, MESG ("You ride on %-.24s"), pitem->name);
6930+ sprintf (work, MESG ("You ride on %-.24s"), CUTTAIL (pitem->name));
69256931 rideVehicle (nuser, pitem->effect % 100, pitem->effect / 100,
69266932 pitem->pattern);
69276933 break;
69286934 case Food:
69296935 cause_eat (nuser, pitem->effect);
6930- sprintf (work, MESG ("You eat %-.24s..."), pitem->name);
6936+ sprintf (work, MESG ("You eat %-.24s..."), CUTTAIL (pitem->name));
69316937 if (pitem->effect > 100)
69326938 {
69336939 strcat (work, MESG ("Delicious!"));
@@ -6991,7 +6997,7 @@
69916997 User[nuser].item[i] = nitem;
69926998 User[nuser].itemcount[i] = Item[User[nuser].item[i]].count;
69936999 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));
69957001 SendSystemMessagePacket (nuser, work);
69967002 return i;
69977003 }
@@ -7019,7 +7025,7 @@
70197025 User[nuser].bullette[i] = Weapon[User[nuser].weapon[i]].bullette;
70207026 User[nuser].reload[i] = 0;
70217027 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));
70237029 SendSystemMessagePacket (nuser, work);
70247030 return i;
70257031 }
@@ -7115,7 +7121,8 @@
71157121 /* can't get this. drop original position */
71167122 char work[MESG_BUFFER];
71177123 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));
71197126 SendSystemMessagePacket (nuser, work);
71207127 addUserItemBox (x, y, isitem, nitem, nleft, NULL);
71217128 }
@@ -7564,8 +7571,8 @@
75647571 {
75657572 char work[MESG_BUFFER];
75667573 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),
75697576 User[nuser].myshop[i].pos.x, User[nuser].myshop[i].pos.y);
75707577 SendSystemMessagePacket (nuser, work);
75717578 }
@@ -7580,6 +7587,7 @@
75807587 {
75817588 int i;
75827589 char work[MESG_BUFFER];
7590+ char namebuffer[24];
75837591 SendSystemMessagePacket (nuser, MESG ("<CAPTURED ANIMAL>"));
75847592 for (i = 0; i < User[nuser].animal_slot; i++)
75857593 {
@@ -7586,8 +7594,9 @@
75867594 ANIMALDATA *p = User[nuser].lastPickupAnimal[i];
75877595 if (p != NULL)
75887596 {
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));
75917600 SendSystemMessagePacket (nuser, work);
75927601 }
75937602 else
@@ -7691,8 +7700,8 @@
76917700 {
76927701 if (animal[i])
76937702 {
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],
76967705 AnimalData[i].rate, AnimalData[i].value);
76977706 SendSystemMessagePacket (nuser, work);
76987707 }
@@ -7735,9 +7744,9 @@
77357744 {
77367745 strcpy (subjectbuffer, "NO SUBJECT");
77377746 }
7738- sprintf (work, "<%c%2d:%-16.24s %-.24s>",
7747+ sprintf (work, "<%c%2d:%-.24s %-.32s>",
77397748 pmail->readflag ? ' ' : '*', i + 1,
7740- User[pmail->fromuser].name, subjectbuffer);
7749+ CUTTAIL (User[pmail->fromuser].name), subjectbuffer);
77417750 SendSystemMessagePacket (nuser, work);
77427751 f = 1;
77437752 }
@@ -7829,8 +7838,9 @@
78297838 {
78307839 strcpy (subjectbuffer, "NO SUBJECT");
78317840 }
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);
78347844 SendSystemMessagePacket (nuser, work);
78357845 f = 1;
78367846 }
@@ -8293,9 +8303,12 @@
82938303 {
82948304 if (pb->nuser != -1 && pb->t_type == TargetNpc)
82958305 {
8306+ char namebuffer[24];
8307+ strncpy (namebuffer, CUTTAIL (Npc[npc].name),
8308+ sizeof (namebuffer));
82968309 sprintf (work,
82978310 MESG ("'%-.24s' killed by %-.24s!"),
8298- CUTTAIL (Npc[npc].name),
8311+ namebuffer,
82998312 CUTTAIL (Npc[pb->nuser].name));
83008313 }
83018314 else
@@ -8689,7 +8702,7 @@
86898702 /* perhaps,disconnect session. */
86908703 char work[USERNAME_LEN];
86918704 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);
86938706 DisconnectUser (i);
86948707 }
86958708 }
@@ -8886,8 +8899,10 @@
88868899 {
88878900 /* eat meat */
88888901 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,
88918906 CUTTAIL (Animal[targetanimal].name));
88928907 SendMessageNearUserPosition (Animal[nanimal].pos, work);
88938908 MAP (Animal[targetanimal].pos.x, Animal[targetanimal].pos.y)->id &=
@@ -9988,7 +10003,7 @@
998810003 MAP (x, y)->id &= ~MAP_THERE_HOLE;
998910004 Npc[n].hold_count = HoldCount;
999010005 sprintf (work, MESG ("[You hear sound %-.24s fall in hole!]"),
9991- Npc[n].name);
10006+ CUTTAIL (Npc[n].name));
999210007 SendMessageNearUserPosition (Npc[n].pos, work);
999310008 }
999410009 }