• 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

Revision12 (tree)
Time2016-12-21 17:58:35
Authormanjihq

Log Message

管理者コマンドに関するメッセージ応答の追加
一部名称表示部分でただしく扱えていないのを修正

Change Summary

Incremental Difference

--- trunk/huntserv.c (revision 11)
+++ trunk/huntserv.c (revision 12)
@@ -1482,11 +1482,11 @@
14821482 for (j = 0; j < USERSHOP_LIMIT; j++)
14831483 {
14841484 char namebuf[BUFFER_SIZE];
1485- memcpy (namebuf, User[i].myshop[j].name, USERNAME_LEN);
1485+ memcpy (namebuf, User[i].myshop[j].name, USERNAME_LEN + 1);
14861486 fprintf (optr, "%d,%d,%d,%-.24s\n",
14871487 User[i].myshop[j].build,
14881488 User[i].myshop[j].pos.x, User[i].myshop[j].pos.y,
1489- namebuf);
1489+ CUTTAIL (namebuf));
14901490 if (User[i].myshop[j].build)
14911491 {
14921492 int k;
@@ -1494,9 +1494,9 @@
14941494 {
14951495 memcpy (namebuf,
14961496 Weapon[User[i].myshop[j].list[0][k]].name,
1497- WEAPONNAME_LEN);
1497+ WEAPONNAME_LEN + 1);
14981498 fprintf (optr, "%-.24s,%u,%u,%lu\n",
1499- namebuf,
1499+ CUTTAIL (namebuf),
15001500 User[i].myshop[j].leftuse[0][k],
15011501 User[i].myshop[j].count[0][k],
15021502 User[i].myshop[j].cost[0][k]);
@@ -1505,9 +1505,9 @@
15051505 {
15061506 memcpy (namebuf,
15071507 Item[User[i].myshop[j].list[1][k]].name,
1508- ITEMNAME_LEN);
1508+ ITEMNAME_LEN + 1);
15091509 fprintf (optr, "%-.24s,%u,%u,%lu\n",
1510- namebuf,
1510+ CUTTAIL (namebuf),
15111511 User[i].myshop[j].leftuse[1][k],
15121512 User[i].myshop[j].count[1][k],
15131513 User[i].myshop[j].cost[1][k]);
@@ -2129,7 +2129,7 @@
21292129 memset (User[userno].statusinfo, 0, PACKET_MAX);
21302130 memset (User[userno].mapdata, 0, PACKET_MAX);
21312131 memcpy (work, User[userno].name, USERNAME_LEN);
2132- printf ("user(%d)[%-.24s] logoff.\n", userno, work);
2132+ printf ("user(%d)[%-.24s] logoff.\n", userno, CUTTAIL (work));
21332133 User[userno].idletimer = 0;
21342134 }
21352135 ClearUser (userno);
@@ -2556,7 +2556,8 @@
25562556 strncpy (namebuf, User[pmail->fromuser].name, USERNAME_LEN);
25572557 namebuf[USERNAME_LEN] = '\0';
25582558 fprintf (optr, "%d,%d,%lu\n%-.24s\n",
2559- pmail->readflag, pmail->line, pmail->timestamp, namebuf);
2559+ pmail->readflag, pmail->line, pmail->timestamp,
2560+ CUTTAIL (namebuf));
25602561 n = (unsigned char) (pmail->subject[0]);
25612562 if (n)
25622563 {
@@ -2765,7 +2766,8 @@
27652766 strncpy (namebuf, User[pmail->fromuser].name, USERNAME_LEN);
27662767 namebuf[USERNAME_LEN] = '\0';
27672768 fprintf (optr, "%d,%d,%lu\n%-.24s\n",
2768- pmail->readflag, pmail->line, pmail->timestamp, namebuf);
2769+ pmail->readflag, pmail->line, pmail->timestamp,
2770+ CUTTAIL (namebuf));
27692771 n = (unsigned char) (pmail->subject[0]);
27702772 if (n)
27712773 {
@@ -4876,7 +4878,7 @@
48764878 char uname[USERNAME_LEN];
48774879 char work[PASSWORD_LEN];
48784880 memcpy (uname, User[nuser].name, USERNAME_LEN);
4879- printf ("User name:%-.24s\n", uname);
4881+ printf ("User name:%-.24s\n", CUTTAIL (uname));
48804882 for (i = 0; i < PASSWORD_LEN; i++)
48814883 {
48824884 if (*(p + i) == '\0')
@@ -4960,7 +4962,8 @@
49604962 }
49614963 else
49624964 {
4963- printf ("Blocked User:%-.24s\n", User[nuser].name);
4965+ printf ("Blocked User:%-.24s\n",
4966+ CUTTAIL (User[nuser].name));
49644967 }
49654968 SendResultPacket (psession->handle, -1);
49664969 }
@@ -5568,6 +5571,7 @@
55685571 doJailAccount (unsigned char *p)
55695572 {
55705573 int ntarget = SearchUser ((char *) p);
5574+ char work[MESG_BUFFER];
55715575 if (ntarget != -1)
55725576 {
55735577 unsigned char action = *(p + USERNAME_LEN);
@@ -5575,16 +5579,24 @@
55755579 {
55765580 /* block user account */
55775581 puts ("block user account");
5578- printf ("User %d [%-.24s]\n", ntarget, User[ntarget].name);
5582+ printf ("User %d [%-.24s]\n", ntarget,
5583+ CUTTAIL (User[ntarget].name));
55795584 DisconnectUser (ntarget);
55805585 User[ntarget].account_status = AccountBlock;
5586+ sprintf (work, MESG ("[user '%-.24s' is blocked]"),
5587+ CUTTAIL (User[ntarget].name));
5588+ SendSystemMessagePacket (0, work);
55815589 }
55825590 else
55835591 {
55845592 /* recover user account */
55855593 puts ("recover user account");
5586- printf ("User %d [%-.24s]\n", ntarget, User[ntarget].name);
5594+ printf ("User %d [%-.24s]\n", ntarget,
5595+ CUTTAIL (User[ntarget].name));
55875596 User[ntarget].account_status = AccountActive;
5597+ sprintf (work, MESG ("[user '%-.24s' is recoverd]"),
5598+ CUTTAIL (User[ntarget].name));
5599+ SendSystemMessagePacket (0, work);
55885600 }
55895601 }
55905602 return;
@@ -5601,14 +5613,17 @@
56015613 if (nuser == -1)
56025614 {
56035615 puts ("no user.");
5616+ SendSystemMessagePacket (0, MESG ("[no such user]"));
56045617 }
56055618 else if (nuser == 0)
56065619 {
56075620 puts ("Can't change administrator password!");
5621+ SendSystemMessagePacket (0, MESG ("[no such user]"));
56085622 }
56095623 else
56105624 {
56115625 int i;
5626+ char work[MESG_BUFFER];
56125627 char wkpassword[PASSWORD_LEN];
56135628 unsigned char *ppassword = p + USERNAME_LEN;
56145629 for (i = 0; i < PASSWORD_LEN; i++, ppassword++)
@@ -5623,9 +5638,12 @@
56235638 {
56245639 wkpassword[i] = ' ';
56255640 }
5626- printf ("Change %-.24s password to [%-.24s]\n", User[nuser].name,
5627- wkpassword);
5641+ printf ("Change %-.24s password ", CUTTAIL (User[nuser].name));
5642+ printf ("to [%-.24s]\n", CUTTAIL (wkpassword));
56285643 memcpy (User[nuser].password, wkpassword, PASSWORD_LEN);
5644+ sprintf (work, MESG ("[user '%-.24s' password is changed]"),
5645+ CUTTAIL (User[nuser].name));
5646+ SendSystemMessagePacket (0, work);
56295647 }
56305648 }
56315649
@@ -5652,6 +5670,7 @@
56525670 break;
56535671 default:
56545672 printf ("unknown admin command %02X\n", (unsigned) *p);
5673+ SendSystemMessagePacket (0, MESG ("[illegal command]"));
56555674 break;
56565675 }
56575676 return;
@@ -5836,7 +5855,7 @@
58365855 {
58375856 char uname[USERNAME_LEN];
58385857 memcpy (uname, User[ntarget].name, USERNAME_LEN);
5839- printf ("Delete User name:%-.24s\n", uname);
5858+ printf ("Delete User name:%-.24s\n", CUTTAIL (uname));
58405859 DeleteUser (ntarget);
58415860 SendSystemMessagePacket (nuser, "[Delete complete]");
58425861 }
@@ -5848,7 +5867,8 @@
58485867 }
58495868 else
58505869 {
5851- printf ("User:%d [%-.24s] is cracking!\n", nuser, User[nuser].name);
5870+ printf ("User:%d [%-.24s] is cracking!\n", nuser,
5871+ CUTTAIL (User[nuser].name));
58525872 SendSystemMessagePacket (nuser, "[uh?]");
58535873 }
58545874 break;
@@ -6290,8 +6310,8 @@
62906310 }
62916311 User[nuser].myshop[nshop].count[isitem][i]++;
62926312 sprintf (work, MESG ("[%-.24s stocked]"),
6293- isitem ? CUTTAIL (Item[n].
6294- name) : CUTTAIL (Weapon[n].name));
6313+ isitem ? CUTTAIL (Item[n].name) : CUTTAIL (Weapon[n].
6314+ name));
62956315 SendSystemMessagePacket (nuser, work);
62966316 }
62976317 else
@@ -7631,7 +7651,7 @@
76317651 {
76327652 int i;
76337653 char work[MESG_BUFFER];
7634- char namebuffer[24];
7654+ char namebuffer[24 + 1];
76357655 SendSystemMessagePacket (nuser, MESG ("<CAPTURED ANIMAL>"));
76367656 for (i = 0; i < User[nuser].animal_slot; i++)
76377657 {
@@ -8347,7 +8367,7 @@
83478367 {
83488368 if (pb->nuser != -1 && pb->t_type == TargetNpc)
83498369 {
8350- char namebuffer[24];
8370+ char namebuffer[24 + 1];
83518371 strncpy (namebuffer, CUTTAIL (Npc[npc].name),
83528372 sizeof (namebuffer));
83538373 sprintf (work,
@@ -8746,7 +8766,7 @@
87468766 /* perhaps,disconnect session. */
87478767 char work[USERNAME_LEN];
87488768 memcpy (work, User[i].name, USERNAME_LEN);
8749- printf ("user(%d)[%-.24s] no response\n", i, work);
8769+ printf ("user(%d)[%-.24s] no response\n", i, CUTTAIL (work));
87508770 DisconnectUser (i);
87518771 }
87528772 }
@@ -8943,7 +8963,7 @@
89438963 {
89448964 /* eat meat */
89458965 char work[MESG_BUFFER];
8946- char namebuffer[24];
8966+ char namebuffer[24 + 1];
89478967 strncpy (namebuffer, CUTTAIL (Animal[nanimal].name),
89488968 sizeof (namebuffer));
89498969 sprintf (work, MESG ("animal '%-.24s' eat %-.24s"), namebuffer,