密猟オンラインサーバープログラム
システムのロケールをutf-8に変更
設定ファイルのエンコードも同じくutf-8に変更
クライアントへの送出メッセージを定義ファイルで設定可能にした
それにともない、送出メッセージの日本語化
| @@ -1,4 +1,8 @@ | ||
| 1 | 1 | #include "port.h" |
| 2 | +#ifdef USE_LOCALE | |
| 3 | +#include <locale.h> | |
| 4 | +#include <langinfo.h> | |
| 5 | +#endif | |
| 2 | 6 | #include <stdio.h> |
| 3 | 7 | #include <stdlib.h> |
| 4 | 8 | #include <string.h> |
| @@ -11,6 +15,7 @@ | ||
| 11 | 15 | #include "ctlsock.h" |
| 12 | 16 | #include "hunt.h" |
| 13 | 17 | #include "pktio.h" |
| 18 | +#include "strtable.h" | |
| 14 | 19 | |
| 15 | 20 | /* Game feature */ |
| 16 | 21 | #define USE_SAVEMAP |
| @@ -38,6 +43,7 @@ | ||
| 38 | 43 | #ifdef USE_BBS |
| 39 | 44 | #define BBS_DATA_FILE "h-bbs" |
| 40 | 45 | #endif |
| 46 | +#define MESG_DATA_FILE "h-mesg" | |
| 41 | 47 | #ifndef HEARNEAR_DISTANCE |
| 42 | 48 | #define HEARNEAR_DISTANCE 10 |
| 43 | 49 | #endif |
| @@ -710,7 +716,7 @@ | ||
| 710 | 716 | |
| 711 | 717 | /************************************************/ |
| 712 | 718 | #ifdef MAKEWIN32 |
| 713 | -/* convert Shift-jis to EUC-JP */ | |
| 719 | +/* convert Shift-jis to UTF-8 */ | |
| 714 | 720 | static const char * |
| 715 | 721 | convertC2H (char *p, int nlen) |
| 716 | 722 | { |
| @@ -733,7 +739,7 @@ | ||
| 733 | 739 | return pret; |
| 734 | 740 | } |
| 735 | 741 | |
| 736 | -/* convert EUC-JP to Shift-jis */ | |
| 742 | +/* convert UTF-8 to Shift-jis */ | |
| 737 | 743 | static const char * |
| 738 | 744 | convertH2C (char *p, int nlen) |
| 739 | 745 | { |
| @@ -4278,7 +4284,7 @@ | ||
| 4278 | 4284 | int i; |
| 4279 | 4285 | unsigned char packet[PACKET_MAX]; |
| 4280 | 4286 | ret = 0; |
| 4281 | - SendSystemMessagePacket (userno, "==== registered people ===="); | |
| 4287 | + SendSystemMessagePacket (userno, MESG ("==== registered people ====")); | |
| 4282 | 4288 | for (i = 0; i < UserLimit && !ret; i++) |
| 4283 | 4289 | { |
| 4284 | 4290 | if (User[i].name[0] != '\0') |
| @@ -4295,7 +4301,7 @@ | ||
| 4295 | 4301 | ret = SENDPACKET (userno, packet, n - 2); |
| 4296 | 4302 | } |
| 4297 | 4303 | } |
| 4298 | - SendSystemMessagePacket (userno, "==== end of list ===="); | |
| 4304 | + SendSystemMessagePacket (userno, MESG ("==== end of list ====")); | |
| 4299 | 4305 | } |
| 4300 | 4306 | return ret; |
| 4301 | 4307 | } |
| @@ -4484,7 +4490,8 @@ | ||
| 4484 | 4490 | if (nshop == -1 || User[nowner].myshop[nshop].build == 0) |
| 4485 | 4491 | { |
| 4486 | 4492 | /* error ?? */ |
| 4487 | - SendSystemMessagePacket (nuser, "(FATAL:user shop linkage is broken)"); | |
| 4493 | + SendSystemMessagePacket (nuser, | |
| 4494 | + MESG ("(FATAL:user shop linkage is broken)")); | |
| 4488 | 4495 | return; |
| 4489 | 4496 | } |
| 4490 | 4497 | for (i = 0; i < SELLINSHOP_LIMIT; i++) |
| @@ -4492,8 +4499,8 @@ | ||
| 4492 | 4499 | if (User[nowner].myshop[nshop].count[n][i]) |
| 4493 | 4500 | { |
| 4494 | 4501 | 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)>"), | |
| 4497 | 4504 | i, |
| 4498 | 4505 | (n ? Item[User[nowner].myshop[nshop].list[n][i]].name : |
| 4499 | 4506 | Weapon[User[nowner].myshop[nshop].list[n][i]].name), |
| @@ -4511,7 +4518,7 @@ | ||
| 4511 | 4518 | SendWeaponList (int nuser) |
| 4512 | 4519 | { |
| 4513 | 4520 | int nowner = MAP (User[nuser].pos.x, User[nuser].pos.y)->owner; |
| 4514 | - SendSystemMessagePacket (nuser, "<WEAPON LIST>"); | |
| 4521 | + SendSystemMessagePacket (nuser, MESG ("<WEAPON LIST>")); | |
| 4515 | 4522 | if (nowner) |
| 4516 | 4523 | { |
| 4517 | 4524 | SendUserShopList (nowner - 1, nuser, 0); |
| @@ -4535,13 +4542,15 @@ | ||
| 4535 | 4542 | for (i = 0; i < nmax; i++) |
| 4536 | 4543 | { |
| 4537 | 4544 | 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>"), | |
| 4539 | 4548 | i, pw->name, pw->cost, pw->bullette, |
| 4540 | 4549 | pw->firepower, pw->moral, pw->range); |
| 4541 | 4550 | SendSystemMessagePacket (nuser, work); |
| 4542 | 4551 | } |
| 4543 | 4552 | } |
| 4544 | - SendSystemMessagePacket (nuser, "<end of list>"); | |
| 4553 | + SendSystemMessagePacket (nuser, MESG ("<end of list>")); | |
| 4545 | 4554 | return; |
| 4546 | 4555 | } |
| 4547 | 4556 |
| @@ -4550,7 +4559,7 @@ | ||
| 4550 | 4559 | SendItemList (int nuser) |
| 4551 | 4560 | { |
| 4552 | 4561 | int nowner = MAP (User[nuser].pos.x, User[nuser].pos.y)->owner; |
| 4553 | - SendSystemMessagePacket (nuser, "<ITEM LIST>"); | |
| 4562 | + SendSystemMessagePacket (nuser, MESG ("<ITEM LIST>")); | |
| 4554 | 4563 | if (nowner) |
| 4555 | 4564 | { |
| 4556 | 4565 | SendUserShopList (nowner - 1, nuser, 1); |
| @@ -4574,12 +4583,13 @@ | ||
| 4574 | 4583 | for (i = 0; i < nmax; i++) |
| 4575 | 4584 | { |
| 4576 | 4585 | ITEMINFO *pi = Item + plist[i]; |
| 4577 | - sprintf (work, "<%3d:%-32.32s:%10luP %4ucount>", | |
| 4586 | + sprintf (work, | |
| 4587 | + MESG ("<%3d:%-32.32s:%10luP %4ucount>"), | |
| 4578 | 4588 | i, pi->name, pi->cost, pi->count); |
| 4579 | 4589 | SendSystemMessagePacket (nuser, work); |
| 4580 | 4590 | } |
| 4581 | 4591 | } |
| 4582 | - SendSystemMessagePacket (nuser, "<end of list>"); | |
| 4592 | + SendSystemMessagePacket (nuser, MESG ("<end of list>")); | |
| 4583 | 4593 | return; |
| 4584 | 4594 | } |
| 4585 | 4595 |
| @@ -4675,7 +4685,7 @@ | ||
| 4675 | 4685 | NPCsay (int npc, const char *mesg[], int nmax) |
| 4676 | 4686 | { |
| 4677 | 4687 | 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)); | |
| 4679 | 4689 | SendMessageNearUserPosition (Npc[npc].pos, work); |
| 4680 | 4690 | return; |
| 4681 | 4691 | } |
| @@ -4697,15 +4707,15 @@ | ||
| 4697 | 4707 | switch (t) |
| 4698 | 4708 | { |
| 4699 | 4709 | case TargetUser: |
| 4700 | - sprintf (work, "%-.16s damages you. lost %uHP.", | |
| 4710 | + sprintf (work, MESG ("%-.16s damages you. lost %uHP."), | |
| 4701 | 4711 | CUTTAIL (User[fromuser].name), ndamage); |
| 4702 | 4712 | break; |
| 4703 | 4713 | case TargetNpc: |
| 4704 | - sprintf (work, "%-.16s damages you. lost %uHP.", | |
| 4714 | + sprintf (work, MESG ("%-.16s damages you. lost %uHP."), | |
| 4705 | 4715 | CUTTAIL (Npc[fromuser].name), ndamage); |
| 4706 | 4716 | break; |
| 4707 | 4717 | case TargetAnimal: |
| 4708 | - sprintf (work, "Animal '%-.16s' damages you. lost %uHP", | |
| 4718 | + sprintf (work, MESG ("Animal '%-.16s' damages you. lost %uHP"), | |
| 4709 | 4719 | CUTTAIL (Animal[fromuser].name), ndamage); |
| 4710 | 4720 | break; |
| 4711 | 4721 | default: |
| @@ -4718,7 +4728,8 @@ | ||
| 4718 | 4728 | } |
| 4719 | 4729 | if (t == TargetUser) |
| 4720 | 4730 | { |
| 4721 | - sprintf (work, "You attack %-.16s", CUTTAIL (User[nuser].name)); | |
| 4731 | + sprintf (work, MESG ("You attack %-.16s"), | |
| 4732 | + CUTTAIL (User[nuser].name)); | |
| 4722 | 4733 | SendSystemMessagePacket (fromuser, work); |
| 4723 | 4734 | } |
| 4724 | 4735 | } |
| @@ -4884,8 +4895,9 @@ | ||
| 4884 | 4895 | } |
| 4885 | 4896 | else |
| 4886 | 4897 | { |
| 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!]")); | |
| 4889 | 4901 | User[nuser].hp = 0; |
| 4890 | 4902 | User[nuser].lastuser = -1; |
| 4891 | 4903 | } |
| @@ -4991,7 +5003,8 @@ | ||
| 4991 | 5003 | if (User[nuser].status == Arrested) |
| 4992 | 5004 | { |
| 4993 | 5005 | SendSystemMessagePacket (nuser, |
| 4994 | - "[Welcome to Jail!]"); | |
| 5006 | + MESG | |
| 5007 | + ("[Welcome to Jail!]")); | |
| 4995 | 5008 | } |
| 4996 | 5009 | #ifdef USE_MAIL |
| 4997 | 5010 | if (CheckNewMail (nuser)) |
| @@ -4998,7 +5011,8 @@ | ||
| 4998 | 5011 | { |
| 4999 | 5012 | /* new mail! */ |
| 5000 | 5013 | SendSystemMessagePacket (nuser, |
| 5001 | - "[You have new mail]"); | |
| 5014 | + MESG | |
| 5015 | + ("[You have new mail]")); | |
| 5002 | 5016 | } |
| 5003 | 5017 | #endif |
| 5004 | 5018 | ret = 0; |
| @@ -5453,7 +5467,7 @@ | ||
| 5453 | 5467 | } |
| 5454 | 5468 | else |
| 5455 | 5469 | { |
| 5456 | - SendSystemMessagePacket (nuser, "(Mail error:no such user!)"); | |
| 5470 | + SendSystemMessagePacket (nuser, MESG ("(Mail error:no such user!)")); | |
| 5457 | 5471 | } |
| 5458 | 5472 | return; |
| 5459 | 5473 | } |
| @@ -5483,15 +5497,15 @@ | ||
| 5483 | 5497 | /* ?? occur error. perhaps mailbox is full. */ |
| 5484 | 5498 | puts ("Mail delivery fail"); |
| 5485 | 5499 | SendSystemMessagePacket (nuser, |
| 5486 | - "(Mail error:target user's mailbox is" | |
| 5487 | - " full)"); | |
| 5500 | + MESG ("(Mail error:target user's " | |
| 5501 | + "mailbox is full)")); | |
| 5488 | 5502 | } |
| 5489 | 5503 | else |
| 5490 | 5504 | { |
| 5491 | 5505 | puts ("Mail delivery success."); |
| 5492 | - SendSystemMessagePacket (nuser, "[Ok. deliver mail.]"); | |
| 5506 | + SendSystemMessagePacket (nuser, MESG ("[Ok. deliver mail.]")); | |
| 5493 | 5507 | SendSystemMessagePacket (User[nuser].t_target, |
| 5494 | - "[You have new mail!]"); | |
| 5508 | + MESG ("[You have new mail]")); | |
| 5495 | 5509 | User[nuser].t_mail = NULL; |
| 5496 | 5510 | User[nuser].t_target = -1; |
| 5497 | 5511 | } |
| @@ -5518,7 +5532,7 @@ | ||
| 5518 | 5532 | n = BBS_BOX_LIMIT - 1; |
| 5519 | 5533 | } |
| 5520 | 5534 | puts ("post article success."); |
| 5521 | - SendSystemMessagePacket (nuser, "[Ok. post article.]"); | |
| 5535 | + SendSystemMessagePacket (nuser, MESG ("[Ok. post article.]")); | |
| 5522 | 5536 | BBSdata[n] = User[nuser].t_mail; |
| 5523 | 5537 | User[nuser].t_mail = NULL; |
| 5524 | 5538 | } |
| @@ -5526,7 +5540,7 @@ | ||
| 5526 | 5540 | } |
| 5527 | 5541 | else |
| 5528 | 5542 | { |
| 5529 | - SendSystemMessagePacket (nuser, "(Mail error:can't send)"); | |
| 5543 | + SendSystemMessagePacket (nuser, MESG ("(Mail error:can't send)")); | |
| 5530 | 5544 | } |
| 5531 | 5545 | return; |
| 5532 | 5546 | } |
| @@ -5622,21 +5636,21 @@ | ||
| 5622 | 5636 | if (User[nuser].score < n + ntax) |
| 5623 | 5637 | { |
| 5624 | 5638 | /* no score */ |
| 5625 | - SendSystemMessagePacket (nuser, "[no have enough score]"); | |
| 5639 | + SendSystemMessagePacket (nuser, MESG ("[no have enough score]")); | |
| 5626 | 5640 | return; |
| 5627 | 5641 | } |
| 5628 | 5642 | dec_score (nuser, n + ntax); |
| 5629 | 5643 | 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]"), | |
| 5631 | 5645 | n, CUTTAIL (User[ndist].name), ntax); |
| 5632 | 5646 | SendSystemMessagePacket (nuser, work); |
| 5633 | - sprintf (work, "[You receive %uscore from %-.16s]", | |
| 5647 | + sprintf (work, MESG ("[You receive %upoint from %-.16s]"), | |
| 5634 | 5648 | n, CUTTAIL (User[nuser].name)); |
| 5635 | 5649 | SendSystemMessagePacket (ndist, work); |
| 5636 | 5650 | } |
| 5637 | 5651 | else |
| 5638 | 5652 | { |
| 5639 | - SendSystemMessagePacket (nuser, "[no such user]"); | |
| 5653 | + SendSystemMessagePacket (nuser, MESG ("[no such user]")); | |
| 5640 | 5654 | } |
| 5641 | 5655 | return; |
| 5642 | 5656 | } |
| @@ -5893,11 +5907,12 @@ | ||
| 5893 | 5907 | switch (User[i].crime_level) |
| 5894 | 5908 | { |
| 5895 | 5909 | case 1: |
| 5896 | - sprintf (work, "<WANTED '%-.16s'>", CUTTAIL (User[i].name)); | |
| 5910 | + sprintf (work, MESG ("<WANTED '%-.16s'>"), | |
| 5911 | + CUTTAIL (User[i].name)); | |
| 5897 | 5912 | SendSystemMessagePacket (nuser, work); |
| 5898 | 5913 | break; |
| 5899 | 5914 | case 2: |
| 5900 | - sprintf (work, "<Dead or Alive '%-.16s'", | |
| 5915 | + sprintf (work, MESG ("<Dead or Alive '%-.16s'>"), | |
| 5901 | 5916 | CUTTAIL (User[i].name)); |
| 5902 | 5917 | SendSystemMessagePacket (nuser, work); |
| 5903 | 5918 | break; |
| @@ -5908,7 +5923,8 @@ | ||
| 5908 | 5923 | { |
| 5909 | 5924 | /* no message */ |
| 5910 | 5925 | SendSystemMessagePacket (nuser, |
| 5911 | - "Shop HIGE:Do you wanna use my design?"); | |
| 5926 | + MESG | |
| 5927 | + ("Shop HIGE:Do you wanna use my design?")); | |
| 5912 | 5928 | } |
| 5913 | 5929 | return; |
| 5914 | 5930 | } |
| @@ -5927,7 +5943,7 @@ | ||
| 5927 | 5943 | { |
| 5928 | 5944 | if (User[i].hold_count && User[i].move != NoMove) |
| 5929 | 5945 | { |
| 5930 | - SendSystemMessagePacket (i, "[You can't move now!]"); | |
| 5946 | + SendSystemMessagePacket (i, MESG ("[You can't move now!]")); | |
| 5931 | 5947 | User[i].move = NoMove; |
| 5932 | 5948 | } |
| 5933 | 5949 | User[i].move_bkup = User[i].move; |
| @@ -5966,7 +5982,8 @@ | ||
| 5966 | 5982 | User[i].move_bkup = NoMove; |
| 5967 | 5983 | User[i].move = NoMove; |
| 5968 | 5984 | SendSystemMessagePacket (i, |
| 5969 | - "[Can't move its direction!]"); | |
| 5985 | + MESG | |
| 5986 | + ("[Can't move its direction!]")); | |
| 5970 | 5987 | } |
| 5971 | 5988 | else |
| 5972 | 5989 | { |
| @@ -6038,7 +6055,7 @@ | ||
| 6038 | 6055 | } |
| 6039 | 6056 | if (nshop == USERSHOP_LIMIT) |
| 6040 | 6057 | { |
| 6041 | - SendSystemMessagePacket (nuser, "[You can't build anymore]"); | |
| 6058 | + SendSystemMessagePacket (nuser, MESG ("[You can't build anymore]")); | |
| 6042 | 6059 | return -1; |
| 6043 | 6060 | } |
| 6044 | 6061 | else |
| @@ -6087,7 +6104,8 @@ | ||
| 6087 | 6104 | if (nshop == -1 || User[nuser].myshop[nshop].build == 0) |
| 6088 | 6105 | { |
| 6089 | 6106 | SendSystemMessagePacket (nuser, |
| 6090 | - "(FATAL:user shop linkage is broken)"); | |
| 6107 | + MESG | |
| 6108 | + ("(FATAL:user shop linkage is broken)")); | |
| 6091 | 6109 | return; |
| 6092 | 6110 | } |
| 6093 | 6111 | if (p != NULL) |
| @@ -6122,22 +6140,22 @@ | ||
| 6122 | 6140 | if (i < SELLINSHOP_LIMIT) |
| 6123 | 6141 | { |
| 6124 | 6142 | User[nuser].myshop[nshop].count[1][i]++; |
| 6125 | - SendSystemMessagePacket (nuser, "[1 animal stocked]"); | |
| 6143 | + SendSystemMessagePacket (nuser, MESG ("[1 animal stocked]")); | |
| 6126 | 6144 | } |
| 6127 | 6145 | else |
| 6128 | 6146 | { |
| 6129 | - SendSystemMessagePacket (nuser, "[NO STOCK SPACE]"); | |
| 6147 | + SendSystemMessagePacket (nuser, MESG ("[NO STOCK SPACE]")); | |
| 6130 | 6148 | put_animal_slot (nuser, p); |
| 6131 | 6149 | } |
| 6132 | 6150 | } |
| 6133 | 6151 | else |
| 6134 | 6152 | { |
| 6135 | - SendSystemMessagePacket (nuser, "[You have no animal]"); | |
| 6153 | + SendSystemMessagePacket (nuser, MESG ("[You have no animal]")); | |
| 6136 | 6154 | } |
| 6137 | 6155 | } |
| 6138 | 6156 | else |
| 6139 | 6157 | { |
| 6140 | - SendSystemMessagePacket (nuser, "[You must go to your shop]"); | |
| 6158 | + SendSystemMessagePacket (nuser, MESG ("[You must go to your shop]")); | |
| 6141 | 6159 | } |
| 6142 | 6160 | return; |
| 6143 | 6161 | } |
| @@ -6158,7 +6176,8 @@ | ||
| 6158 | 6176 | if (nshop == -1 || User[nuser].myshop[nshop].build == 0) |
| 6159 | 6177 | { |
| 6160 | 6178 | SendSystemMessagePacket (nuser, |
| 6161 | - "(FATAL:user shop linkage is broken)"); | |
| 6179 | + MESG | |
| 6180 | + ("(FATAL:user shop linkage is broken)")); | |
| 6162 | 6181 | return; |
| 6163 | 6182 | } |
| 6164 | 6183 | if (isitem) |
| @@ -6166,7 +6185,7 @@ | ||
| 6166 | 6185 | if (nslot < 0 || nslot > ITEM_MAX) |
| 6167 | 6186 | { |
| 6168 | 6187 | /* illegal slot */ |
| 6169 | - SendSystemMessagePacket (nuser, "[Illegal slot number]"); | |
| 6188 | + SendSystemMessagePacket (nuser, MESG ("[Illegal slot number]")); | |
| 6170 | 6189 | return; |
| 6171 | 6190 | } |
| 6172 | 6191 | n = User[nuser].item[nslot]; |
| @@ -6177,7 +6196,7 @@ | ||
| 6177 | 6196 | if (nslot < 0 || nslot > WEAPON_MAX) |
| 6178 | 6197 | { |
| 6179 | 6198 | /* illegal slot */ |
| 6180 | - SendSystemMessagePacket (nuser, "[Illegal slot number]"); | |
| 6199 | + SendSystemMessagePacket (nuser, MESG ("[Illegal slot number]")); | |
| 6181 | 6200 | return; |
| 6182 | 6201 | } |
| 6183 | 6202 | n = User[nuser].weapon[nslot]; |
| @@ -6186,8 +6205,8 @@ | ||
| 6186 | 6205 | if (n == 0 || nleft == 0) |
| 6187 | 6206 | { |
| 6188 | 6207 | /* 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); | |
| 6191 | 6210 | SendSystemMessagePacket (nuser, work); |
| 6192 | 6211 | return; |
| 6193 | 6212 | } |
| @@ -6228,18 +6247,18 @@ | ||
| 6228 | 6247 | User[nuser].bullette[nslot] = 0; |
| 6229 | 6248 | } |
| 6230 | 6249 | User[nuser].myshop[nshop].count[isitem][i]++; |
| 6231 | - sprintf (work, "[%-.32s stocked]", | |
| 6250 | + sprintf (work, MESG ("[%-.32s stocked]"), | |
| 6232 | 6251 | isitem ? Item[n].name : Weapon[n].name); |
| 6233 | 6252 | SendSystemMessagePacket (nuser, work); |
| 6234 | 6253 | } |
| 6235 | 6254 | else |
| 6236 | 6255 | { |
| 6237 | - SendSystemMessagePacket (nuser, "[NO STOCK SPACE]"); | |
| 6256 | + SendSystemMessagePacket (nuser, MESG ("[NO STOCK SPACE]")); | |
| 6238 | 6257 | } |
| 6239 | 6258 | } |
| 6240 | 6259 | else |
| 6241 | 6260 | { |
| 6242 | - SendSystemMessagePacket (nuser, "[You must go to your shop]"); | |
| 6261 | + SendSystemMessagePacket (nuser, MESG ("[You must go to your shop]")); | |
| 6243 | 6262 | } |
| 6244 | 6263 | return; |
| 6245 | 6264 | } |
| @@ -6256,7 +6275,8 @@ | ||
| 6256 | 6275 | if (nshop == -1 || User[nuser].myshop[nshop].build == 0) |
| 6257 | 6276 | { |
| 6258 | 6277 | SendSystemMessagePacket (nuser, |
| 6259 | - "(FATAL:user shop linkage is broken)"); | |
| 6278 | + MESG | |
| 6279 | + ("(FATAL:user shop linkage is broken)")); | |
| 6260 | 6280 | return; |
| 6261 | 6281 | } |
| 6262 | 6282 | if (n >= 0 && n < SELLINSHOP_LIMIT) |
| @@ -6267,17 +6287,18 @@ | ||
| 6267 | 6287 | User[nuser].myshop[nshop].list[isitem][n] = 0; |
| 6268 | 6288 | User[nuser].myshop[nshop].count[isitem][n] = 0; |
| 6269 | 6289 | SendSystemMessagePacket (nuser, isitem ? |
| 6270 | - "[Discard Item]" : "[Discard Weapon]"); | |
| 6290 | + MESG ("[Discard Item]") : | |
| 6291 | + MESG ("[Discard Weapon]")); | |
| 6271 | 6292 | } |
| 6272 | 6293 | else |
| 6273 | 6294 | { |
| 6274 | - SendSystemMessagePacket (nuser, "[It is EMPTY]"); | |
| 6295 | + SendSystemMessagePacket (nuser, MESG ("[It is EMPTY]")); | |
| 6275 | 6296 | } |
| 6276 | 6297 | } |
| 6277 | 6298 | } |
| 6278 | 6299 | else |
| 6279 | 6300 | { |
| 6280 | - SendSystemMessagePacket (nuser, "[You must go to your shop]"); | |
| 6301 | + SendSystemMessagePacket (nuser, MESG ("[You must go to your shop]")); | |
| 6281 | 6302 | } |
| 6282 | 6303 | return; |
| 6283 | 6304 | } |
| @@ -6320,11 +6341,11 @@ | ||
| 6320 | 6341 | } |
| 6321 | 6342 | } |
| 6322 | 6343 | } |
| 6323 | - SendSystemMessagePacket (nuser, "[You destroy your shop]"); | |
| 6344 | + SendSystemMessagePacket (nuser, MESG ("[You destroy your shop]")); | |
| 6324 | 6345 | } |
| 6325 | 6346 | else |
| 6326 | 6347 | { |
| 6327 | - SendSystemMessagePacket (nuser, "[You must go to your shop]"); | |
| 6348 | + SendSystemMessagePacket (nuser, MESG ("[You must go to your shop]")); | |
| 6328 | 6349 | } |
| 6329 | 6350 | return; |
| 6330 | 6351 | } |
| @@ -6347,11 +6368,11 @@ | ||
| 6347 | 6368 | { |
| 6348 | 6369 | User[nuser].myshop[nshop].name[i] = ' '; |
| 6349 | 6370 | } |
| 6350 | - SendSystemMessagePacket (nuser, "[Your shop name is changed]"); | |
| 6371 | + SendSystemMessagePacket (nuser, MESG ("[Your shop name is changed]")); | |
| 6351 | 6372 | } |
| 6352 | 6373 | else |
| 6353 | 6374 | { |
| 6354 | - SendSystemMessagePacket (nuser, "[You must go to your shop]"); | |
| 6375 | + SendSystemMessagePacket (nuser, MESG ("[You must go to your shop]")); | |
| 6355 | 6376 | } |
| 6356 | 6377 | return; |
| 6357 | 6378 | } |
| @@ -6375,17 +6396,18 @@ | ||
| 6375 | 6396 | User[nuser].higemesg[nlen] = '\0'; |
| 6376 | 6397 | if (nlen == 0) |
| 6377 | 6398 | { |
| 6378 | - SendSystemMessagePacket (nuser, "[Your message is cleard]"); | |
| 6399 | + SendSystemMessagePacket (nuser, MESG ("[Your message is cleard]")); | |
| 6379 | 6400 | } |
| 6380 | 6401 | else |
| 6381 | 6402 | { |
| 6382 | 6403 | SendSystemMessagePacket (nuser, |
| 6383 | - "[Your write message on Shop HIGE]"); | |
| 6404 | + MESG | |
| 6405 | + ("[Your write message on Shop HIGE]")); | |
| 6384 | 6406 | } |
| 6385 | 6407 | } |
| 6386 | 6408 | else |
| 6387 | 6409 | { |
| 6388 | - SendSystemMessagePacket (nuser, "[You must go to Shop HIGE!]"); | |
| 6410 | + SendSystemMessagePacket (nuser, MESG ("[You must go to Shop HIGE!]")); | |
| 6389 | 6411 | } |
| 6390 | 6412 | return; |
| 6391 | 6413 | } |
| @@ -6414,16 +6436,17 @@ | ||
| 6414 | 6436 | { |
| 6415 | 6437 | Animal[nanimal].name[i] = ' '; |
| 6416 | 6438 | } |
| 6417 | - SendSystemMessagePacket (nuser, "[animal name is changed]"); | |
| 6439 | + SendSystemMessagePacket (nuser, MESG ("[animal name is changed]")); | |
| 6418 | 6440 | } |
| 6419 | 6441 | else |
| 6420 | 6442 | { |
| 6421 | - SendSystemMessagePacket (nuser, "[This animal is not yours!]"); | |
| 6443 | + SendSystemMessagePacket (nuser, | |
| 6444 | + MESG ("[This animal is not yours!]")); | |
| 6422 | 6445 | } |
| 6423 | 6446 | } |
| 6424 | 6447 | else |
| 6425 | 6448 | { |
| 6426 | - SendSystemMessagePacket (nuser, "[no animal on front!]"); | |
| 6449 | + SendSystemMessagePacket (nuser, MESG ("[no animal on front!]")); | |
| 6427 | 6450 | } |
| 6428 | 6451 | return; |
| 6429 | 6452 | } |
| @@ -6486,7 +6509,8 @@ | ||
| 6486 | 6509 | { |
| 6487 | 6510 | nlen = PACKET_DATA_MAX - USERNAME_LEN - 10; |
| 6488 | 6511 | } |
| 6489 | - sprintf (work, "You tell %-.16s,", CUTTAIL (User[destuser].name)); | |
| 6512 | + sprintf (work, MESG ("You tell %-.16s,"), | |
| 6513 | + CUTTAIL (User[destuser].name)); | |
| 6490 | 6514 | if (nlen) |
| 6491 | 6515 | { |
| 6492 | 6516 | memcpy (work + USERNAME_LEN + 10, p + 17, nlen); |
| @@ -6522,7 +6546,7 @@ | ||
| 6522 | 6546 | else |
| 6523 | 6547 | { |
| 6524 | 6548 | char work[PACKET_DATA_MAX]; |
| 6525 | - sprintf (work, "[Weapon:%-32.32s NOT READY]", | |
| 6549 | + sprintf (work, MESG ("[Weapon:%-32.32s NOT READY]"), | |
| 6526 | 6550 | Weapon[User[nuser].weapon[nweapon]].name); |
| 6527 | 6551 | SendSystemMessagePacket (nuser, work); |
| 6528 | 6552 | } |
| @@ -6574,8 +6598,8 @@ | ||
| 6574 | 6598 | { |
| 6575 | 6599 | /* list up this */ |
| 6576 | 6600 | 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); | |
| 6579 | 6603 | SendSystemMessagePacket (nuser, work); |
| 6580 | 6604 | } |
| 6581 | 6605 | } |
| @@ -6613,14 +6637,16 @@ | ||
| 6613 | 6637 | int relpos = get_rel_position_in (dx1, dx2, dy1, dy2); |
| 6614 | 6638 | if (User[i].c_type == Hunter) |
| 6615 | 6639 | { |
| 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, | |
| 6618 | 6643 | User[i].maybearrest); |
| 6619 | 6644 | } |
| 6620 | 6645 | else |
| 6621 | 6646 | { |
| 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); | |
| 6624 | 6650 | } |
| 6625 | 6651 | SendSystemMessagePacket (nuser, work); |
| 6626 | 6652 | } |
| @@ -6652,13 +6678,14 @@ | ||
| 6652 | 6678 | int relpos = get_rel_position_in (dx1, dx2, dy1, dy2); |
| 6653 | 6679 | if (Npc[i].c_type == NpcHunter) |
| 6654 | 6680 | { |
| 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); | |
| 6657 | 6684 | } |
| 6658 | 6685 | else |
| 6659 | 6686 | { |
| 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); | |
| 6662 | 6689 | } |
| 6663 | 6690 | SendSystemMessagePacket (nuser, work); |
| 6664 | 6691 | } |
| @@ -6816,55 +6843,55 @@ | ||
| 6816 | 6843 | { |
| 6817 | 6844 | case Noeffect: |
| 6818 | 6845 | /* no effect */ |
| 6819 | - strcpy (work, "No effect"); | |
| 6846 | + strcpy (work, MESG ("No effect")); | |
| 6820 | 6847 | break; |
| 6821 | 6848 | case Heal: |
| 6822 | 6849 | /* heal */ |
| 6823 | 6850 | cause_heal (nuser, pitem->effect); |
| 6824 | - sprintf (work, "You get %uHP", pitem->effect); | |
| 6851 | + sprintf (work, MESG ("You get %uHP"), pitem->effect); | |
| 6825 | 6852 | break; |
| 6826 | 6853 | case Tree: |
| 6827 | 6854 | /* glow Tree */ |
| 6828 | 6855 | glowTree (nuser); |
| 6829 | - strcpy (work, "[Tree is important resource.]"); | |
| 6856 | + strcpy (work, MESG ("[Tree is important resource.]")); | |
| 6830 | 6857 | break; |
| 6831 | 6858 | case Charm: |
| 6832 | 6859 | /* charm near animal */ |
| 6833 | - strcpy (work, "You attempt to charm animal..."); | |
| 6860 | + strcpy (work, MESG ("You attempt to charm animal...")); | |
| 6834 | 6861 | processCharmAnimal (nuser, pitem->effect); |
| 6835 | 6862 | break; |
| 6836 | 6863 | case Score: |
| 6837 | 6864 | /* get score */ |
| 6838 | 6865 | add_score (nuser, pitem->effect); |
| 6839 | - sprintf (work, "You get %uscore", pitem->effect); | |
| 6866 | + sprintf (work, MESG ("You get %upoint"), pitem->effect); | |
| 6840 | 6867 | break; |
| 6841 | 6868 | case Damage: |
| 6842 | 6869 | /* bad ... */ |
| 6843 | 6870 | cause_damage (nuser, pitem->effect, -1, TargetNone); |
| 6844 | - sprintf (work, "You lost %uHP", pitem->effect); | |
| 6871 | + sprintf (work, MESG ("You lost %uHP"), pitem->effect); | |
| 6845 | 6872 | break; |
| 6846 | 6873 | case AnimalRadar: |
| 6847 | 6874 | /* animal radar */ |
| 6848 | - SendSystemMessagePacket (nuser, "<scan animal...>"); | |
| 6875 | + SendSystemMessagePacket (nuser, MESG ("<scan animal...>")); | |
| 6849 | 6876 | ListUpNearAnimal (nuser, pitem->effect); |
| 6850 | - strcpy (work, "<end of scan>"); | |
| 6877 | + strcpy (work, MESG ("<end of scan>")); | |
| 6851 | 6878 | break; |
| 6852 | 6879 | case HumanRadar: |
| 6853 | 6880 | /* human radar */ |
| 6854 | - SendSystemMessagePacket (nuser, "<scan...>"); | |
| 6881 | + SendSystemMessagePacket (nuser, MESG ("<scan...>")); | |
| 6855 | 6882 | ListUpNearHuman (nuser, pitem->effect); |
| 6856 | - strcpy (work, "<end of scan>"); | |
| 6883 | + strcpy (work, MESG ("<end of scan>")); | |
| 6857 | 6884 | break; |
| 6858 | 6885 | case Invisible: |
| 6859 | 6886 | if (User[nuser].cloak_count) |
| 6860 | 6887 | { |
| 6861 | 6888 | User[nuser].itemcount[nitem]++; |
| 6862 | - strcpy (work, "[You are already invisible!]"); | |
| 6889 | + strcpy (work, MESG ("[You are already invisible!]")); | |
| 6863 | 6890 | } |
| 6864 | 6891 | else |
| 6865 | 6892 | { |
| 6866 | 6893 | User[nuser].cloak_count = pitem->effect; |
| 6867 | - strcpy (work, "[You are now invisible]"); | |
| 6894 | + strcpy (work, MESG ("[You are now invisible]")); | |
| 6868 | 6895 | } |
| 6869 | 6896 | break; |
| 6870 | 6897 | case BuildShop: |
| @@ -6872,46 +6899,47 @@ | ||
| 6872 | 6899 | { |
| 6873 | 6900 | /* occur error */ |
| 6874 | 6901 | User[nuser].itemcount[nitem]++; |
| 6875 | - strcpy (work, "[You can't build shop here!]"); | |
| 6902 | + strcpy (work, MESG ("[You can't build shop here!]")); | |
| 6876 | 6903 | } |
| 6877 | 6904 | else |
| 6878 | 6905 | { |
| 6879 | - strcpy (work, "[Build your shop!]"); | |
| 6906 | + strcpy (work, MESG ("[Build your shop!]")); | |
| 6880 | 6907 | } |
| 6881 | 6908 | break; |
| 6882 | 6909 | case DigHole: |
| 6883 | 6910 | if (digHoleHere (nuser)) |
| 6884 | 6911 | { |
| 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]")); | |
| 6886 | 6914 | } |
| 6887 | 6915 | else |
| 6888 | 6916 | { |
| 6889 | - strcpy (work, "[You dig hole... hehehe]"); | |
| 6917 | + strcpy (work, MESG ("[You dig hole... hehehe]")); | |
| 6890 | 6918 | } |
| 6891 | 6919 | break; |
| 6892 | 6920 | case Vehicle: |
| 6893 | - sprintf (work, "You ride on %-.32s", pitem->name); | |
| 6921 | + sprintf (work, MESG ("You ride on %-.32s"), pitem->name); | |
| 6894 | 6922 | rideVehicle (nuser, pitem->effect % 100, pitem->effect / 100, |
| 6895 | 6923 | pitem->pattern); |
| 6896 | 6924 | break; |
| 6897 | 6925 | case Food: |
| 6898 | 6926 | cause_eat (nuser, pitem->effect); |
| 6899 | - sprintf (work, "You eat %-.32s. ", pitem->name); | |
| 6927 | + sprintf (work, MESG ("You eat %-.32s..."), pitem->name); | |
| 6900 | 6928 | if (pitem->effect > 100) |
| 6901 | 6929 | { |
| 6902 | - strcat (work, "Delicious!"); | |
| 6930 | + strcat (work, MESG ("Delicious!")); | |
| 6903 | 6931 | } |
| 6904 | 6932 | else if (pitem->effect >= 50) |
| 6905 | 6933 | { |
| 6906 | - strcat (work, "uhmm. no feel so bad."); | |
| 6934 | + strcat (work, MESG ("uhmm. no feel so bad.")); | |
| 6907 | 6935 | } |
| 6908 | 6936 | else if (pitem->effect >= 10) |
| 6909 | 6937 | { |
| 6910 | - strcat (work, "better than nothing."); | |
| 6938 | + strcat (work, MESG ("better than nothing.")); | |
| 6911 | 6939 | } |
| 6912 | 6940 | else |
| 6913 | 6941 | { |
| 6914 | - strcat (work, "I think this is dogfood."); | |
| 6942 | + strcat (work, MESG ("I think this is dogfood.")); | |
| 6915 | 6943 | } |
| 6916 | 6944 | break; |
| 6917 | 6945 | case HireNpc: |
| @@ -6918,15 +6946,15 @@ | ||
| 6918 | 6946 | if (HireNpcForUser (nuser, pitem->effect)) |
| 6919 | 6947 | { |
| 6920 | 6948 | User[nuser].itemcount[nitem]++; |
| 6921 | - strcpy (work, "[Can't hire NPC now]"); | |
| 6949 | + strcpy (work, MESG ("[Can't hire NPC now]")); | |
| 6922 | 6950 | } |
| 6923 | 6951 | else |
| 6924 | 6952 | { |
| 6925 | - strcpy (work, "[You hire NPC]"); | |
| 6953 | + strcpy (work, MESG ("[You hire NPC]")); | |
| 6926 | 6954 | } |
| 6927 | 6955 | break; |
| 6928 | 6956 | default: |
| 6929 | - strcpy (work, "?? error item"); | |
| 6957 | + strcpy (work, MESG ("?? error item")); | |
| 6930 | 6958 | break; |
| 6931 | 6959 | } |
| 6932 | 6960 | SendSystemMessagePacket (nuser, work); |
| @@ -6959,7 +6987,7 @@ | ||
| 6959 | 6987 | } |
| 6960 | 6988 | User[nuser].item[i] = nitem; |
| 6961 | 6989 | 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]"), | |
| 6963 | 6991 | i + 1, Item[User[nuser].item[i]].name); |
| 6964 | 6992 | SendSystemMessagePacket (nuser, work); |
| 6965 | 6993 | return i; |
| @@ -6987,7 +7015,7 @@ | ||
| 6987 | 7015 | User[nuser].weapon[i] = nweapon; |
| 6988 | 7016 | User[nuser].bullette[i] = Weapon[User[nuser].weapon[i]].bullette; |
| 6989 | 7017 | User[nuser].reload[i] = 0; |
| 6990 | - sprintf (work, "[Get weapon%1d:%-.32s]", | |
| 7018 | + sprintf (work, MESG ("[Get weapon%1d:%-.32s]"), | |
| 6991 | 7019 | i + 1, Weapon[User[nuser].weapon[i]].name); |
| 6992 | 7020 | SendSystemMessagePacket (nuser, work); |
| 6993 | 7021 | return i; |
| @@ -7010,7 +7038,7 @@ | ||
| 7010 | 7038 | int isitem; |
| 7011 | 7039 | unsigned nleft; |
| 7012 | 7040 | int okpickup = 0; |
| 7013 | - SendSystemMessagePacket (nuser, "[You open treasure box...]"); | |
| 7041 | + SendSystemMessagePacket (nuser, MESG ("[You open treasure box...]")); | |
| 7014 | 7042 | pitembox = getUserItemBox (x, y); |
| 7015 | 7043 | if (pitembox == NULL) |
| 7016 | 7044 | { |
| @@ -7019,7 +7047,8 @@ | ||
| 7019 | 7047 | { |
| 7020 | 7048 | /* trap */ |
| 7021 | 7049 | unsigned ndamage = getrand (100, 500); |
| 7022 | - SendSystemMessagePacket (nuser, "[Explode! You are damaged!]"); | |
| 7050 | + SendSystemMessagePacket (nuser, | |
| 7051 | + MESG ("[Explode! You are damaged!]")); | |
| 7023 | 7052 | cause_damage (nuser, ndamage, -1, TargetNone); |
| 7024 | 7053 | okpickup = 1; |
| 7025 | 7054 | } |
| @@ -7082,7 +7111,7 @@ | ||
| 7082 | 7111 | { |
| 7083 | 7112 | /* can't get this. drop original position */ |
| 7084 | 7113 | 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!]"), | |
| 7086 | 7115 | isitem ? Item[nitem].name : Weapon[nitem].name); |
| 7087 | 7116 | SendSystemMessagePacket (nuser, work); |
| 7088 | 7117 | addUserItemBox (x, y, isitem, nitem, nleft, NULL); |
| @@ -7115,7 +7144,7 @@ | ||
| 7115 | 7144 | } |
| 7116 | 7145 | add_score (nuser, n); |
| 7117 | 7146 | add_crime (nuser, n); |
| 7118 | - sprintf (work, "[You catch %-.16s:%upoint]", | |
| 7147 | + sprintf (work, MESG ("[You catch %-.16s:%upoint]"), | |
| 7119 | 7148 | CUTTAIL (Animal[nanimal].name), n); |
| 7120 | 7149 | SendSystemMessagePacket (nuser, work); |
| 7121 | 7150 | DeleteAnimal (nanimal); |
| @@ -7124,7 +7153,8 @@ | ||
| 7124 | 7153 | { |
| 7125 | 7154 | /* aggressive animal */ |
| 7126 | 7155 | SendSystemMessagePacket (nuser, |
| 7127 | - "[You can't catch aggressive animal!]"); | |
| 7156 | + MESG | |
| 7157 | + ("[You can't catch aggressive animal!]")); | |
| 7128 | 7158 | } |
| 7129 | 7159 | } |
| 7130 | 7160 | else |
| @@ -7134,7 +7164,8 @@ | ||
| 7134 | 7164 | { |
| 7135 | 7165 | /* it is animal corpse */ |
| 7136 | 7166 | char work[MESG_BUFFER]; |
| 7137 | - sprintf (work, "[You collect %-.16s's corpse:10point]", | |
| 7167 | + sprintf (work, | |
| 7168 | + MESG ("[You collect %-.16s's corpse:10point]"), | |
| 7138 | 7169 | CUTTAIL (Animal[nanimal].name)); |
| 7139 | 7170 | SendSystemMessagePacket (nuser, work); |
| 7140 | 7171 | MAP (x, y)->id &= ~MAP_THERE_ANIMAL; |
| @@ -7144,7 +7175,8 @@ | ||
| 7144 | 7175 | else |
| 7145 | 7176 | { |
| 7146 | 7177 | SendSystemMessagePacket (nuser, |
| 7147 | - "[You do not allow to catch animal!]"); | |
| 7178 | + MESG | |
| 7179 | + ("[You do not allow to catch animal!]")); | |
| 7148 | 7180 | } |
| 7149 | 7181 | } |
| 7150 | 7182 | } |
| @@ -7155,7 +7187,7 @@ | ||
| 7155 | 7187 | { |
| 7156 | 7188 | /* arrest! */ |
| 7157 | 7189 | char work[MESG_BUFFER]; |
| 7158 | - sprintf (work, "[You arrest %-.16s. Get 500point.]", | |
| 7190 | + sprintf (work, MESG ("[You arrest %-.16s. Get 500point.]"), | |
| 7159 | 7191 | CUTTAIL (Npc[npc].name)); |
| 7160 | 7192 | SendSystemMessagePacket (nuser, work); |
| 7161 | 7193 | add_score (nuser, 500); |
| @@ -7184,13 +7216,13 @@ | ||
| 7184 | 7216 | break; |
| 7185 | 7217 | } |
| 7186 | 7218 | User[ntarget].crime_level = 0; |
| 7187 | - sprintf (work, "[You arrest %-.16s. Get %lupoint.]", | |
| 7219 | + sprintf (work, MESG ("[You arrest %-.16s. Get %lupoint.]"), | |
| 7188 | 7220 | CUTTAIL (User[ntarget].name), npts); |
| 7189 | 7221 | SendSystemMessagePacket (nuser, work); |
| 7190 | - sprintf (work, "[You were arrested by %-.16s]", | |
| 7222 | + sprintf (work, MESG ("[You were arrested by %-.16s]"), | |
| 7191 | 7223 | CUTTAIL (User[nuser].name)); |
| 7192 | 7224 | SendSystemMessagePacket (ntarget, work); |
| 7193 | - SendSystemMessagePacket (ntarget, "[Go to Jail!]"); | |
| 7225 | + SendSystemMessagePacket (ntarget, MESG ("[Go to Jail!]")); | |
| 7194 | 7226 | ClearUser (ntarget); |
| 7195 | 7227 | User[ntarget].status = Arrested; |
| 7196 | 7228 | add_arrest (ntarget); |
| @@ -7203,24 +7235,25 @@ | ||
| 7203 | 7235 | } |
| 7204 | 7236 | else |
| 7205 | 7237 | { |
| 7206 | - sprintf (work, "[You attempt to arrest %-.16s]", | |
| 7238 | + sprintf (work, MESG ("[You attempt to arrest %-.16s]"), | |
| 7207 | 7239 | CUTTAIL (User[ntarget].name)); |
| 7208 | 7240 | 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]"), | |
| 7211 | 7243 | CUTTAIL (User[nuser].name)); |
| 7212 | 7244 | SendSystemMessagePacket (ntarget, work); |
| 7213 | - SendSystemMessagePacket (ntarget, "[But you are innocence]"); | |
| 7245 | + SendSystemMessagePacket (ntarget, | |
| 7246 | + MESG ("[But you are innocence]")); | |
| 7214 | 7247 | } |
| 7215 | 7248 | } |
| 7216 | 7249 | else |
| 7217 | 7250 | { |
| 7218 | - SendSystemMessagePacket (nuser, "[What do you want?]"); | |
| 7251 | + SendSystemMessagePacket (nuser, MESG ("[What do you want?]")); | |
| 7219 | 7252 | } |
| 7220 | 7253 | } |
| 7221 | 7254 | else |
| 7222 | 7255 | { |
| 7223 | - SendSystemMessagePacket (nuser, "[You catch the air]"); | |
| 7256 | + SendSystemMessagePacket (nuser, MESG ("[You catch the air]")); | |
| 7224 | 7257 | } |
| 7225 | 7258 | return; |
| 7226 | 7259 | } |
| @@ -7238,7 +7271,7 @@ | ||
| 7238 | 7271 | if (User[nuser].score >= ncost) |
| 7239 | 7272 | { |
| 7240 | 7273 | dec_score (nuser, ncost); |
| 7241 | - sprintf (work, "[You paid %upoint for free]", ncost); | |
| 7274 | + sprintf (work, MESG ("[You paid %upoint for free]"), ncost); | |
| 7242 | 7275 | User[nuser].status = Healthy; |
| 7243 | 7276 | User[nuser].maybearrest = 0; |
| 7244 | 7277 | ActivateUser (nuser); |
| @@ -7245,13 +7278,13 @@ | ||
| 7245 | 7278 | } |
| 7246 | 7279 | else |
| 7247 | 7280 | { |
| 7248 | - strcpy (work, "[You have not enought point for free]"); | |
| 7281 | + strcpy (work, MESG ("[You have not enought point for free]")); | |
| 7249 | 7282 | } |
| 7250 | 7283 | } |
| 7251 | 7284 | else |
| 7252 | 7285 | { |
| 7253 | 7286 | /* ok. you are free now. */ |
| 7254 | - strcpy (work, "[You are free now]"); | |
| 7287 | + strcpy (work, MESG ("[You are free now]")); | |
| 7255 | 7288 | User[nuser].status = Healthy; |
| 7256 | 7289 | User[nuser].maybearrest = 0; |
| 7257 | 7290 | ActivateUser (nuser); |
| @@ -7260,7 +7293,7 @@ | ||
| 7260 | 7293 | } |
| 7261 | 7294 | else |
| 7262 | 7295 | { |
| 7263 | - SendSystemMessagePacket (nuser, "[No need pay. You are free.]"); | |
| 7296 | + SendSystemMessagePacket (nuser, MESG ("[No need pay. You are free.]")); | |
| 7264 | 7297 | } |
| 7265 | 7298 | return; |
| 7266 | 7299 | } |
| @@ -7360,11 +7393,11 @@ | ||
| 7360 | 7393 | { |
| 7361 | 7394 | if (ncost) |
| 7362 | 7395 | { |
| 7363 | - sprintf (work, "[You paid %upoint]", ncost); | |
| 7396 | + sprintf (work, MESG ("[You paid %upoint]"), ncost); | |
| 7364 | 7397 | } |
| 7365 | 7398 | else |
| 7366 | 7399 | { |
| 7367 | - strcpy (work, "[You no need pay for this!]"); | |
| 7400 | + strcpy (work, MESG ("[You no need pay for this!]")); | |
| 7368 | 7401 | } |
| 7369 | 7402 | } |
| 7370 | 7403 | else |
| @@ -7372,15 +7405,16 @@ | ||
| 7372 | 7405 | if (nospace) |
| 7373 | 7406 | { |
| 7374 | 7407 | 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]")); | |
| 7376 | 7410 | } |
| 7377 | 7411 | else if (ncost) |
| 7378 | 7412 | { |
| 7379 | - sprintf (work, "[Need %upoint for buy!]", ncost); | |
| 7413 | + sprintf (work, MESG ("[Need %upoint for buy!]"), ncost); | |
| 7380 | 7414 | } |
| 7381 | 7415 | else |
| 7382 | 7416 | { |
| 7383 | - strcpy (work, "[out of item number range]"); | |
| 7417 | + strcpy (work, MESG ("[out of item number range]")); | |
| 7384 | 7418 | } |
| 7385 | 7419 | } |
| 7386 | 7420 | SendSystemMessagePacket (nuser, work); |
| @@ -7396,7 +7430,8 @@ | ||
| 7396 | 7430 | int nshop = searchUserShopFromPos (nowner, x, y); |
| 7397 | 7431 | if (nshop == -1 || User[nowner].myshop[nshop].build == 0) |
| 7398 | 7432 | { |
| 7399 | - SendSystemMessagePacket (nuser, "(FATAL:user shop linkage is broken)"); | |
| 7433 | + SendSystemMessagePacket (nuser, | |
| 7434 | + MESG ("(FATAL:user shop linkage is broken)")); | |
| 7400 | 7435 | } |
| 7401 | 7436 | else |
| 7402 | 7437 | { |
| @@ -7454,11 +7489,11 @@ | ||
| 7454 | 7489 | User[nowner].myshop[nshop].count[buyitem][n]--; |
| 7455 | 7490 | if (ncost) |
| 7456 | 7491 | { |
| 7457 | - sprintf (work, "[You paid %upoint]", ncost); | |
| 7492 | + sprintf (work, MESG ("[You paid %upoint]"), ncost); | |
| 7458 | 7493 | } |
| 7459 | 7494 | else |
| 7460 | 7495 | { |
| 7461 | - strcpy (work, "[You no need pay for this!]"); | |
| 7496 | + strcpy (work, MESG ("[You no need pay for this!]")); | |
| 7462 | 7497 | } |
| 7463 | 7498 | } |
| 7464 | 7499 | else |
| @@ -7466,24 +7501,25 @@ | ||
| 7466 | 7501 | if (nospace) |
| 7467 | 7502 | { |
| 7468 | 7503 | 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]")); | |
| 7471 | 7506 | } |
| 7472 | 7507 | else |
| 7473 | 7508 | { |
| 7474 | - sprintf (work, "[Need %upoint for buy!]", ncost); | |
| 7509 | + sprintf (work, MESG ("[Need %upoint for buy!]"), ncost); | |
| 7475 | 7510 | } |
| 7476 | 7511 | } |
| 7477 | 7512 | } |
| 7478 | 7513 | else |
| 7479 | 7514 | { |
| 7480 | - strcpy (work, "[no stock]"); | |
| 7515 | + strcpy (work, MESG ("[no stock]")); | |
| 7481 | 7516 | } |
| 7482 | 7517 | SendSystemMessagePacket (nuser, work); |
| 7483 | 7518 | } |
| 7484 | 7519 | else |
| 7485 | 7520 | { |
| 7486 | - SendSystemMessagePacket (nuser, "[out of item number range]"); | |
| 7521 | + SendSystemMessagePacket (nuser, | |
| 7522 | + MESG ("[out of item number range]")); | |
| 7487 | 7523 | } |
| 7488 | 7524 | } |
| 7489 | 7525 | return; |
| @@ -7508,7 +7544,7 @@ | ||
| 7508 | 7544 | } |
| 7509 | 7545 | else |
| 7510 | 7546 | { |
| 7511 | - SendSystemMessagePacket (nuser, "[No shop here!]"); | |
| 7547 | + SendSystemMessagePacket (nuser, MESG ("[No shop here!]")); | |
| 7512 | 7548 | } |
| 7513 | 7549 | return; |
| 7514 | 7550 | } |
| @@ -7518,7 +7554,7 @@ | ||
| 7518 | 7554 | processListMyShop (int nuser) |
| 7519 | 7555 | { |
| 7520 | 7556 | int i; |
| 7521 | - SendSystemMessagePacket (nuser, "<Your shop list>"); | |
| 7557 | + SendSystemMessagePacket (nuser, MESG ("<Your shop list>")); | |
| 7522 | 7558 | for (i = 0; i < USERSHOP_LIMIT; i++) |
| 7523 | 7559 | { |
| 7524 | 7560 | if (User[nuser].myshop[i].build) |
| @@ -7525,13 +7561,13 @@ | ||
| 7525 | 7561 | { |
| 7526 | 7562 | char work[MESG_BUFFER]; |
| 7527 | 7563 | sprintf (work, |
| 7528 | - "<%d:%-16.16s (%3d,%3d)>", i + 1, | |
| 7564 | + MESG ("<%d:%-16.16s (%3d,%3d)>"), i + 1, | |
| 7529 | 7565 | User[nuser].myshop[i].name, |
| 7530 | 7566 | User[nuser].myshop[i].pos.x, User[nuser].myshop[i].pos.y); |
| 7531 | 7567 | SendSystemMessagePacket (nuser, work); |
| 7532 | 7568 | } |
| 7533 | 7569 | } |
| 7534 | - SendSystemMessagePacket (nuser, "<end of list>"); | |
| 7570 | + SendSystemMessagePacket (nuser, MESG ("<end of list>")); | |
| 7535 | 7571 | return; |
| 7536 | 7572 | } |
| 7537 | 7573 |
| @@ -7541,23 +7577,23 @@ | ||
| 7541 | 7577 | { |
| 7542 | 7578 | int i; |
| 7543 | 7579 | char work[MESG_BUFFER]; |
| 7544 | - SendSystemMessagePacket (nuser, "<CAPTURED ANIMAL>"); | |
| 7580 | + SendSystemMessagePacket (nuser, MESG ("<CAPTURED ANIMAL>")); | |
| 7545 | 7581 | for (i = 0; i < User[nuser].animal_slot; i++) |
| 7546 | 7582 | { |
| 7547 | 7583 | ANIMALDATA *p = User[nuser].lastPickupAnimal[i]; |
| 7548 | 7584 | if (p != NULL) |
| 7549 | 7585 | { |
| 7550 | - sprintf (work, "<%d:%-16.16s(%-.32s)>", i + 1, p->name, | |
| 7586 | + sprintf (work, MESG ("<%d:%-16.16s(%-.32s)>"), i + 1, p->name, | |
| 7551 | 7587 | Item[p->forsell_item].name); |
| 7552 | 7588 | SendSystemMessagePacket (nuser, work); |
| 7553 | 7589 | } |
| 7554 | 7590 | else |
| 7555 | 7591 | { |
| 7556 | - sprintf (work, "<%d:EMPTY>", i + 1); | |
| 7592 | + sprintf (work, MESG ("<%d:EMPTY>"), i + 1); | |
| 7557 | 7593 | SendSystemMessagePacket (nuser, work); |
| 7558 | 7594 | } |
| 7559 | 7595 | } |
| 7560 | - SendSystemMessagePacket (nuser, "<end of list>"); | |
| 7596 | + SendSystemMessagePacket (nuser, MESG ("<end of list>")); | |
| 7561 | 7597 | return; |
| 7562 | 7598 | } |
| 7563 | 7599 |
| @@ -7576,7 +7612,7 @@ | ||
| 7576 | 7612 | if (nslot < 0 || nslot > ITEM_MAX) |
| 7577 | 7613 | { |
| 7578 | 7614 | /* illegal slot */ |
| 7579 | - SendSystemMessagePacket (nuser, "[Illegal slot number]"); | |
| 7615 | + SendSystemMessagePacket (nuser, MESG ("[Illegal slot number]")); | |
| 7580 | 7616 | return; |
| 7581 | 7617 | } |
| 7582 | 7618 | n = User[nuser].item[nslot]; |
| @@ -7587,7 +7623,7 @@ | ||
| 7587 | 7623 | if (nslot < 0 || nslot > WEAPON_MAX) |
| 7588 | 7624 | { |
| 7589 | 7625 | /* illegal slot */ |
| 7590 | - SendSystemMessagePacket (nuser, "[Illegal slot number]"); | |
| 7626 | + SendSystemMessagePacket (nuser, MESG ("[Illegal slot number]")); | |
| 7591 | 7627 | return; |
| 7592 | 7628 | } |
| 7593 | 7629 | n = User[nuser].weapon[nslot]; |
| @@ -7608,17 +7644,19 @@ | ||
| 7608 | 7644 | User[nuser].bullette[nslot] = 0; |
| 7609 | 7645 | } |
| 7610 | 7646 | SendSystemMessagePacket (nuser, isitem ? |
| 7611 | - "[Drop item]" : "[Drop Weapon]"); | |
| 7647 | + MESG ("[Drop item]") : | |
| 7648 | + MESG ("[Drop Weapon]")); | |
| 7612 | 7649 | } |
| 7613 | 7650 | else |
| 7614 | 7651 | { |
| 7615 | 7652 | SendSystemMessagePacket (nuser, isitem ? |
| 7616 | - "[Item is empty]" : "[Weapon is empty]"); | |
| 7653 | + MESG ("[Item is empty]") : | |
| 7654 | + MESG ("[Weapon is empty]")); | |
| 7617 | 7655 | } |
| 7618 | 7656 | } |
| 7619 | 7657 | else |
| 7620 | 7658 | { |
| 7621 | - SendSystemMessagePacket (nuser, "[You can't drop here!]"); | |
| 7659 | + SendSystemMessagePacket (nuser, MESG ("[You can't drop here!]")); | |
| 7622 | 7660 | } |
| 7623 | 7661 | return; |
| 7624 | 7662 | } |
| @@ -7633,11 +7671,12 @@ | ||
| 7633 | 7671 | if (animal == NULL) |
| 7634 | 7672 | { |
| 7635 | 7673 | SendSystemMessagePacket (nuser, |
| 7636 | - "<FATAL:can't allocate animal list memory!>"); | |
| 7674 | + MESG | |
| 7675 | + ("<FATAL:can't allocate animal list memory!>")); | |
| 7637 | 7676 | return; |
| 7638 | 7677 | } |
| 7639 | 7678 | memset (animal, 0, AnimalDataLimit * sizeof (int)); |
| 7640 | - SendSystemMessagePacket (nuser, "<ANIMAL LIST>"); | |
| 7679 | + SendSystemMessagePacket (nuser, MESG ("<ANIMAL LIST>")); | |
| 7641 | 7680 | for (i = 0; i < AnimalLimit; i++) |
| 7642 | 7681 | { |
| 7643 | 7682 | if (Animal[i].pdata != NULL && Animal[i].hp) |
| @@ -7649,13 +7688,13 @@ | ||
| 7649 | 7688 | { |
| 7650 | 7689 | if (animal[i]) |
| 7651 | 7690 | { |
| 7652 | - sprintf (work, "<'%-16.16s' lives:%3d rate:%3u value:%5u>", | |
| 7691 | + sprintf (work, MESG ("<'%-16.16s' lives:%3d rate:%3u value:%5u>"), | |
| 7653 | 7692 | AnimalData[i].name, animal[i], |
| 7654 | 7693 | AnimalData[i].rate, AnimalData[i].value); |
| 7655 | 7694 | SendSystemMessagePacket (nuser, work); |
| 7656 | 7695 | } |
| 7657 | 7696 | } |
| 7658 | - SendSystemMessagePacket (nuser, "<end of list>"); | |
| 7697 | + SendSystemMessagePacket (nuser, MESG ("<end of list>")); | |
| 7659 | 7698 | free (animal); |
| 7660 | 7699 | return; |
| 7661 | 7700 | } |
| @@ -7667,7 +7706,7 @@ | ||
| 7667 | 7706 | { |
| 7668 | 7707 | int i; |
| 7669 | 7708 | int f = 0; |
| 7670 | - SendSystemMessagePacket (nuser, "<MAILBOX>"); | |
| 7709 | + SendSystemMessagePacket (nuser, MESG ("<MAILBOX>")); | |
| 7671 | 7710 | ReorderMailbox (nuser); |
| 7672 | 7711 | for (i = 0; i < MAIL_BOX_LIMIT; i++) |
| 7673 | 7712 | { |
| @@ -7700,7 +7739,8 @@ | ||
| 7700 | 7739 | f = 1; |
| 7701 | 7740 | } |
| 7702 | 7741 | } |
| 7703 | - SendSystemMessagePacket (nuser, (!f) ? "<no mail!>" : "<end of list>"); | |
| 7742 | + SendSystemMessagePacket (nuser, (!f) ? MESG ("<no mail!>") : | |
| 7743 | + MESG ("<end of list>")); | |
| 7704 | 7744 | return; |
| 7705 | 7745 | } |
| 7706 | 7746 |
| @@ -7722,13 +7762,14 @@ | ||
| 7722 | 7762 | else |
| 7723 | 7763 | { |
| 7724 | 7764 | User[nuser].mail[n]->readflag = 1; |
| 7725 | - SendSystemMessagePacket (nuser, "[end of mail-data transfer]"); | |
| 7765 | + SendSystemMessagePacket (nuser, | |
| 7766 | + MESG ("[end of mail-data transfer]")); | |
| 7726 | 7767 | puts ("done"); |
| 7727 | 7768 | } |
| 7728 | 7769 | } |
| 7729 | 7770 | else |
| 7730 | 7771 | { |
| 7731 | - SendSystemMessagePacket (nuser, "[no such mail!]"); | |
| 7772 | + SendSystemMessagePacket (nuser, MESG ("[no such mail!]")); | |
| 7732 | 7773 | } |
| 7733 | 7774 | return; |
| 7734 | 7775 | } |
| @@ -7744,11 +7785,11 @@ | ||
| 7744 | 7785 | FreeMail (User[nuser].mail[n]); |
| 7745 | 7786 | User[nuser].mail[n] = NULL; |
| 7746 | 7787 | ReorderMailbox (nuser); |
| 7747 | - SendSystemMessagePacket (nuser, "[deleted 1 message]"); | |
| 7788 | + SendSystemMessagePacket (nuser, MESG ("[deleted 1 message]")); | |
| 7748 | 7789 | } |
| 7749 | 7790 | else |
| 7750 | 7791 | { |
| 7751 | - SendSystemMessagePacket (nuser, "[no such mail!]"); | |
| 7792 | + SendSystemMessagePacket (nuser, MESG ("[no such mail!]")); | |
| 7752 | 7793 | } |
| 7753 | 7794 | return; |
| 7754 | 7795 | } |
| @@ -7760,7 +7801,7 @@ | ||
| 7760 | 7801 | { |
| 7761 | 7802 | int i; |
| 7762 | 7803 | int f = 0; |
| 7763 | - SendSystemMessagePacket (nuser, "<BBS article(s)>"); | |
| 7804 | + SendSystemMessagePacket (nuser, MESG ("<BBS article(s)>")); | |
| 7764 | 7805 | for (i = 0; i < BBS_BOX_LIMIT; i++) |
| 7765 | 7806 | { |
| 7766 | 7807 | if (BBSdata[i] != NULL) |
| @@ -7791,7 +7832,8 @@ | ||
| 7791 | 7832 | f = 1; |
| 7792 | 7833 | } |
| 7793 | 7834 | } |
| 7794 | - SendSystemMessagePacket (nuser, (!f) ? "<no article!>" : "<end of list>"); | |
| 7835 | + SendSystemMessagePacket (nuser, (!f) ? MESG ("<no article!>") : | |
| 7836 | + MESG ("<end of list>")); | |
| 7795 | 7837 | return; |
| 7796 | 7838 | } |
| 7797 | 7839 |
| @@ -7812,13 +7854,14 @@ | ||
| 7812 | 7854 | } |
| 7813 | 7855 | else |
| 7814 | 7856 | { |
| 7815 | - SendSystemMessagePacket (nuser, "[end of article-data transfer]"); | |
| 7857 | + SendSystemMessagePacket (nuser, | |
| 7858 | + MESG ("[end of article-data transfer]")); | |
| 7816 | 7859 | puts ("done"); |
| 7817 | 7860 | } |
| 7818 | 7861 | } |
| 7819 | 7862 | else |
| 7820 | 7863 | { |
| 7821 | - SendSystemMessagePacket (nuser, "[no such article!]"); | |
| 7864 | + SendSystemMessagePacket (nuser, MESG ("[no such article!]")); | |
| 7822 | 7865 | } |
| 7823 | 7866 | return; |
| 7824 | 7867 | } |
| @@ -8064,11 +8107,11 @@ | ||
| 8064 | 8107 | { |
| 8065 | 8108 | if (pb->t_type == TargetUser) |
| 8066 | 8109 | { |
| 8067 | - sprintf (work, "You attack animal '%-.16s'", | |
| 8110 | + sprintf (work, MESG ("You attack animal '%-.16s'"), | |
| 8068 | 8111 | CUTTAIL (Animal[nanimal].name)); |
| 8069 | 8112 | SendSystemMessagePacket (pb->nuser, work); |
| 8070 | 8113 | } |
| 8071 | - sprintf (work, "[%-.16s shoot animal!]", | |
| 8114 | + sprintf (work, MESG ("[%-.16s shoot animal!]"), | |
| 8072 | 8115 | CUTTAIL ((pb->t_type == TargetUser) ? |
| 8073 | 8116 | User[pb->nuser].name : |
| 8074 | 8117 | Npc[pb->nuser].name)); |
| @@ -8087,7 +8130,8 @@ | ||
| 8087 | 8130 | { |
| 8088 | 8131 | if (pb->nuser != -1 && pb->t_type == TargetUser) |
| 8089 | 8132 | { |
| 8090 | - sprintf (work, "animal '%-.16s' died.", | |
| 8133 | + sprintf (work, | |
| 8134 | + MESG ("animal '%-.16s' died."), | |
| 8091 | 8135 | CUTTAIL (Animal[nanimal].name)); |
| 8092 | 8136 | SendSystemMessagePacket (pb->nuser, work); |
| 8093 | 8137 | if (CountLiveAnimal (Animal[nanimal].pdata) == 0) |
| @@ -8094,7 +8138,8 @@ | ||
| 8094 | 8138 | { |
| 8095 | 8139 | /* this is last animal! */ |
| 8096 | 8140 | sprintf (work, |
| 8097 | - "[animal '%-.16s' is extermination!]", | |
| 8141 | + MESG | |
| 8142 | + ("[animal '%-.16s' is extermination!]"), | |
| 8098 | 8143 | CUTTAIL (Animal[nanimal].name)); |
| 8099 | 8144 | SendSystemMessagePacket (pb->nuser, work); |
| 8100 | 8145 | if (User[pb->nuser].c_type == Observer) |
| @@ -8101,7 +8146,8 @@ | ||
| 8101 | 8146 | { |
| 8102 | 8147 | unsigned pts = Animal[nanimal].pdata->value; |
| 8103 | 8148 | dec_score (pb->nuser, pts); |
| 8104 | - sprintf (work, "[You lost %upoint!]", pts); | |
| 8149 | + sprintf (work, MESG ("[You lost %upoint!]"), | |
| 8150 | + pts); | |
| 8105 | 8151 | SendSystemMessagePacket (pb->nuser, work); |
| 8106 | 8152 | } |
| 8107 | 8153 | } |
| @@ -8115,8 +8161,9 @@ | ||
| 8115 | 8161 | { |
| 8116 | 8162 | add_score (pb->nuser, pts); |
| 8117 | 8163 | sprintf (work, |
| 8118 | - "[You kill dangerous animal." | |
| 8119 | - " get %upoint]", pts); | |
| 8164 | + MESG | |
| 8165 | + ("[You kill dangerous animal. get %upoint]"), | |
| 8166 | + pts); | |
| 8120 | 8167 | SendSystemMessagePacket (pb->nuser, |
| 8121 | 8168 | work); |
| 8122 | 8169 | } |
| @@ -8129,7 +8176,7 @@ | ||
| 8129 | 8176 | { |
| 8130 | 8177 | if (pb->nuser != -1 && pb->t_type == TargetUser) |
| 8131 | 8178 | { |
| 8132 | - sprintf (work, "animal '%-.16s' stun.", | |
| 8179 | + sprintf (work, MESG ("animal '%-.16s' stun."), | |
| 8133 | 8180 | CUTTAIL (Animal[nanimal].name)); |
| 8134 | 8181 | SendSystemMessagePacket (pb->nuser, work); |
| 8135 | 8182 | } |
| @@ -8145,7 +8192,9 @@ | ||
| 8145 | 8192 | /* success! */ |
| 8146 | 8193 | if (Animal[nanimal].owner_user == -1) |
| 8147 | 8194 | { |
| 8148 | - sprintf (work, "You charm animal '%-.16s'!", | |
| 8195 | + sprintf (work, | |
| 8196 | + MESG | |
| 8197 | + ("You charm animal '%-.16s'!"), | |
| 8149 | 8198 | CUTTAIL (Animal[nanimal].name)); |
| 8150 | 8199 | SendSystemMessagePacket (pb->nuser, work); |
| 8151 | 8200 | Animal[nanimal].owner_user = pb->nuser; |
| @@ -8153,7 +8202,8 @@ | ||
| 8153 | 8202 | else |
| 8154 | 8203 | { |
| 8155 | 8204 | sprintf (work, |
| 8156 | - "Animal '%-.16s' is free now!", | |
| 8205 | + MESG | |
| 8206 | + ("Animal '%-.16s' is free now!"), | |
| 8157 | 8207 | CUTTAIL (Animal[nanimal].name)); |
| 8158 | 8208 | SendMessageNearUserPosition (pb->pos, work); |
| 8159 | 8209 | Animal[nanimal].owner_user = -1; |
| @@ -8163,7 +8213,8 @@ | ||
| 8163 | 8213 | { |
| 8164 | 8214 | /* fail */ |
| 8165 | 8215 | sprintf (work, |
| 8166 | - "You fail to charm animal '%-.16s'.", | |
| 8216 | + MESG | |
| 8217 | + ("You fail to charm animal '%-.16s'."), | |
| 8167 | 8218 | CUTTAIL (Animal[nanimal].name)); |
| 8168 | 8219 | SendSystemMessagePacket (pb->nuser, work); |
| 8169 | 8220 | } |
| @@ -8213,7 +8264,7 @@ | ||
| 8213 | 8264 | char work[MESG_BUFFER]; |
| 8214 | 8265 | if (pb->nuser != -1 && pb->t_type == TargetUser) |
| 8215 | 8266 | { |
| 8216 | - sprintf (work, "You attack '%-.16s'", | |
| 8267 | + sprintf (work, MESG ("You attack '%-.16s'"), | |
| 8217 | 8268 | CUTTAIL (Npc[npc].name)); |
| 8218 | 8269 | SendSystemMessagePacket (pb->nuser, work); |
| 8219 | 8270 | } |
| @@ -8222,7 +8273,7 @@ | ||
| 8222 | 8273 | { |
| 8223 | 8274 | if (pb->nuser != -1 && pb->t_type == TargetUser) |
| 8224 | 8275 | { |
| 8225 | - sprintf (work, "'%-.16s' died.", | |
| 8276 | + sprintf (work, MESG ("'%-.16s' died."), | |
| 8226 | 8277 | CUTTAIL (Npc[npc].name)); |
| 8227 | 8278 | SendSystemMessagePacket (pb->nuser, work); |
| 8228 | 8279 | if (User[pb->nuser].c_type == Hunter && |
| @@ -8231,7 +8282,8 @@ | ||
| 8231 | 8282 | /* it is crime! */ |
| 8232 | 8283 | add_crime (pb->nuser, CrimeNpcMurder); |
| 8233 | 8284 | SendSystemMessagePacket (pb->nuser, |
| 8234 | - "[You are murder!]"); | |
| 8285 | + MESG | |
| 8286 | + ("[You are murder!]")); | |
| 8235 | 8287 | } |
| 8236 | 8288 | } |
| 8237 | 8289 | else |
| @@ -8238,13 +8290,14 @@ | ||
| 8238 | 8290 | { |
| 8239 | 8291 | if (pb->nuser != -1 && pb->t_type == TargetNpc) |
| 8240 | 8292 | { |
| 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)); | |
| 8244 | 8297 | } |
| 8245 | 8298 | else |
| 8246 | 8299 | { |
| 8247 | - sprintf (work, "'%-.16s' killed by any!", | |
| 8300 | + sprintf (work, MESG ("'%-.16s' killed by any!"), | |
| 8248 | 8301 | CUTTAIL (Npc[npc].name)); |
| 8249 | 8302 | } |
| 8250 | 8303 | SendMessageNearUserPosition (Npc[npc].pos, work); |
| @@ -8452,7 +8505,7 @@ | ||
| 8452 | 8505 | int nuser = User[i].lastuser; |
| 8453 | 8506 | if (User[i].lastuser_type == TargetUser) |
| 8454 | 8507 | { |
| 8455 | - sprintf (work, "[You kill %-.16s]", | |
| 8508 | + sprintf (work, MESG ("[You kill %-.16s]"), | |
| 8456 | 8509 | CUTTAIL (User[i].name)); |
| 8457 | 8510 | SendSystemMessagePacket (nuser, work); |
| 8458 | 8511 | } |
| @@ -8474,7 +8527,7 @@ | ||
| 8474 | 8527 | if (pname != NULL) |
| 8475 | 8528 | { |
| 8476 | 8529 | sprintf (work, |
| 8477 | - "[You were killed by %-.16s]", | |
| 8530 | + MESG ("[You were killed by %-.16s]"), | |
| 8478 | 8531 | CUTTAIL (pname)); |
| 8479 | 8532 | SendSystemMessagePacket (i, work); |
| 8480 | 8533 | } |
| @@ -8488,7 +8541,8 @@ | ||
| 8488 | 8541 | if (npoint) |
| 8489 | 8542 | { |
| 8490 | 8543 | add_score (nuser, npoint); |
| 8491 | - sprintf (work, "[You get %upoint]", npoint); | |
| 8544 | + sprintf (work, MESG ("[You get %upoint]"), | |
| 8545 | + npoint); | |
| 8492 | 8546 | SendSystemMessagePacket (nuser, work); |
| 8493 | 8547 | } |
| 8494 | 8548 | } |
| @@ -8497,7 +8551,8 @@ | ||
| 8497 | 8551 | { |
| 8498 | 8552 | add_crime (nuser, CrimeMurder); |
| 8499 | 8553 | SendSystemMessagePacket (nuser, |
| 8500 | - "[You are murder!]"); | |
| 8554 | + MESG | |
| 8555 | + ("[You are murder!]")); | |
| 8501 | 8556 | } |
| 8502 | 8557 | else if (User[i].crime_level == 2) |
| 8503 | 8558 | { |
| @@ -8506,7 +8561,7 @@ | ||
| 8506 | 8561 | if (npoint) |
| 8507 | 8562 | { |
| 8508 | 8563 | add_score (nuser, npoint); |
| 8509 | - sprintf (work, "[You get bonus %upoint]", | |
| 8564 | + sprintf (work, MESG ("[You get bonus %upoint]"), | |
| 8510 | 8565 | npoint); |
| 8511 | 8566 | SendSystemMessagePacket (nuser, work); |
| 8512 | 8567 | } |
| @@ -8516,7 +8571,7 @@ | ||
| 8516 | 8571 | else |
| 8517 | 8572 | { |
| 8518 | 8573 | /* you die by your own */ |
| 8519 | - SendSystemMessagePacket (i, "[You died]"); | |
| 8574 | + SendSystemMessagePacket (i, MESG ("[You died]")); | |
| 8520 | 8575 | } |
| 8521 | 8576 | if (!(MAP (User[i].pos.x, User[i].pos.y)->id & |
| 8522 | 8577 | (MAP_THERE_WALL | MAP_THERE_ITEM))) |
| @@ -8580,10 +8635,12 @@ | ||
| 8580 | 8635 | switch (User[i].hungry) |
| 8581 | 8636 | { |
| 8582 | 8637 | case 50: |
| 8583 | - SendSystemMessagePacket (i, "[You feel hungry]"); | |
| 8638 | + SendSystemMessagePacket (i, MESG ("[You feel hungry]")); | |
| 8584 | 8639 | break; |
| 8585 | 8640 | case 10: |
| 8586 | - SendSystemMessagePacket (i, "[You feel weak by hungry]"); | |
| 8641 | + SendSystemMessagePacket (i, | |
| 8642 | + MESG | |
| 8643 | + ("[You feel weak by hungry]")); | |
| 8587 | 8644 | break; |
| 8588 | 8645 | case 4: |
| 8589 | 8646 | case 3: |
| @@ -8590,7 +8647,9 @@ | ||
| 8590 | 8647 | case 2: |
| 8591 | 8648 | case 1: |
| 8592 | 8649 | case 0: |
| 8593 | - SendSystemMessagePacket (i, "[You can't move by hungry!]"); | |
| 8650 | + SendSystemMessagePacket (i, | |
| 8651 | + MESG | |
| 8652 | + ("[You can't move by hungry!]")); | |
| 8594 | 8653 | User[i].hold_count += 10 * (5 - User[i].hungry); |
| 8595 | 8654 | break; |
| 8596 | 8655 | default: |
| @@ -8604,7 +8663,7 @@ | ||
| 8604 | 8663 | { |
| 8605 | 8664 | char work[MESG_BUFFER]; |
| 8606 | 8665 | cause_damage (i, DamageWhenHungry, -1, TargetNone); |
| 8607 | - sprintf (work, "[You lost %uHP by hugry]", | |
| 8666 | + sprintf (work, MESG ("[You lost %uHP by hugry]"), | |
| 8608 | 8667 | DamageWhenHungry); |
| 8609 | 8668 | SendSystemMessagePacket (i, work); |
| 8610 | 8669 | } |
| @@ -8615,9 +8674,9 @@ | ||
| 8615 | 8674 | char work[MESG_BUFFER]; |
| 8616 | 8675 | MAP (User[i].pos.x, User[i].pos.y)->id &= ~MAP_THERE_HOLE; |
| 8617 | 8676 | User[i].hold_count = HoldCount; |
| 8618 | - SendSystemMessagePacket (i, "[You fall in hole!]"); | |
| 8677 | + SendSystemMessagePacket (i, MESG ("[You fall in hole!]")); | |
| 8619 | 8678 | SendEffectFallInHolePacket (i); |
| 8620 | - sprintf (work, "[You hear sound %-.16s fall in hole]", | |
| 8679 | + sprintf (work, MESG ("[You hear sound %-.16s fall in hole]"), | |
| 8621 | 8680 | CUTTAIL (User[i].name)); |
| 8622 | 8681 | SendMessageNearUser (i, work); |
| 8623 | 8682 | } |
| @@ -8827,8 +8886,9 @@ | ||
| 8827 | 8886 | { |
| 8828 | 8887 | /* eat meat */ |
| 8829 | 8888 | 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)); | |
| 8832 | 8892 | SendMessageNearUserPosition (Animal[nanimal].pos, work); |
| 8833 | 8893 | MAP (Animal[targetanimal].pos.x, Animal[targetanimal].pos.y)->id &= |
| 8834 | 8894 | ~MAP_THERE_ANIMAL; |
| @@ -8908,7 +8968,7 @@ | ||
| 8908 | 8968 | if (Npc[npc].hp == 0) |
| 8909 | 8969 | { |
| 8910 | 8970 | char work[MESG_BUFFER]; |
| 8911 | - sprintf (work, "'%-.16s' died.", CUTTAIL (Npc[npc].name)); | |
| 8971 | + sprintf (work, MESG ("'%-.16s' died."), CUTTAIL (Npc[npc].name)); | |
| 8912 | 8972 | SendMessageNearUserPosition (Npc[npc].pos, work); |
| 8913 | 8973 | Npc[npc].name[0] = '\0'; |
| 8914 | 8974 | MAP (Npc[npc].pos.x, Npc[npc].pos.y)->id &= ~MAP_THERE_NPC; |
| @@ -9433,7 +9493,8 @@ | ||
| 9433 | 9493 | MAP (x, y)->id &= ~MAP_THERE_HOLE; |
| 9434 | 9494 | Animal[i].hold_count = HoldCount; |
| 9435 | 9495 | sprintf (work, |
| 9436 | - "[You hear sound '%-.16s' fall in hole]", | |
| 9496 | + MESG | |
| 9497 | + ("[You hear sound '%-.16s' fall in hole]"), | |
| 9437 | 9498 | CUTTAIL (Animal[i].name)); |
| 9438 | 9499 | SendMessageNearUserAnimal (i, work); |
| 9439 | 9500 | } |
| @@ -9926,7 +9987,7 @@ | ||
| 9926 | 9987 | char work[MESG_BUFFER]; |
| 9927 | 9988 | MAP (x, y)->id &= ~MAP_THERE_HOLE; |
| 9928 | 9989 | 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!]"), | |
| 9930 | 9991 | Npc[n].name); |
| 9931 | 9992 | SendMessageNearUserPosition (Npc[n].pos, work); |
| 9932 | 9993 | } |
| @@ -10038,7 +10099,8 @@ | ||
| 10038 | 10099 | { |
| 10039 | 10100 | /* get */ |
| 10040 | 10101 | 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)); | |
| 10042 | 10104 | SendMessageNearUserPosition (Npc[n].pos, work); |
| 10043 | 10105 | MAP (Animal[ntarget].pos.x, Animal[ntarget].pos.y)->id &= |
| 10044 | 10106 | ~MAP_THERE_ANIMAL; |
| @@ -10238,7 +10300,7 @@ | ||
| 10238 | 10300 | /* arrest */ |
| 10239 | 10301 | char work[MESG_BUFFER]; |
| 10240 | 10302 | NPCsay (n, g_mesg, 3); |
| 10241 | - sprintf (work, "[You were arrested by %-.16s!]", | |
| 10303 | + sprintf (work, MESG ("[You were arrested by %-.16s!]"), | |
| 10242 | 10304 | CUTTAIL (Npc[n].name)); |
| 10243 | 10305 | SendSystemMessagePacket (ntarget, work); |
| 10244 | 10306 | ClearUser (ntarget); |
| @@ -11351,6 +11413,8 @@ | ||
| 11351 | 11413 | { |
| 11352 | 11414 | char work[BUFFER_SIZE]; |
| 11353 | 11415 | |
| 11416 | + InitializeStringTable (); | |
| 11417 | + LoadStringTable (MESG_DATA_FILE); | |
| 11354 | 11418 | srand ((unsigned) time (NULL)); |
| 11355 | 11419 | puts ("Loading datas..."); |
| 11356 | 11420 | sprintf (work, "%s/%s", DATA_DIR, INIT_DATA_FILE); |
| @@ -11402,6 +11466,14 @@ | ||
| 11402 | 11466 | #endif |
| 11403 | 11467 | #endif |
| 11404 | 11468 | 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 | |
| 11405 | 11477 | if (argc > 1) |
| 11406 | 11478 | { |
| 11407 | 11479 | if (strcmp (argv[1], "-")) |
| @@ -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 */ |
| @@ -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 */ |
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | #define HAVE_SIGACTION |
| 8 | 8 | #define HAVE_SIGALRM |
| 9 | 9 | #define USE_FORK |
| 10 | +#define USE_LOCALE | |
| 10 | 11 | #endif |
| 11 | 12 | |
| 12 | 13 | #include <unistd.h> |
| @@ -60,7 +61,6 @@ | ||
| 60 | 61 | /* win32 no have 'socklen_t' */ |
| 61 | 62 | #define socklen_t int |
| 62 | 63 | |
| 63 | - | |
| 64 | 64 | #else |
| 65 | 65 | #error NEED enviroment-type! |
| 66 | 66 | #endif |
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | #CFLAGS=-Wall -g $(DEFINES) |
| 5 | 5 | CFLAGS=-Wall -O $(DEFINES) |
| 6 | 6 | |
| 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 | |
| 8 | 8 | |
| 9 | 9 | all: huntserv |
| 10 | 10 |
| @@ -15,8 +15,8 @@ | ||
| 15 | 15 | -rm *~ core *.o |
| 16 | 16 | -rm h-user h-bbs h-map h-mail.* huntserv |
| 17 | 17 | |
| 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 | |
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | ctlsock.o : ctlsock.c ctlsock.h port.h |
| @@ -23,6 +23,8 @@ | ||
| 23 | 23 | |
| 24 | 24 | pktio.o : pktio.c hunt.h pktio.h ctlsock.h port.h |
| 25 | 25 | |
| 26 | +strtable.o : strtable.c strtable.h port.h | |
| 27 | + | |
| 26 | 28 | huntserv.o : huntserv.c hunt.h pktio.h ctlsock.h port.h |
| 27 | 29 | |
| 28 | 30 |