• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

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


Commit MetaInfo

Révision3 (tree)
l'heure2016-01-24 13:11:53
Auteurmanjihq

Message de Log

システムのロケールをutf-8に変更
設定ファイルのエンコードも同じくutf-8に変更
クライアントへの送出メッセージを定義ファイルで設定可能にした
それにともない、送出メッセージの日本語化

Change Summary

Modification

--- trunk/huntserv.c (revision 2)
+++ trunk/huntserv.c (revision 3)
@@ -1,4 +1,8 @@
11 #include "port.h"
2+#ifdef USE_LOCALE
3+#include <locale.h>
4+#include <langinfo.h>
5+#endif
26 #include <stdio.h>
37 #include <stdlib.h>
48 #include <string.h>
@@ -11,6 +15,7 @@
1115 #include "ctlsock.h"
1216 #include "hunt.h"
1317 #include "pktio.h"
18+#include "strtable.h"
1419
1520 /* Game feature */
1621 #define USE_SAVEMAP
@@ -38,6 +43,7 @@
3843 #ifdef USE_BBS
3944 #define BBS_DATA_FILE "h-bbs"
4045 #endif
46+#define MESG_DATA_FILE "h-mesg"
4147 #ifndef HEARNEAR_DISTANCE
4248 #define HEARNEAR_DISTANCE 10
4349 #endif
@@ -710,7 +716,7 @@
710716
711717 /************************************************/
712718 #ifdef MAKEWIN32
713-/* convert Shift-jis to EUC-JP */
719+/* convert Shift-jis to UTF-8 */
714720 static const char *
715721 convertC2H (char *p, int nlen)
716722 {
@@ -733,7 +739,7 @@
733739 return pret;
734740 }
735741
736-/* convert EUC-JP to Shift-jis */
742+/* convert UTF-8 to Shift-jis */
737743 static const char *
738744 convertH2C (char *p, int nlen)
739745 {
@@ -4278,7 +4284,7 @@
42784284 int i;
42794285 unsigned char packet[PACKET_MAX];
42804286 ret = 0;
4281- SendSystemMessagePacket (userno, "==== registered people ====");
4287+ SendSystemMessagePacket (userno, MESG ("==== registered people ===="));
42824288 for (i = 0; i < UserLimit && !ret; i++)
42834289 {
42844290 if (User[i].name[0] != '\0')
@@ -4295,7 +4301,7 @@
42954301 ret = SENDPACKET (userno, packet, n - 2);
42964302 }
42974303 }
4298- SendSystemMessagePacket (userno, "==== end of list ====");
4304+ SendSystemMessagePacket (userno, MESG ("==== end of list ===="));
42994305 }
43004306 return ret;
43014307 }
@@ -4484,7 +4490,8 @@
44844490 if (nshop == -1 || User[nowner].myshop[nshop].build == 0)
44854491 {
44864492 /* error ?? */
4487- SendSystemMessagePacket (nuser, "(FATAL:user shop linkage is broken)");
4493+ SendSystemMessagePacket (nuser,
4494+ MESG ("(FATAL:user shop linkage is broken)"));
44884495 return;
44894496 }
44904497 for (i = 0; i < SELLINSHOP_LIMIT; i++)
@@ -4492,8 +4499,8 @@
44924499 if (User[nowner].myshop[nshop].count[n][i])
44934500 {
44944501 sprintf (work,
4495- n ? "<%2d:%-32.32s:%10luP %4ucount (stock:%4u)>" :
4496- "<%2d:%-32.32s:%10luP %4uround (stock:%4u)>",
4502+ n ? MESG ("<%2d:%-32.32s:%10luP %4ucount (stock:%4u)>") :
4503+ MESG ("<%2d:%-32.32s:%10luP %4uround (stock:%4u)>"),
44974504 i,
44984505 (n ? Item[User[nowner].myshop[nshop].list[n][i]].name :
44994506 Weapon[User[nowner].myshop[nshop].list[n][i]].name),
@@ -4511,7 +4518,7 @@
45114518 SendWeaponList (int nuser)
45124519 {
45134520 int nowner = MAP (User[nuser].pos.x, User[nuser].pos.y)->owner;
4514- SendSystemMessagePacket (nuser, "<WEAPON LIST>");
4521+ SendSystemMessagePacket (nuser, MESG ("<WEAPON LIST>"));
45154522 if (nowner)
45164523 {
45174524 SendUserShopList (nowner - 1, nuser, 0);
@@ -4535,13 +4542,15 @@
45354542 for (i = 0; i < nmax; i++)
45364543 {
45374544 WEAPONINFO *pw = Weapon + plist[i];
4538- sprintf (work, "<%3d:%-32.32s:%10luP %4uround %4u/%4u %4ublock>",
4545+ sprintf (work,
4546+ MESG ("<%3d:%-32.32s:%10luP %4uround HP%4u/Moral%4u "
4547+ "Range:%4ublock>"),
45394548 i, pw->name, pw->cost, pw->bullette,
45404549 pw->firepower, pw->moral, pw->range);
45414550 SendSystemMessagePacket (nuser, work);
45424551 }
45434552 }
4544- SendSystemMessagePacket (nuser, "<end of list>");
4553+ SendSystemMessagePacket (nuser, MESG ("<end of list>"));
45454554 return;
45464555 }
45474556
@@ -4550,7 +4559,7 @@
45504559 SendItemList (int nuser)
45514560 {
45524561 int nowner = MAP (User[nuser].pos.x, User[nuser].pos.y)->owner;
4553- SendSystemMessagePacket (nuser, "<ITEM LIST>");
4562+ SendSystemMessagePacket (nuser, MESG ("<ITEM LIST>"));
45544563 if (nowner)
45554564 {
45564565 SendUserShopList (nowner - 1, nuser, 1);
@@ -4574,12 +4583,13 @@
45744583 for (i = 0; i < nmax; i++)
45754584 {
45764585 ITEMINFO *pi = Item + plist[i];
4577- sprintf (work, "<%3d:%-32.32s:%10luP %4ucount>",
4586+ sprintf (work,
4587+ MESG ("<%3d:%-32.32s:%10luP %4ucount>"),
45784588 i, pi->name, pi->cost, pi->count);
45794589 SendSystemMessagePacket (nuser, work);
45804590 }
45814591 }
4582- SendSystemMessagePacket (nuser, "<end of list>");
4592+ SendSystemMessagePacket (nuser, MESG ("<end of list>"));
45834593 return;
45844594 }
45854595
@@ -4675,7 +4685,7 @@
46754685 NPCsay (int npc, const char *mesg[], int nmax)
46764686 {
46774687 char work[MESG_BUFFER];
4678- sprintf (work, mesg[getrand (0, nmax - 1)], CUTTAIL (Npc[npc].name));
4688+ sprintf (work, MESG (mesg[getrand (0, nmax - 1)]), CUTTAIL (Npc[npc].name));
46794689 SendMessageNearUserPosition (Npc[npc].pos, work);
46804690 return;
46814691 }
@@ -4697,15 +4707,15 @@
46974707 switch (t)
46984708 {
46994709 case TargetUser:
4700- sprintf (work, "%-.16s damages you. lost %uHP.",
4710+ sprintf (work, MESG ("%-.16s damages you. lost %uHP."),
47014711 CUTTAIL (User[fromuser].name), ndamage);
47024712 break;
47034713 case TargetNpc:
4704- sprintf (work, "%-.16s damages you. lost %uHP.",
4714+ sprintf (work, MESG ("%-.16s damages you. lost %uHP."),
47054715 CUTTAIL (Npc[fromuser].name), ndamage);
47064716 break;
47074717 case TargetAnimal:
4708- sprintf (work, "Animal '%-.16s' damages you. lost %uHP",
4718+ sprintf (work, MESG ("Animal '%-.16s' damages you. lost %uHP"),
47094719 CUTTAIL (Animal[fromuser].name), ndamage);
47104720 break;
47114721 default:
@@ -4718,7 +4728,8 @@
47184728 }
47194729 if (t == TargetUser)
47204730 {
4721- sprintf (work, "You attack %-.16s", CUTTAIL (User[nuser].name));
4731+ sprintf (work, MESG ("You attack %-.16s"),
4732+ CUTTAIL (User[nuser].name));
47224733 SendSystemMessagePacket (fromuser, work);
47234734 }
47244735 }
@@ -4884,8 +4895,9 @@
48844895 }
48854896 else
48864897 {
4887- SendSystemMessagePacket (nuser, "[You were arrested too many times!]");
4888- SendSystemMessagePacket (nuser, "[You were executed!]");
4898+ SendSystemMessagePacket (nuser,
4899+ MESG ("[You were arrested too many times!]"));
4900+ SendSystemMessagePacket (nuser, MESG ("[You were executed!]"));
48894901 User[nuser].hp = 0;
48904902 User[nuser].lastuser = -1;
48914903 }
@@ -4991,7 +5003,8 @@
49915003 if (User[nuser].status == Arrested)
49925004 {
49935005 SendSystemMessagePacket (nuser,
4994- "[Welcome to Jail!]");
5006+ MESG
5007+ ("[Welcome to Jail!]"));
49955008 }
49965009 #ifdef USE_MAIL
49975010 if (CheckNewMail (nuser))
@@ -4998,7 +5011,8 @@
49985011 {
49995012 /* new mail! */
50005013 SendSystemMessagePacket (nuser,
5001- "[You have new mail]");
5014+ MESG
5015+ ("[You have new mail]"));
50025016 }
50035017 #endif
50045018 ret = 0;
@@ -5453,7 +5467,7 @@
54535467 }
54545468 else
54555469 {
5456- SendSystemMessagePacket (nuser, "(Mail error:no such user!)");
5470+ SendSystemMessagePacket (nuser, MESG ("(Mail error:no such user!)"));
54575471 }
54585472 return;
54595473 }
@@ -5483,15 +5497,15 @@
54835497 /* ?? occur error. perhaps mailbox is full. */
54845498 puts ("Mail delivery fail");
54855499 SendSystemMessagePacket (nuser,
5486- "(Mail error:target user's mailbox is"
5487- " full)");
5500+ MESG ("(Mail error:target user's "
5501+ "mailbox is full)"));
54885502 }
54895503 else
54905504 {
54915505 puts ("Mail delivery success.");
5492- SendSystemMessagePacket (nuser, "[Ok. deliver mail.]");
5506+ SendSystemMessagePacket (nuser, MESG ("[Ok. deliver mail.]"));
54935507 SendSystemMessagePacket (User[nuser].t_target,
5494- "[You have new mail!]");
5508+ MESG ("[You have new mail]"));
54955509 User[nuser].t_mail = NULL;
54965510 User[nuser].t_target = -1;
54975511 }
@@ -5518,7 +5532,7 @@
55185532 n = BBS_BOX_LIMIT - 1;
55195533 }
55205534 puts ("post article success.");
5521- SendSystemMessagePacket (nuser, "[Ok. post article.]");
5535+ SendSystemMessagePacket (nuser, MESG ("[Ok. post article.]"));
55225536 BBSdata[n] = User[nuser].t_mail;
55235537 User[nuser].t_mail = NULL;
55245538 }
@@ -5526,7 +5540,7 @@
55265540 }
55275541 else
55285542 {
5529- SendSystemMessagePacket (nuser, "(Mail error:can't send)");
5543+ SendSystemMessagePacket (nuser, MESG ("(Mail error:can't send)"));
55305544 }
55315545 return;
55325546 }
@@ -5622,21 +5636,21 @@
56225636 if (User[nuser].score < n + ntax)
56235637 {
56245638 /* no score */
5625- SendSystemMessagePacket (nuser, "[no have enough score]");
5639+ SendSystemMessagePacket (nuser, MESG ("[no have enough score]"));
56265640 return;
56275641 }
56285642 dec_score (nuser, n + ntax);
56295643 add_score (ndist, n);
5630- sprintf (work, "[You transfer %uscore to %-.16s. Tax:%upoint]",
5644+ sprintf (work, MESG ("[You transfer %upoint to %-.16s. Tax:%upoint]"),
56315645 n, CUTTAIL (User[ndist].name), ntax);
56325646 SendSystemMessagePacket (nuser, work);
5633- sprintf (work, "[You receive %uscore from %-.16s]",
5647+ sprintf (work, MESG ("[You receive %upoint from %-.16s]"),
56345648 n, CUTTAIL (User[nuser].name));
56355649 SendSystemMessagePacket (ndist, work);
56365650 }
56375651 else
56385652 {
5639- SendSystemMessagePacket (nuser, "[no such user]");
5653+ SendSystemMessagePacket (nuser, MESG ("[no such user]"));
56405654 }
56415655 return;
56425656 }
@@ -5893,11 +5907,12 @@
58935907 switch (User[i].crime_level)
58945908 {
58955909 case 1:
5896- sprintf (work, "<WANTED '%-.16s'>", CUTTAIL (User[i].name));
5910+ sprintf (work, MESG ("<WANTED '%-.16s'>"),
5911+ CUTTAIL (User[i].name));
58975912 SendSystemMessagePacket (nuser, work);
58985913 break;
58995914 case 2:
5900- sprintf (work, "<Dead or Alive '%-.16s'",
5915+ sprintf (work, MESG ("<Dead or Alive '%-.16s'>"),
59015916 CUTTAIL (User[i].name));
59025917 SendSystemMessagePacket (nuser, work);
59035918 break;
@@ -5908,7 +5923,8 @@
59085923 {
59095924 /* no message */
59105925 SendSystemMessagePacket (nuser,
5911- "Shop HIGE:Do you wanna use my design?");
5926+ MESG
5927+ ("Shop HIGE:Do you wanna use my design?"));
59125928 }
59135929 return;
59145930 }
@@ -5927,7 +5943,7 @@
59275943 {
59285944 if (User[i].hold_count && User[i].move != NoMove)
59295945 {
5930- SendSystemMessagePacket (i, "[You can't move now!]");
5946+ SendSystemMessagePacket (i, MESG ("[You can't move now!]"));
59315947 User[i].move = NoMove;
59325948 }
59335949 User[i].move_bkup = User[i].move;
@@ -5966,7 +5982,8 @@
59665982 User[i].move_bkup = NoMove;
59675983 User[i].move = NoMove;
59685984 SendSystemMessagePacket (i,
5969- "[Can't move its direction!]");
5985+ MESG
5986+ ("[Can't move its direction!]"));
59705987 }
59715988 else
59725989 {
@@ -6038,7 +6055,7 @@
60386055 }
60396056 if (nshop == USERSHOP_LIMIT)
60406057 {
6041- SendSystemMessagePacket (nuser, "[You can't build anymore]");
6058+ SendSystemMessagePacket (nuser, MESG ("[You can't build anymore]"));
60426059 return -1;
60436060 }
60446061 else
@@ -6087,7 +6104,8 @@
60876104 if (nshop == -1 || User[nuser].myshop[nshop].build == 0)
60886105 {
60896106 SendSystemMessagePacket (nuser,
6090- "(FATAL:user shop linkage is broken)");
6107+ MESG
6108+ ("(FATAL:user shop linkage is broken)"));
60916109 return;
60926110 }
60936111 if (p != NULL)
@@ -6122,22 +6140,22 @@
61226140 if (i < SELLINSHOP_LIMIT)
61236141 {
61246142 User[nuser].myshop[nshop].count[1][i]++;
6125- SendSystemMessagePacket (nuser, "[1 animal stocked]");
6143+ SendSystemMessagePacket (nuser, MESG ("[1 animal stocked]"));
61266144 }
61276145 else
61286146 {
6129- SendSystemMessagePacket (nuser, "[NO STOCK SPACE]");
6147+ SendSystemMessagePacket (nuser, MESG ("[NO STOCK SPACE]"));
61306148 put_animal_slot (nuser, p);
61316149 }
61326150 }
61336151 else
61346152 {
6135- SendSystemMessagePacket (nuser, "[You have no animal]");
6153+ SendSystemMessagePacket (nuser, MESG ("[You have no animal]"));
61366154 }
61376155 }
61386156 else
61396157 {
6140- SendSystemMessagePacket (nuser, "[You must go to your shop]");
6158+ SendSystemMessagePacket (nuser, MESG ("[You must go to your shop]"));
61416159 }
61426160 return;
61436161 }
@@ -6158,7 +6176,8 @@
61586176 if (nshop == -1 || User[nuser].myshop[nshop].build == 0)
61596177 {
61606178 SendSystemMessagePacket (nuser,
6161- "(FATAL:user shop linkage is broken)");
6179+ MESG
6180+ ("(FATAL:user shop linkage is broken)"));
61626181 return;
61636182 }
61646183 if (isitem)
@@ -6166,7 +6185,7 @@
61666185 if (nslot < 0 || nslot > ITEM_MAX)
61676186 {
61686187 /* illegal slot */
6169- SendSystemMessagePacket (nuser, "[Illegal slot number]");
6188+ SendSystemMessagePacket (nuser, MESG ("[Illegal slot number]"));
61706189 return;
61716190 }
61726191 n = User[nuser].item[nslot];
@@ -6177,7 +6196,7 @@
61776196 if (nslot < 0 || nslot > WEAPON_MAX)
61786197 {
61796198 /* illegal slot */
6180- SendSystemMessagePacket (nuser, "[Illegal slot number]");
6199+ SendSystemMessagePacket (nuser, MESG ("[Illegal slot number]"));
61816200 return;
61826201 }
61836202 n = User[nuser].weapon[nslot];
@@ -6186,8 +6205,8 @@
61866205 if (n == 0 || nleft == 0)
61876206 {
61886207 /* NG */
6189- sprintf (work, "[%s slot%d is empty]",
6190- isitem ? "Item" : "Weapon", nslot + 1);
6208+ sprintf (work, MESG ("[%s slot%d is empty]"),
6209+ isitem ? MESG ("Item") : MESG ("Weapon"), nslot + 1);
61916210 SendSystemMessagePacket (nuser, work);
61926211 return;
61936212 }
@@ -6228,18 +6247,18 @@
62286247 User[nuser].bullette[nslot] = 0;
62296248 }
62306249 User[nuser].myshop[nshop].count[isitem][i]++;
6231- sprintf (work, "[%-.32s stocked]",
6250+ sprintf (work, MESG ("[%-.32s stocked]"),
62326251 isitem ? Item[n].name : Weapon[n].name);
62336252 SendSystemMessagePacket (nuser, work);
62346253 }
62356254 else
62366255 {
6237- SendSystemMessagePacket (nuser, "[NO STOCK SPACE]");
6256+ SendSystemMessagePacket (nuser, MESG ("[NO STOCK SPACE]"));
62386257 }
62396258 }
62406259 else
62416260 {
6242- SendSystemMessagePacket (nuser, "[You must go to your shop]");
6261+ SendSystemMessagePacket (nuser, MESG ("[You must go to your shop]"));
62436262 }
62446263 return;
62456264 }
@@ -6256,7 +6275,8 @@
62566275 if (nshop == -1 || User[nuser].myshop[nshop].build == 0)
62576276 {
62586277 SendSystemMessagePacket (nuser,
6259- "(FATAL:user shop linkage is broken)");
6278+ MESG
6279+ ("(FATAL:user shop linkage is broken)"));
62606280 return;
62616281 }
62626282 if (n >= 0 && n < SELLINSHOP_LIMIT)
@@ -6267,17 +6287,18 @@
62676287 User[nuser].myshop[nshop].list[isitem][n] = 0;
62686288 User[nuser].myshop[nshop].count[isitem][n] = 0;
62696289 SendSystemMessagePacket (nuser, isitem ?
6270- "[Discard Item]" : "[Discard Weapon]");
6290+ MESG ("[Discard Item]") :
6291+ MESG ("[Discard Weapon]"));
62716292 }
62726293 else
62736294 {
6274- SendSystemMessagePacket (nuser, "[It is EMPTY]");
6295+ SendSystemMessagePacket (nuser, MESG ("[It is EMPTY]"));
62756296 }
62766297 }
62776298 }
62786299 else
62796300 {
6280- SendSystemMessagePacket (nuser, "[You must go to your shop]");
6301+ SendSystemMessagePacket (nuser, MESG ("[You must go to your shop]"));
62816302 }
62826303 return;
62836304 }
@@ -6320,11 +6341,11 @@
63206341 }
63216342 }
63226343 }
6323- SendSystemMessagePacket (nuser, "[You destroy your shop]");
6344+ SendSystemMessagePacket (nuser, MESG ("[You destroy your shop]"));
63246345 }
63256346 else
63266347 {
6327- SendSystemMessagePacket (nuser, "[You must go to your shop]");
6348+ SendSystemMessagePacket (nuser, MESG ("[You must go to your shop]"));
63286349 }
63296350 return;
63306351 }
@@ -6347,11 +6368,11 @@
63476368 {
63486369 User[nuser].myshop[nshop].name[i] = ' ';
63496370 }
6350- SendSystemMessagePacket (nuser, "[Your shop name is changed]");
6371+ SendSystemMessagePacket (nuser, MESG ("[Your shop name is changed]"));
63516372 }
63526373 else
63536374 {
6354- SendSystemMessagePacket (nuser, "[You must go to your shop]");
6375+ SendSystemMessagePacket (nuser, MESG ("[You must go to your shop]"));
63556376 }
63566377 return;
63576378 }
@@ -6375,17 +6396,18 @@
63756396 User[nuser].higemesg[nlen] = '\0';
63766397 if (nlen == 0)
63776398 {
6378- SendSystemMessagePacket (nuser, "[Your message is cleard]");
6399+ SendSystemMessagePacket (nuser, MESG ("[Your message is cleard]"));
63796400 }
63806401 else
63816402 {
63826403 SendSystemMessagePacket (nuser,
6383- "[Your write message on Shop HIGE]");
6404+ MESG
6405+ ("[Your write message on Shop HIGE]"));
63846406 }
63856407 }
63866408 else
63876409 {
6388- SendSystemMessagePacket (nuser, "[You must go to Shop HIGE!]");
6410+ SendSystemMessagePacket (nuser, MESG ("[You must go to Shop HIGE!]"));
63896411 }
63906412 return;
63916413 }
@@ -6414,16 +6436,17 @@
64146436 {
64156437 Animal[nanimal].name[i] = ' ';
64166438 }
6417- SendSystemMessagePacket (nuser, "[animal name is changed]");
6439+ SendSystemMessagePacket (nuser, MESG ("[animal name is changed]"));
64186440 }
64196441 else
64206442 {
6421- SendSystemMessagePacket (nuser, "[This animal is not yours!]");
6443+ SendSystemMessagePacket (nuser,
6444+ MESG ("[This animal is not yours!]"));
64226445 }
64236446 }
64246447 else
64256448 {
6426- SendSystemMessagePacket (nuser, "[no animal on front!]");
6449+ SendSystemMessagePacket (nuser, MESG ("[no animal on front!]"));
64276450 }
64286451 return;
64296452 }
@@ -6486,7 +6509,8 @@
64866509 {
64876510 nlen = PACKET_DATA_MAX - USERNAME_LEN - 10;
64886511 }
6489- sprintf (work, "You tell %-.16s,", CUTTAIL (User[destuser].name));
6512+ sprintf (work, MESG ("You tell %-.16s,"),
6513+ CUTTAIL (User[destuser].name));
64906514 if (nlen)
64916515 {
64926516 memcpy (work + USERNAME_LEN + 10, p + 17, nlen);
@@ -6522,7 +6546,7 @@
65226546 else
65236547 {
65246548 char work[PACKET_DATA_MAX];
6525- sprintf (work, "[Weapon:%-32.32s NOT READY]",
6549+ sprintf (work, MESG ("[Weapon:%-32.32s NOT READY]"),
65266550 Weapon[User[nuser].weapon[nweapon]].name);
65276551 SendSystemMessagePacket (nuser, work);
65286552 }
@@ -6574,8 +6598,8 @@
65746598 {
65756599 /* list up this */
65766600 int relpos = get_rel_position_in (dx1, dx2, dy1, dy2);
6577- sprintf (work, "<%-16.16s %10s %5dBlock>",
6578- Animal[i].name, RelDirection[relpos], n);
6601+ sprintf (work, MESG ("<%-16.16s %10s %5dBlock>"),
6602+ Animal[i].name, MESG (RelDirection[relpos]), n);
65796603 SendSystemMessagePacket (nuser, work);
65806604 }
65816605 }
@@ -6613,14 +6637,16 @@
66136637 int relpos = get_rel_position_in (dx1, dx2, dy1, dy2);
66146638 if (User[i].c_type == Hunter)
66156639 {
6616- sprintf (work, "<Hunter:%-16.16s %10s %5dBlock crime:%lu>",
6617- User[i].name, RelDirection[relpos], n,
6640+ sprintf (work,
6641+ MESG ("<Hunter:%-16.16s %10s %5dBlock crime:%lu>"),
6642+ User[i].name, MESG (RelDirection[relpos]), n,
66186643 User[i].maybearrest);
66196644 }
66206645 else
66216646 {
6622- sprintf (work, "<Guard :%-16.16s %10s %5dBlock>",
6623- User[i].name, RelDirection[relpos], n);
6647+ sprintf (work,
6648+ MESG ("<Guard :%-16.16s %10s %5dBlock>"),
6649+ User[i].name, MESG (RelDirection[relpos]), n);
66246650 }
66256651 SendSystemMessagePacket (nuser, work);
66266652 }
@@ -6652,13 +6678,14 @@
66526678 int relpos = get_rel_position_in (dx1, dx2, dy1, dy2);
66536679 if (Npc[i].c_type == NpcHunter)
66546680 {
6655- sprintf (work, "<Hunter:%-16.16s %10s %5dBlock crime:NA>",
6656- Npc[i].name, RelDirection[relpos], n);
6681+ sprintf (work,
6682+ MESG ("<Hunter:%-16.16s %10s %5dBlock crime:NA>"),
6683+ Npc[i].name, MESG (RelDirection[relpos]), n);
66576684 }
66586685 else
66596686 {
6660- sprintf (work, "<Guard :%-16.16s %10s %5dBlock>",
6661- Npc[i].name, RelDirection[relpos], n);
6687+ sprintf (work, MESG ("<Guard :%-16.16s %10s %5dBlock>"),
6688+ Npc[i].name, MESG (RelDirection[relpos]), n);
66626689 }
66636690 SendSystemMessagePacket (nuser, work);
66646691 }
@@ -6816,55 +6843,55 @@
68166843 {
68176844 case Noeffect:
68186845 /* no effect */
6819- strcpy (work, "No effect");
6846+ strcpy (work, MESG ("No effect"));
68206847 break;
68216848 case Heal:
68226849 /* heal */
68236850 cause_heal (nuser, pitem->effect);
6824- sprintf (work, "You get %uHP", pitem->effect);
6851+ sprintf (work, MESG ("You get %uHP"), pitem->effect);
68256852 break;
68266853 case Tree:
68276854 /* glow Tree */
68286855 glowTree (nuser);
6829- strcpy (work, "[Tree is important resource.]");
6856+ strcpy (work, MESG ("[Tree is important resource.]"));
68306857 break;
68316858 case Charm:
68326859 /* charm near animal */
6833- strcpy (work, "You attempt to charm animal...");
6860+ strcpy (work, MESG ("You attempt to charm animal..."));
68346861 processCharmAnimal (nuser, pitem->effect);
68356862 break;
68366863 case Score:
68376864 /* get score */
68386865 add_score (nuser, pitem->effect);
6839- sprintf (work, "You get %uscore", pitem->effect);
6866+ sprintf (work, MESG ("You get %upoint"), pitem->effect);
68406867 break;
68416868 case Damage:
68426869 /* bad ... */
68436870 cause_damage (nuser, pitem->effect, -1, TargetNone);
6844- sprintf (work, "You lost %uHP", pitem->effect);
6871+ sprintf (work, MESG ("You lost %uHP"), pitem->effect);
68456872 break;
68466873 case AnimalRadar:
68476874 /* animal radar */
6848- SendSystemMessagePacket (nuser, "<scan animal...>");
6875+ SendSystemMessagePacket (nuser, MESG ("<scan animal...>"));
68496876 ListUpNearAnimal (nuser, pitem->effect);
6850- strcpy (work, "<end of scan>");
6877+ strcpy (work, MESG ("<end of scan>"));
68516878 break;
68526879 case HumanRadar:
68536880 /* human radar */
6854- SendSystemMessagePacket (nuser, "<scan...>");
6881+ SendSystemMessagePacket (nuser, MESG ("<scan...>"));
68556882 ListUpNearHuman (nuser, pitem->effect);
6856- strcpy (work, "<end of scan>");
6883+ strcpy (work, MESG ("<end of scan>"));
68576884 break;
68586885 case Invisible:
68596886 if (User[nuser].cloak_count)
68606887 {
68616888 User[nuser].itemcount[nitem]++;
6862- strcpy (work, "[You are already invisible!]");
6889+ strcpy (work, MESG ("[You are already invisible!]"));
68636890 }
68646891 else
68656892 {
68666893 User[nuser].cloak_count = pitem->effect;
6867- strcpy (work, "[You are now invisible]");
6894+ strcpy (work, MESG ("[You are now invisible]"));
68686895 }
68696896 break;
68706897 case BuildShop:
@@ -6872,46 +6899,47 @@
68726899 {
68736900 /* occur error */
68746901 User[nuser].itemcount[nitem]++;
6875- strcpy (work, "[You can't build shop here!]");
6902+ strcpy (work, MESG ("[You can't build shop here!]"));
68766903 }
68776904 else
68786905 {
6879- strcpy (work, "[Build your shop!]");
6906+ strcpy (work, MESG ("[Build your shop!]"));
68806907 }
68816908 break;
68826909 case DigHole:
68836910 if (digHoleHere (nuser))
68846911 {
6885- strcpy (work, "[You try to dig...but you can't dig hole]");
6912+ strcpy (work,
6913+ MESG ("[You try to dig...but you can't dig hole]"));
68866914 }
68876915 else
68886916 {
6889- strcpy (work, "[You dig hole... hehehe]");
6917+ strcpy (work, MESG ("[You dig hole... hehehe]"));
68906918 }
68916919 break;
68926920 case Vehicle:
6893- sprintf (work, "You ride on %-.32s", pitem->name);
6921+ sprintf (work, MESG ("You ride on %-.32s"), pitem->name);
68946922 rideVehicle (nuser, pitem->effect % 100, pitem->effect / 100,
68956923 pitem->pattern);
68966924 break;
68976925 case Food:
68986926 cause_eat (nuser, pitem->effect);
6899- sprintf (work, "You eat %-.32s. ", pitem->name);
6927+ sprintf (work, MESG ("You eat %-.32s..."), pitem->name);
69006928 if (pitem->effect > 100)
69016929 {
6902- strcat (work, "Delicious!");
6930+ strcat (work, MESG ("Delicious!"));
69036931 }
69046932 else if (pitem->effect >= 50)
69056933 {
6906- strcat (work, "uhmm. no feel so bad.");
6934+ strcat (work, MESG ("uhmm. no feel so bad."));
69076935 }
69086936 else if (pitem->effect >= 10)
69096937 {
6910- strcat (work, "better than nothing.");
6938+ strcat (work, MESG ("better than nothing."));
69116939 }
69126940 else
69136941 {
6914- strcat (work, "I think this is dogfood.");
6942+ strcat (work, MESG ("I think this is dogfood."));
69156943 }
69166944 break;
69176945 case HireNpc:
@@ -6918,15 +6946,15 @@
69186946 if (HireNpcForUser (nuser, pitem->effect))
69196947 {
69206948 User[nuser].itemcount[nitem]++;
6921- strcpy (work, "[Can't hire NPC now]");
6949+ strcpy (work, MESG ("[Can't hire NPC now]"));
69226950 }
69236951 else
69246952 {
6925- strcpy (work, "[You hire NPC]");
6953+ strcpy (work, MESG ("[You hire NPC]"));
69266954 }
69276955 break;
69286956 default:
6929- strcpy (work, "?? error item");
6957+ strcpy (work, MESG ("?? error item"));
69306958 break;
69316959 }
69326960 SendSystemMessagePacket (nuser, work);
@@ -6959,7 +6987,7 @@
69596987 }
69606988 User[nuser].item[i] = nitem;
69616989 User[nuser].itemcount[i] = Item[User[nuser].item[i]].count;
6962- sprintf (work, "[Get item%1d:%-.32s]",
6990+ sprintf (work, MESG ("[Get item%1d:%-.32s]"),
69636991 i + 1, Item[User[nuser].item[i]].name);
69646992 SendSystemMessagePacket (nuser, work);
69656993 return i;
@@ -6987,7 +7015,7 @@
69877015 User[nuser].weapon[i] = nweapon;
69887016 User[nuser].bullette[i] = Weapon[User[nuser].weapon[i]].bullette;
69897017 User[nuser].reload[i] = 0;
6990- sprintf (work, "[Get weapon%1d:%-.32s]",
7018+ sprintf (work, MESG ("[Get weapon%1d:%-.32s]"),
69917019 i + 1, Weapon[User[nuser].weapon[i]].name);
69927020 SendSystemMessagePacket (nuser, work);
69937021 return i;
@@ -7010,7 +7038,7 @@
70107038 int isitem;
70117039 unsigned nleft;
70127040 int okpickup = 0;
7013- SendSystemMessagePacket (nuser, "[You open treasure box...]");
7041+ SendSystemMessagePacket (nuser, MESG ("[You open treasure box...]"));
70147042 pitembox = getUserItemBox (x, y);
70157043 if (pitembox == NULL)
70167044 {
@@ -7019,7 +7047,8 @@
70197047 {
70207048 /* trap */
70217049 unsigned ndamage = getrand (100, 500);
7022- SendSystemMessagePacket (nuser, "[Explode! You are damaged!]");
7050+ SendSystemMessagePacket (nuser,
7051+ MESG ("[Explode! You are damaged!]"));
70237052 cause_damage (nuser, ndamage, -1, TargetNone);
70247053 okpickup = 1;
70257054 }
@@ -7082,7 +7111,7 @@
70827111 {
70837112 /* can't get this. drop original position */
70847113 char work[MESG_BUFFER];
7085- sprintf (work, "[You have no space to get %-.32s!]",
7114+ sprintf (work, MESG ("[You have no space to get %-.32s!]"),
70867115 isitem ? Item[nitem].name : Weapon[nitem].name);
70877116 SendSystemMessagePacket (nuser, work);
70887117 addUserItemBox (x, y, isitem, nitem, nleft, NULL);
@@ -7115,7 +7144,7 @@
71157144 }
71167145 add_score (nuser, n);
71177146 add_crime (nuser, n);
7118- sprintf (work, "[You catch %-.16s:%upoint]",
7147+ sprintf (work, MESG ("[You catch %-.16s:%upoint]"),
71197148 CUTTAIL (Animal[nanimal].name), n);
71207149 SendSystemMessagePacket (nuser, work);
71217150 DeleteAnimal (nanimal);
@@ -7124,7 +7153,8 @@
71247153 {
71257154 /* aggressive animal */
71267155 SendSystemMessagePacket (nuser,
7127- "[You can't catch aggressive animal!]");
7156+ MESG
7157+ ("[You can't catch aggressive animal!]"));
71287158 }
71297159 }
71307160 else
@@ -7134,7 +7164,8 @@
71347164 {
71357165 /* it is animal corpse */
71367166 char work[MESG_BUFFER];
7137- sprintf (work, "[You collect %-.16s's corpse:10point]",
7167+ sprintf (work,
7168+ MESG ("[You collect %-.16s's corpse:10point]"),
71387169 CUTTAIL (Animal[nanimal].name));
71397170 SendSystemMessagePacket (nuser, work);
71407171 MAP (x, y)->id &= ~MAP_THERE_ANIMAL;
@@ -7144,7 +7175,8 @@
71447175 else
71457176 {
71467177 SendSystemMessagePacket (nuser,
7147- "[You do not allow to catch animal!]");
7178+ MESG
7179+ ("[You do not allow to catch animal!]"));
71487180 }
71497181 }
71507182 }
@@ -7155,7 +7187,7 @@
71557187 {
71567188 /* arrest! */
71577189 char work[MESG_BUFFER];
7158- sprintf (work, "[You arrest %-.16s. Get 500point.]",
7190+ sprintf (work, MESG ("[You arrest %-.16s. Get 500point.]"),
71597191 CUTTAIL (Npc[npc].name));
71607192 SendSystemMessagePacket (nuser, work);
71617193 add_score (nuser, 500);
@@ -7184,13 +7216,13 @@
71847216 break;
71857217 }
71867218 User[ntarget].crime_level = 0;
7187- sprintf (work, "[You arrest %-.16s. Get %lupoint.]",
7219+ sprintf (work, MESG ("[You arrest %-.16s. Get %lupoint.]"),
71887220 CUTTAIL (User[ntarget].name), npts);
71897221 SendSystemMessagePacket (nuser, work);
7190- sprintf (work, "[You were arrested by %-.16s]",
7222+ sprintf (work, MESG ("[You were arrested by %-.16s]"),
71917223 CUTTAIL (User[nuser].name));
71927224 SendSystemMessagePacket (ntarget, work);
7193- SendSystemMessagePacket (ntarget, "[Go to Jail!]");
7225+ SendSystemMessagePacket (ntarget, MESG ("[Go to Jail!]"));
71947226 ClearUser (ntarget);
71957227 User[ntarget].status = Arrested;
71967228 add_arrest (ntarget);
@@ -7203,24 +7235,25 @@
72037235 }
72047236 else
72057237 {
7206- sprintf (work, "[You attempt to arrest %-.16s]",
7238+ sprintf (work, MESG ("[You attempt to arrest %-.16s]"),
72077239 CUTTAIL (User[ntarget].name));
72087240 SendSystemMessagePacket (nuser, work);
7209- SendSystemMessagePacket (nuser, "[But he do not crime]");
7210- sprintf (work, "[%-.16s attempt to arrest you]",
7241+ SendSystemMessagePacket (nuser, MESG ("[But he do not crime]"));
7242+ sprintf (work, MESG ("[%-.16s attempt to arrest you]"),
72117243 CUTTAIL (User[nuser].name));
72127244 SendSystemMessagePacket (ntarget, work);
7213- SendSystemMessagePacket (ntarget, "[But you are innocence]");
7245+ SendSystemMessagePacket (ntarget,
7246+ MESG ("[But you are innocence]"));
72147247 }
72157248 }
72167249 else
72177250 {
7218- SendSystemMessagePacket (nuser, "[What do you want?]");
7251+ SendSystemMessagePacket (nuser, MESG ("[What do you want?]"));
72197252 }
72207253 }
72217254 else
72227255 {
7223- SendSystemMessagePacket (nuser, "[You catch the air]");
7256+ SendSystemMessagePacket (nuser, MESG ("[You catch the air]"));
72247257 }
72257258 return;
72267259 }
@@ -7238,7 +7271,7 @@
72387271 if (User[nuser].score >= ncost)
72397272 {
72407273 dec_score (nuser, ncost);
7241- sprintf (work, "[You paid %upoint for free]", ncost);
7274+ sprintf (work, MESG ("[You paid %upoint for free]"), ncost);
72427275 User[nuser].status = Healthy;
72437276 User[nuser].maybearrest = 0;
72447277 ActivateUser (nuser);
@@ -7245,13 +7278,13 @@
72457278 }
72467279 else
72477280 {
7248- strcpy (work, "[You have not enought point for free]");
7281+ strcpy (work, MESG ("[You have not enought point for free]"));
72497282 }
72507283 }
72517284 else
72527285 {
72537286 /* ok. you are free now. */
7254- strcpy (work, "[You are free now]");
7287+ strcpy (work, MESG ("[You are free now]"));
72557288 User[nuser].status = Healthy;
72567289 User[nuser].maybearrest = 0;
72577290 ActivateUser (nuser);
@@ -7260,7 +7293,7 @@
72607293 }
72617294 else
72627295 {
7263- SendSystemMessagePacket (nuser, "[No need pay. You are free.]");
7296+ SendSystemMessagePacket (nuser, MESG ("[No need pay. You are free.]"));
72647297 }
72657298 return;
72667299 }
@@ -7360,11 +7393,11 @@
73607393 {
73617394 if (ncost)
73627395 {
7363- sprintf (work, "[You paid %upoint]", ncost);
7396+ sprintf (work, MESG ("[You paid %upoint]"), ncost);
73647397 }
73657398 else
73667399 {
7367- strcpy (work, "[You no need pay for this!]");
7400+ strcpy (work, MESG ("[You no need pay for this!]"));
73687401 }
73697402 }
73707403 else
@@ -7372,15 +7405,16 @@
73727405 if (nospace)
73737406 {
73747407 strcpy (work,
7375- buyitem ? "[no free Item slot]" : "[no free Weapon slot]");
7408+ buyitem ? MESG ("[no free Item slot]") :
7409+ MESG ("[no free Weapon slot]"));
73767410 }
73777411 else if (ncost)
73787412 {
7379- sprintf (work, "[Need %upoint for buy!]", ncost);
7413+ sprintf (work, MESG ("[Need %upoint for buy!]"), ncost);
73807414 }
73817415 else
73827416 {
7383- strcpy (work, "[out of item number range]");
7417+ strcpy (work, MESG ("[out of item number range]"));
73847418 }
73857419 }
73867420 SendSystemMessagePacket (nuser, work);
@@ -7396,7 +7430,8 @@
73967430 int nshop = searchUserShopFromPos (nowner, x, y);
73977431 if (nshop == -1 || User[nowner].myshop[nshop].build == 0)
73987432 {
7399- SendSystemMessagePacket (nuser, "(FATAL:user shop linkage is broken)");
7433+ SendSystemMessagePacket (nuser,
7434+ MESG ("(FATAL:user shop linkage is broken)"));
74007435 }
74017436 else
74027437 {
@@ -7454,11 +7489,11 @@
74547489 User[nowner].myshop[nshop].count[buyitem][n]--;
74557490 if (ncost)
74567491 {
7457- sprintf (work, "[You paid %upoint]", ncost);
7492+ sprintf (work, MESG ("[You paid %upoint]"), ncost);
74587493 }
74597494 else
74607495 {
7461- strcpy (work, "[You no need pay for this!]");
7496+ strcpy (work, MESG ("[You no need pay for this!]"));
74627497 }
74637498 }
74647499 else
@@ -7466,24 +7501,25 @@
74667501 if (nospace)
74677502 {
74687503 strcpy (work, buyitem ?
7469- "[no free Item slot]" :
7470- "[no free Weapon slot]");
7504+ MESG ("[no free Item slot]") :
7505+ MESG ("[no free Weapon slot]"));
74717506 }
74727507 else
74737508 {
7474- sprintf (work, "[Need %upoint for buy!]", ncost);
7509+ sprintf (work, MESG ("[Need %upoint for buy!]"), ncost);
74757510 }
74767511 }
74777512 }
74787513 else
74797514 {
7480- strcpy (work, "[no stock]");
7515+ strcpy (work, MESG ("[no stock]"));
74817516 }
74827517 SendSystemMessagePacket (nuser, work);
74837518 }
74847519 else
74857520 {
7486- SendSystemMessagePacket (nuser, "[out of item number range]");
7521+ SendSystemMessagePacket (nuser,
7522+ MESG ("[out of item number range]"));
74877523 }
74887524 }
74897525 return;
@@ -7508,7 +7544,7 @@
75087544 }
75097545 else
75107546 {
7511- SendSystemMessagePacket (nuser, "[No shop here!]");
7547+ SendSystemMessagePacket (nuser, MESG ("[No shop here!]"));
75127548 }
75137549 return;
75147550 }
@@ -7518,7 +7554,7 @@
75187554 processListMyShop (int nuser)
75197555 {
75207556 int i;
7521- SendSystemMessagePacket (nuser, "<Your shop list>");
7557+ SendSystemMessagePacket (nuser, MESG ("<Your shop list>"));
75227558 for (i = 0; i < USERSHOP_LIMIT; i++)
75237559 {
75247560 if (User[nuser].myshop[i].build)
@@ -7525,13 +7561,13 @@
75257561 {
75267562 char work[MESG_BUFFER];
75277563 sprintf (work,
7528- "<%d:%-16.16s (%3d,%3d)>", i + 1,
7564+ MESG ("<%d:%-16.16s (%3d,%3d)>"), i + 1,
75297565 User[nuser].myshop[i].name,
75307566 User[nuser].myshop[i].pos.x, User[nuser].myshop[i].pos.y);
75317567 SendSystemMessagePacket (nuser, work);
75327568 }
75337569 }
7534- SendSystemMessagePacket (nuser, "<end of list>");
7570+ SendSystemMessagePacket (nuser, MESG ("<end of list>"));
75357571 return;
75367572 }
75377573
@@ -7541,23 +7577,23 @@
75417577 {
75427578 int i;
75437579 char work[MESG_BUFFER];
7544- SendSystemMessagePacket (nuser, "<CAPTURED ANIMAL>");
7580+ SendSystemMessagePacket (nuser, MESG ("<CAPTURED ANIMAL>"));
75457581 for (i = 0; i < User[nuser].animal_slot; i++)
75467582 {
75477583 ANIMALDATA *p = User[nuser].lastPickupAnimal[i];
75487584 if (p != NULL)
75497585 {
7550- sprintf (work, "<%d:%-16.16s(%-.32s)>", i + 1, p->name,
7586+ sprintf (work, MESG ("<%d:%-16.16s(%-.32s)>"), i + 1, p->name,
75517587 Item[p->forsell_item].name);
75527588 SendSystemMessagePacket (nuser, work);
75537589 }
75547590 else
75557591 {
7556- sprintf (work, "<%d:EMPTY>", i + 1);
7592+ sprintf (work, MESG ("<%d:EMPTY>"), i + 1);
75577593 SendSystemMessagePacket (nuser, work);
75587594 }
75597595 }
7560- SendSystemMessagePacket (nuser, "<end of list>");
7596+ SendSystemMessagePacket (nuser, MESG ("<end of list>"));
75617597 return;
75627598 }
75637599
@@ -7576,7 +7612,7 @@
75767612 if (nslot < 0 || nslot > ITEM_MAX)
75777613 {
75787614 /* illegal slot */
7579- SendSystemMessagePacket (nuser, "[Illegal slot number]");
7615+ SendSystemMessagePacket (nuser, MESG ("[Illegal slot number]"));
75807616 return;
75817617 }
75827618 n = User[nuser].item[nslot];
@@ -7587,7 +7623,7 @@
75877623 if (nslot < 0 || nslot > WEAPON_MAX)
75887624 {
75897625 /* illegal slot */
7590- SendSystemMessagePacket (nuser, "[Illegal slot number]");
7626+ SendSystemMessagePacket (nuser, MESG ("[Illegal slot number]"));
75917627 return;
75927628 }
75937629 n = User[nuser].weapon[nslot];
@@ -7608,17 +7644,19 @@
76087644 User[nuser].bullette[nslot] = 0;
76097645 }
76107646 SendSystemMessagePacket (nuser, isitem ?
7611- "[Drop item]" : "[Drop Weapon]");
7647+ MESG ("[Drop item]") :
7648+ MESG ("[Drop Weapon]"));
76127649 }
76137650 else
76147651 {
76157652 SendSystemMessagePacket (nuser, isitem ?
7616- "[Item is empty]" : "[Weapon is empty]");
7653+ MESG ("[Item is empty]") :
7654+ MESG ("[Weapon is empty]"));
76177655 }
76187656 }
76197657 else
76207658 {
7621- SendSystemMessagePacket (nuser, "[You can't drop here!]");
7659+ SendSystemMessagePacket (nuser, MESG ("[You can't drop here!]"));
76227660 }
76237661 return;
76247662 }
@@ -7633,11 +7671,12 @@
76337671 if (animal == NULL)
76347672 {
76357673 SendSystemMessagePacket (nuser,
7636- "<FATAL:can't allocate animal list memory!>");
7674+ MESG
7675+ ("<FATAL:can't allocate animal list memory!>"));
76377676 return;
76387677 }
76397678 memset (animal, 0, AnimalDataLimit * sizeof (int));
7640- SendSystemMessagePacket (nuser, "<ANIMAL LIST>");
7679+ SendSystemMessagePacket (nuser, MESG ("<ANIMAL LIST>"));
76417680 for (i = 0; i < AnimalLimit; i++)
76427681 {
76437682 if (Animal[i].pdata != NULL && Animal[i].hp)
@@ -7649,13 +7688,13 @@
76497688 {
76507689 if (animal[i])
76517690 {
7652- sprintf (work, "<'%-16.16s' lives:%3d rate:%3u value:%5u>",
7691+ sprintf (work, MESG ("<'%-16.16s' lives:%3d rate:%3u value:%5u>"),
76537692 AnimalData[i].name, animal[i],
76547693 AnimalData[i].rate, AnimalData[i].value);
76557694 SendSystemMessagePacket (nuser, work);
76567695 }
76577696 }
7658- SendSystemMessagePacket (nuser, "<end of list>");
7697+ SendSystemMessagePacket (nuser, MESG ("<end of list>"));
76597698 free (animal);
76607699 return;
76617700 }
@@ -7667,7 +7706,7 @@
76677706 {
76687707 int i;
76697708 int f = 0;
7670- SendSystemMessagePacket (nuser, "<MAILBOX>");
7709+ SendSystemMessagePacket (nuser, MESG ("<MAILBOX>"));
76717710 ReorderMailbox (nuser);
76727711 for (i = 0; i < MAIL_BOX_LIMIT; i++)
76737712 {
@@ -7700,7 +7739,8 @@
77007739 f = 1;
77017740 }
77027741 }
7703- SendSystemMessagePacket (nuser, (!f) ? "<no mail!>" : "<end of list>");
7742+ SendSystemMessagePacket (nuser, (!f) ? MESG ("<no mail!>") :
7743+ MESG ("<end of list>"));
77047744 return;
77057745 }
77067746
@@ -7722,13 +7762,14 @@
77227762 else
77237763 {
77247764 User[nuser].mail[n]->readflag = 1;
7725- SendSystemMessagePacket (nuser, "[end of mail-data transfer]");
7765+ SendSystemMessagePacket (nuser,
7766+ MESG ("[end of mail-data transfer]"));
77267767 puts ("done");
77277768 }
77287769 }
77297770 else
77307771 {
7731- SendSystemMessagePacket (nuser, "[no such mail!]");
7772+ SendSystemMessagePacket (nuser, MESG ("[no such mail!]"));
77327773 }
77337774 return;
77347775 }
@@ -7744,11 +7785,11 @@
77447785 FreeMail (User[nuser].mail[n]);
77457786 User[nuser].mail[n] = NULL;
77467787 ReorderMailbox (nuser);
7747- SendSystemMessagePacket (nuser, "[deleted 1 message]");
7788+ SendSystemMessagePacket (nuser, MESG ("[deleted 1 message]"));
77487789 }
77497790 else
77507791 {
7751- SendSystemMessagePacket (nuser, "[no such mail!]");
7792+ SendSystemMessagePacket (nuser, MESG ("[no such mail!]"));
77527793 }
77537794 return;
77547795 }
@@ -7760,7 +7801,7 @@
77607801 {
77617802 int i;
77627803 int f = 0;
7763- SendSystemMessagePacket (nuser, "<BBS article(s)>");
7804+ SendSystemMessagePacket (nuser, MESG ("<BBS article(s)>"));
77647805 for (i = 0; i < BBS_BOX_LIMIT; i++)
77657806 {
77667807 if (BBSdata[i] != NULL)
@@ -7791,7 +7832,8 @@
77917832 f = 1;
77927833 }
77937834 }
7794- SendSystemMessagePacket (nuser, (!f) ? "<no article!>" : "<end of list>");
7835+ SendSystemMessagePacket (nuser, (!f) ? MESG ("<no article!>") :
7836+ MESG ("<end of list>"));
77957837 return;
77967838 }
77977839
@@ -7812,13 +7854,14 @@
78127854 }
78137855 else
78147856 {
7815- SendSystemMessagePacket (nuser, "[end of article-data transfer]");
7857+ SendSystemMessagePacket (nuser,
7858+ MESG ("[end of article-data transfer]"));
78167859 puts ("done");
78177860 }
78187861 }
78197862 else
78207863 {
7821- SendSystemMessagePacket (nuser, "[no such article!]");
7864+ SendSystemMessagePacket (nuser, MESG ("[no such article!]"));
78227865 }
78237866 return;
78247867 }
@@ -8064,11 +8107,11 @@
80648107 {
80658108 if (pb->t_type == TargetUser)
80668109 {
8067- sprintf (work, "You attack animal '%-.16s'",
8110+ sprintf (work, MESG ("You attack animal '%-.16s'"),
80688111 CUTTAIL (Animal[nanimal].name));
80698112 SendSystemMessagePacket (pb->nuser, work);
80708113 }
8071- sprintf (work, "[%-.16s shoot animal!]",
8114+ sprintf (work, MESG ("[%-.16s shoot animal!]"),
80728115 CUTTAIL ((pb->t_type == TargetUser) ?
80738116 User[pb->nuser].name :
80748117 Npc[pb->nuser].name));
@@ -8087,7 +8130,8 @@
80878130 {
80888131 if (pb->nuser != -1 && pb->t_type == TargetUser)
80898132 {
8090- sprintf (work, "animal '%-.16s' died.",
8133+ sprintf (work,
8134+ MESG ("animal '%-.16s' died."),
80918135 CUTTAIL (Animal[nanimal].name));
80928136 SendSystemMessagePacket (pb->nuser, work);
80938137 if (CountLiveAnimal (Animal[nanimal].pdata) == 0)
@@ -8094,7 +8138,8 @@
80948138 {
80958139 /* this is last animal! */
80968140 sprintf (work,
8097- "[animal '%-.16s' is extermination!]",
8141+ MESG
8142+ ("[animal '%-.16s' is extermination!]"),
80988143 CUTTAIL (Animal[nanimal].name));
80998144 SendSystemMessagePacket (pb->nuser, work);
81008145 if (User[pb->nuser].c_type == Observer)
@@ -8101,7 +8146,8 @@
81018146 {
81028147 unsigned pts = Animal[nanimal].pdata->value;
81038148 dec_score (pb->nuser, pts);
8104- sprintf (work, "[You lost %upoint!]", pts);
8149+ sprintf (work, MESG ("[You lost %upoint!]"),
8150+ pts);
81058151 SendSystemMessagePacket (pb->nuser, work);
81068152 }
81078153 }
@@ -8115,8 +8161,9 @@
81158161 {
81168162 add_score (pb->nuser, pts);
81178163 sprintf (work,
8118- "[You kill dangerous animal."
8119- " get %upoint]", pts);
8164+ MESG
8165+ ("[You kill dangerous animal. get %upoint]"),
8166+ pts);
81208167 SendSystemMessagePacket (pb->nuser,
81218168 work);
81228169 }
@@ -8129,7 +8176,7 @@
81298176 {
81308177 if (pb->nuser != -1 && pb->t_type == TargetUser)
81318178 {
8132- sprintf (work, "animal '%-.16s' stun.",
8179+ sprintf (work, MESG ("animal '%-.16s' stun."),
81338180 CUTTAIL (Animal[nanimal].name));
81348181 SendSystemMessagePacket (pb->nuser, work);
81358182 }
@@ -8145,7 +8192,9 @@
81458192 /* success! */
81468193 if (Animal[nanimal].owner_user == -1)
81478194 {
8148- sprintf (work, "You charm animal '%-.16s'!",
8195+ sprintf (work,
8196+ MESG
8197+ ("You charm animal '%-.16s'!"),
81498198 CUTTAIL (Animal[nanimal].name));
81508199 SendSystemMessagePacket (pb->nuser, work);
81518200 Animal[nanimal].owner_user = pb->nuser;
@@ -8153,7 +8202,8 @@
81538202 else
81548203 {
81558204 sprintf (work,
8156- "Animal '%-.16s' is free now!",
8205+ MESG
8206+ ("Animal '%-.16s' is free now!"),
81578207 CUTTAIL (Animal[nanimal].name));
81588208 SendMessageNearUserPosition (pb->pos, work);
81598209 Animal[nanimal].owner_user = -1;
@@ -8163,7 +8213,8 @@
81638213 {
81648214 /* fail */
81658215 sprintf (work,
8166- "You fail to charm animal '%-.16s'.",
8216+ MESG
8217+ ("You fail to charm animal '%-.16s'."),
81678218 CUTTAIL (Animal[nanimal].name));
81688219 SendSystemMessagePacket (pb->nuser, work);
81698220 }
@@ -8213,7 +8264,7 @@
82138264 char work[MESG_BUFFER];
82148265 if (pb->nuser != -1 && pb->t_type == TargetUser)
82158266 {
8216- sprintf (work, "You attack '%-.16s'",
8267+ sprintf (work, MESG ("You attack '%-.16s'"),
82178268 CUTTAIL (Npc[npc].name));
82188269 SendSystemMessagePacket (pb->nuser, work);
82198270 }
@@ -8222,7 +8273,7 @@
82228273 {
82238274 if (pb->nuser != -1 && pb->t_type == TargetUser)
82248275 {
8225- sprintf (work, "'%-.16s' died.",
8276+ sprintf (work, MESG ("'%-.16s' died."),
82268277 CUTTAIL (Npc[npc].name));
82278278 SendSystemMessagePacket (pb->nuser, work);
82288279 if (User[pb->nuser].c_type == Hunter &&
@@ -8231,7 +8282,8 @@
82318282 /* it is crime! */
82328283 add_crime (pb->nuser, CrimeNpcMurder);
82338284 SendSystemMessagePacket (pb->nuser,
8234- "[You are murder!]");
8285+ MESG
8286+ ("[You are murder!]"));
82358287 }
82368288 }
82378289 else
@@ -8238,13 +8290,14 @@
82388290 {
82398291 if (pb->nuser != -1 && pb->t_type == TargetNpc)
82408292 {
8241- sprintf (work, "'%-.16s' killed by ",
8242- CUTTAIL (Npc[npc].name));
8243- strcat (work, CUTTAIL (Npc[pb->nuser].name));
8293+ sprintf (work,
8294+ MESG ("'%-.16s' killed by %-.16s!"),
8295+ CUTTAIL (Npc[npc].name),
8296+ CUTTAIL (Npc[pb->nuser].name));
82448297 }
82458298 else
82468299 {
8247- sprintf (work, "'%-.16s' killed by any!",
8300+ sprintf (work, MESG ("'%-.16s' killed by any!"),
82488301 CUTTAIL (Npc[npc].name));
82498302 }
82508303 SendMessageNearUserPosition (Npc[npc].pos, work);
@@ -8452,7 +8505,7 @@
84528505 int nuser = User[i].lastuser;
84538506 if (User[i].lastuser_type == TargetUser)
84548507 {
8455- sprintf (work, "[You kill %-.16s]",
8508+ sprintf (work, MESG ("[You kill %-.16s]"),
84568509 CUTTAIL (User[i].name));
84578510 SendSystemMessagePacket (nuser, work);
84588511 }
@@ -8474,7 +8527,7 @@
84748527 if (pname != NULL)
84758528 {
84768529 sprintf (work,
8477- "[You were killed by %-.16s]",
8530+ MESG ("[You were killed by %-.16s]"),
84788531 CUTTAIL (pname));
84798532 SendSystemMessagePacket (i, work);
84808533 }
@@ -8488,7 +8541,8 @@
84888541 if (npoint)
84898542 {
84908543 add_score (nuser, npoint);
8491- sprintf (work, "[You get %upoint]", npoint);
8544+ sprintf (work, MESG ("[You get %upoint]"),
8545+ npoint);
84928546 SendSystemMessagePacket (nuser, work);
84938547 }
84948548 }
@@ -8497,7 +8551,8 @@
84978551 {
84988552 add_crime (nuser, CrimeMurder);
84998553 SendSystemMessagePacket (nuser,
8500- "[You are murder!]");
8554+ MESG
8555+ ("[You are murder!]"));
85018556 }
85028557 else if (User[i].crime_level == 2)
85038558 {
@@ -8506,7 +8561,7 @@
85068561 if (npoint)
85078562 {
85088563 add_score (nuser, npoint);
8509- sprintf (work, "[You get bonus %upoint]",
8564+ sprintf (work, MESG ("[You get bonus %upoint]"),
85108565 npoint);
85118566 SendSystemMessagePacket (nuser, work);
85128567 }
@@ -8516,7 +8571,7 @@
85168571 else
85178572 {
85188573 /* you die by your own */
8519- SendSystemMessagePacket (i, "[You died]");
8574+ SendSystemMessagePacket (i, MESG ("[You died]"));
85208575 }
85218576 if (!(MAP (User[i].pos.x, User[i].pos.y)->id &
85228577 (MAP_THERE_WALL | MAP_THERE_ITEM)))
@@ -8580,10 +8635,12 @@
85808635 switch (User[i].hungry)
85818636 {
85828637 case 50:
8583- SendSystemMessagePacket (i, "[You feel hungry]");
8638+ SendSystemMessagePacket (i, MESG ("[You feel hungry]"));
85848639 break;
85858640 case 10:
8586- SendSystemMessagePacket (i, "[You feel weak by hungry]");
8641+ SendSystemMessagePacket (i,
8642+ MESG
8643+ ("[You feel weak by hungry]"));
85878644 break;
85888645 case 4:
85898646 case 3:
@@ -8590,7 +8647,9 @@
85908647 case 2:
85918648 case 1:
85928649 case 0:
8593- SendSystemMessagePacket (i, "[You can't move by hungry!]");
8650+ SendSystemMessagePacket (i,
8651+ MESG
8652+ ("[You can't move by hungry!]"));
85948653 User[i].hold_count += 10 * (5 - User[i].hungry);
85958654 break;
85968655 default:
@@ -8604,7 +8663,7 @@
86048663 {
86058664 char work[MESG_BUFFER];
86068665 cause_damage (i, DamageWhenHungry, -1, TargetNone);
8607- sprintf (work, "[You lost %uHP by hugry]",
8666+ sprintf (work, MESG ("[You lost %uHP by hugry]"),
86088667 DamageWhenHungry);
86098668 SendSystemMessagePacket (i, work);
86108669 }
@@ -8615,9 +8674,9 @@
86158674 char work[MESG_BUFFER];
86168675 MAP (User[i].pos.x, User[i].pos.y)->id &= ~MAP_THERE_HOLE;
86178676 User[i].hold_count = HoldCount;
8618- SendSystemMessagePacket (i, "[You fall in hole!]");
8677+ SendSystemMessagePacket (i, MESG ("[You fall in hole!]"));
86198678 SendEffectFallInHolePacket (i);
8620- sprintf (work, "[You hear sound %-.16s fall in hole]",
8679+ sprintf (work, MESG ("[You hear sound %-.16s fall in hole]"),
86218680 CUTTAIL (User[i].name));
86228681 SendMessageNearUser (i, work);
86238682 }
@@ -8827,8 +8886,9 @@
88278886 {
88288887 /* eat meat */
88298888 char work[MESG_BUFFER];
8830- sprintf (work, "animal '%-.16s' eat ", CUTTAIL (Animal[nanimal].name));
8831- strcat (work, CUTTAIL (Animal[targetanimal].name));
8889+ sprintf (work, MESG ("animal '%-.16s' eat %-.16s"),
8890+ CUTTAIL (Animal[nanimal].name),
8891+ CUTTAIL (Animal[targetanimal].name));
88328892 SendMessageNearUserPosition (Animal[nanimal].pos, work);
88338893 MAP (Animal[targetanimal].pos.x, Animal[targetanimal].pos.y)->id &=
88348894 ~MAP_THERE_ANIMAL;
@@ -8908,7 +8968,7 @@
89088968 if (Npc[npc].hp == 0)
89098969 {
89108970 char work[MESG_BUFFER];
8911- sprintf (work, "'%-.16s' died.", CUTTAIL (Npc[npc].name));
8971+ sprintf (work, MESG ("'%-.16s' died."), CUTTAIL (Npc[npc].name));
89128972 SendMessageNearUserPosition (Npc[npc].pos, work);
89138973 Npc[npc].name[0] = '\0';
89148974 MAP (Npc[npc].pos.x, Npc[npc].pos.y)->id &= ~MAP_THERE_NPC;
@@ -9433,7 +9493,8 @@
94339493 MAP (x, y)->id &= ~MAP_THERE_HOLE;
94349494 Animal[i].hold_count = HoldCount;
94359495 sprintf (work,
9436- "[You hear sound '%-.16s' fall in hole]",
9496+ MESG
9497+ ("[You hear sound '%-.16s' fall in hole]"),
94379498 CUTTAIL (Animal[i].name));
94389499 SendMessageNearUserAnimal (i, work);
94399500 }
@@ -9926,7 +9987,7 @@
99269987 char work[MESG_BUFFER];
99279988 MAP (x, y)->id &= ~MAP_THERE_HOLE;
99289989 Npc[n].hold_count = HoldCount;
9929- sprintf (work, "[You hear sound %-.16s fall in hole!]",
9990+ sprintf (work, MESG ("[You hear sound %-.16s fall in hole!]"),
99309991 Npc[n].name);
99319992 SendMessageNearUserPosition (Npc[n].pos, work);
99329993 }
@@ -10038,7 +10099,8 @@
1003810099 {
1003910100 /* get */
1004010101 char work[MESG_BUFFER];
10041- sprintf (work, "%-.16s say,Get!", CUTTAIL (Npc[n].name));
10102+ sprintf (work, MESG ("%-.16s say,Get!"),
10103+ CUTTAIL (Npc[n].name));
1004210104 SendMessageNearUserPosition (Npc[n].pos, work);
1004310105 MAP (Animal[ntarget].pos.x, Animal[ntarget].pos.y)->id &=
1004410106 ~MAP_THERE_ANIMAL;
@@ -10238,7 +10300,7 @@
1023810300 /* arrest */
1023910301 char work[MESG_BUFFER];
1024010302 NPCsay (n, g_mesg, 3);
10241- sprintf (work, "[You were arrested by %-.16s!]",
10303+ sprintf (work, MESG ("[You were arrested by %-.16s!]"),
1024210304 CUTTAIL (Npc[n].name));
1024310305 SendSystemMessagePacket (ntarget, work);
1024410306 ClearUser (ntarget);
@@ -11351,6 +11413,8 @@
1135111413 {
1135211414 char work[BUFFER_SIZE];
1135311415
11416+ InitializeStringTable ();
11417+ LoadStringTable (MESG_DATA_FILE);
1135411418 srand ((unsigned) time (NULL));
1135511419 puts ("Loading datas...");
1135611420 sprintf (work, "%s/%s", DATA_DIR, INIT_DATA_FILE);
@@ -11402,6 +11466,14 @@
1140211466 #endif
1140311467 #endif
1140411468 int nport = DEFAULT_PORT;
11469+#ifdef USE_LOCALE
11470+ setlocale (LC_ALL, "");
11471+ if (strcmp (nl_langinfo (CODESET), "UTF-8"))
11472+ {
11473+ puts ("current locale != UTF-8");
11474+ return -1;
11475+ }
11476+#endif
1140511477 if (argc > 1)
1140611478 {
1140711479 if (strcmp (argv[1], "-"))
--- trunk/strtable.c (nonexistent)
+++ trunk/strtable.c (revision 3)
@@ -0,0 +1,131 @@
1+#include "port.h"
2+#include <stdio.h>
3+#include <stdlib.h>
4+#include <string.h>
5+#include "strtable.h"
6+
7+static STRTABLE *Table[256];
8+
9+static unsigned char bitcount_table[8] = {
10+ 0, 1, 1, 2, 1, 2, 2, 3
11+};
12+
13+/* hash function */
14+unsigned char
15+calc_hash8 (const char *p)
16+{
17+ unsigned char value = 0;
18+ for (; *p != '\0'; p++)
19+ {
20+ unsigned char c = (unsigned char) *p;
21+ value += bitcount_table[c & 7];
22+ value += bitcount_table[c >> 4];
23+ }
24+ return value;
25+}
26+
27+/* Initialize string table */
28+void
29+InitializeStringTable ()
30+{
31+ int i;
32+ for (i = 0; i < 256; i++)
33+ {
34+ Table[i] = NULL;
35+ }
36+}
37+
38+/* add string */
39+void
40+AddStringTable (const char *pkeyword, const char *pmesg)
41+{
42+ unsigned char hash = calc_hash8 (pkeyword);
43+ if (Table[hash] == NULL)
44+ {
45+ /* new data */
46+ Table[hash] = malloc (sizeof (STRTABLE));
47+ Table[hash]->pkeyword = strdup (pkeyword);
48+ Table[hash]->pmesg = strdup (pmesg);
49+ Table[hash]->pnext = NULL;
50+ }
51+ else
52+ {
53+ /* add to tail */
54+ STRTABLE *pwk = Table[hash];
55+ STRTABLE *plast = NULL;
56+ while (pwk != NULL)
57+ {
58+ if (strcmp (pkeyword, pwk->pkeyword) == 0)
59+ {
60+ /* update current record */
61+ int nlen = strlen (pmesg) + 1;
62+ free (pwk->pmesg);
63+ pwk->pmesg = malloc (nlen);
64+ memcpy (pwk->pmesg, pmesg, nlen);
65+ return;
66+ }
67+ plast = pwk;
68+ pwk = pwk->pnext;
69+ }
70+ if (plast != NULL)
71+ {
72+ plast->pnext = malloc (sizeof (STRTABLE));
73+ plast->pnext->pkeyword = strdup (pkeyword);
74+ plast->pnext->pmesg = strdup (pmesg);
75+ plast->pnext->pnext = NULL;
76+ }
77+ }
78+}
79+
80+/* lookup string table */
81+const char *
82+LookupStringTable (const char *pkeyword)
83+{
84+ unsigned char hash = calc_hash8 (pkeyword);
85+ STRTABLE *pwk = Table[hash];
86+ while (pwk != NULL)
87+ {
88+ if (strcmp (pwk->pkeyword, pkeyword) == 0)
89+ {
90+ return pwk->pmesg;
91+ }
92+ pwk = pwk->pnext;
93+ }
94+ return pkeyword;
95+}
96+
97+/* load string table from file */
98+void
99+LoadStringTable (const char *pfilename)
100+{
101+ FILE *iptr = fopen (pfilename, "r");
102+ if (iptr != NULL)
103+ {
104+ char buffer[2048];
105+ char keyword[1024];
106+ while (fgets (buffer, sizeof (buffer), iptr) != NULL)
107+ {
108+ char *ptoken;
109+ char *pwk;
110+ if (buffer[0] == '#' || buffer[0] == '\r' || buffer[0] == '\n')
111+ {
112+ /* blank line or comment line */
113+ continue;
114+ }
115+ pwk = strtok_r (buffer, "\t", &ptoken);
116+ if (pwk != NULL)
117+ {
118+ strncpy (keyword, pwk, sizeof (keyword) - 1);
119+ keyword[sizeof (keyword) - 1] = '\0';
120+ pwk = strtok_r (NULL, "\t\r\n", &ptoken);
121+ if (pwk != NULL)
122+ {
123+ AddStringTable (keyword, pwk);
124+ }
125+ }
126+ }
127+ fclose (iptr);
128+ }
129+}
130+
131+/* EOF */
--- trunk/strtable.h (nonexistent)
+++ trunk/strtable.h (revision 3)
@@ -0,0 +1,19 @@
1+
2+struct string_table
3+{
4+ char *pkeyword;
5+ char *pmesg;
6+ struct string_table *pnext;
7+};
8+
9+typedef struct string_table STRTABLE;
10+
11+extern unsigned char calc_hash8 (const char *p);
12+extern void InitializeStringTable ();
13+extern void AddStringTable (const char *pkeyword, const char *pmesg);
14+extern const char *LookupStringTable (const char *pkeyword);
15+extern void LoadStringTable (const char *pfilename);
16+
17+#define MESG(s) LookupStringTable(s)
18+
19+/* EOF */
--- trunk/port.h (revision 2)
+++ trunk/port.h (revision 3)
@@ -7,6 +7,7 @@
77 #define HAVE_SIGACTION
88 #define HAVE_SIGALRM
99 #define USE_FORK
10+#define USE_LOCALE
1011 #endif
1112
1213 #include <unistd.h>
@@ -60,7 +61,6 @@
6061 /* win32 no have 'socklen_t' */
6162 #define socklen_t int
6263
63-
6464 #else
6565 #error NEED enviroment-type!
6666 #endif
--- trunk/Makefile (revision 2)
+++ trunk/Makefile (revision 3)
@@ -4,7 +4,7 @@
44 #CFLAGS=-Wall -g $(DEFINES)
55 CFLAGS=-Wall -O $(DEFINES)
66
7-SRCS=huntserv.c ctlsock.c pktio.c hunt.h pltio.h ctlsock.h port.h
7+SRCS=huntserv.c ctlsock.c pktio.c strtable.c hunt.h pltio.h ctlsock.h strtable.h port.h
88
99 all: huntserv
1010
@@ -15,8 +15,8 @@
1515 -rm *~ core *.o
1616 -rm h-user h-bbs h-map h-mail.* huntserv
1717
18-huntserv : huntserv.o ctlsock.o pktio.o
19- $(CC) $(CFLAGS) -o huntserv huntserv.o ctlsock.o pktio.o
18+huntserv : huntserv.o ctlsock.o pktio.o strtable.o
19+ $(CC) $(CFLAGS) -o huntserv huntserv.o ctlsock.o pktio.o strtable.o
2020
2121
2222 ctlsock.o : ctlsock.c ctlsock.h port.h
@@ -23,6 +23,8 @@
2323
2424 pktio.o : pktio.c hunt.h pktio.h ctlsock.h port.h
2525
26+strtable.o : strtable.c strtable.h port.h
27+
2628 huntserv.o : huntserv.c hunt.h pktio.h ctlsock.h port.h
2729
2830