Kentaro Shirakata
argra****@users*****
2005年 5月 1日 (日) 20:27:04 JST
Index: jnethack/src/do.c diff -u jnethack/src/do.c:1.30 jnethack/src/do.c:1.31 --- jnethack/src/do.c:1.30 Wed Apr 27 05:51:16 2005 +++ jnethack/src/do.c Sun May 1 20:27:04 2005 @@ -861,10 +861,7 @@ add_valid_menu_class(0); /* clear any classes already there */ if (*u.ushops) sellobj_state(SELL_DELIBERATE); if (flags.menu_style != MENU_TRADITIONAL || -/*JP (result = ggetobj("drop", drop, 0, FALSE, (unsigned *)0)) < -1) -*/ - (result = ggetobj("置く", drop, 0, FALSE, (unsigned *)0)) < -1) result = menu_drop(result); if (*u.ushops) sellobj_state(SELL_NORMAL); reset_occupations(); @@ -925,10 +922,7 @@ unsigned ggoresults = 0; all_categories = FALSE; /* Gather valid classes via traditional NetHack method */ -/*JP i = ggetobj("drop", drop, 0, TRUE, &ggoresults); -*/ - i = ggetobj("置く", drop, 0, TRUE, &ggoresults); if (i == -2) all_categories = TRUE; if (ggoresults & ALL_FINISHED) { n_dropped = i; Index: jnethack/src/do_wear.c diff -u jnethack/src/do_wear.c:1.35 jnethack/src/do_wear.c:1.36 --- jnethack/src/do_wear.c:1.35 Wed Apr 27 05:51:16 2005 +++ jnethack/src/do_wear.c Sun May 1 20:27:04 2005 @@ -2535,10 +2535,7 @@ add_valid_menu_class(0); /* reset */ if (flags.menu_style != MENU_TRADITIONAL || -/*JP (result = ggetobj("take off", select_off, 0, FALSE, (unsigned *)0)) < -1) -*/ - (result = ggetobj("の装備を解く", select_off, 0, FALSE, (unsigned *)0)) < -1) result = menu_remarm(result); if (takeoff_mask) { @@ -2586,10 +2583,7 @@ free((genericptr_t) pick_list); } else if (flags.menu_style == MENU_COMBINATION) { all_worn_categories = FALSE; -/*JP if (ggetobj("take off", select_off, 0, TRUE, (unsigned *)0) == -2) -*/ - if (ggetobj("の装備を解く", select_off, 0, TRUE, (unsigned *)0) == -2) all_worn_categories = TRUE; } Index: jnethack/src/eat.c diff -u jnethack/src/eat.c:1.36 jnethack/src/eat.c:1.37 --- jnethack/src/eat.c:1.36 Wed Apr 27 05:51:16 2005 +++ jnethack/src/eat.c Sun May 1 20:27:04 2005 @@ -3038,7 +3038,7 @@ boolean feeding = (!strcmp(verb, "eat")); #if 1 /*JP*/ - const char *jverb = trans_verb(verb); + const char *jverb = trans_verb(verb)->jp; #endif /* if we can't touch floor objects then use invent food only */ Index: jnethack/src/invent.c diff -u jnethack/src/invent.c:1.33 jnethack/src/invent.c:1.34 --- jnethack/src/invent.c:1.33 Sat Apr 30 20:51:19 2005 +++ jnethack/src/invent.c Sun May 1 20:27:04 2005 @@ -740,12 +740,7 @@ taking_off(action) const char *action; { -#if 0 /*JP*/ return !strcmp(action, "take off") || !strcmp(action, "remove"); -#else - return !strcmp(action, "take off") || !strcmp(action, "remove") - || !strcmp(action, "脱ぐ") || !strcmp(action, "はずす") || !strcmp(action, "装備を解く"); -#endif } /* match the prompt for either 'W' or 'P' command */ @@ -753,13 +748,74 @@ putting_on(action) const char *action; { -#if 0 /*JP*//*例によってハードコーディング。do_wear.c */ return !strcmp(action, "wear") || !strcmp(action, "put on"); -#else - return !strcmp(action, "身につける"); -#endif } +#if 1 /*JP*/ +static struct trans_verb trans_verb_list[] = { + {"adjust", "どれ", "を", "調整する"}, + {"call", "どれ", "を", "呼ぶ"}, + {"charge", "どれ", "を", "充填する"}, + {"dip into", "どれ", "に", "浸す"}, + {"dip", "どれ", "を", "浸す"}, + {"drink", "どれ", "を", "飲む"}, + {"drop", "どれ", "を", "置く"}, + {"eat", "どれ", "を", "食べる"}, + {"grease", "どれ", "に", "塗る"}, + {"identify", "どれ", "を", "識別する"}, + {"invoke", "ど", "の", "魔力を使う"}, + {"name", "どれ", "を", "名づける"}, + {"put on", "どれ", "を", "身につける"}, + {"read", "どれ", "を", "読む"}, + {"ready", "どれ", "を", "装填する"}, + {"remove", "どれ", "を", "はずす"}, + {"rub", "どれ", "を", "こする"}, + {"rub on the stone", "どれ", "を", "石でこする"}, + {"sacrifice", "どれ", "を", "捧げる"}, + {"take off", "ど", "の", "装備を解く"}, + {"throw", "どれ", "を", "投げる"}, + {"tin", "どれ", "を", "缶詰めにする"}, + {"untrap with", "どれ", "を", "使って解除する"}, + {"use or apply", "どれ", "を", "使う"}, + {"wear", "どれ", "を", "身につける"}, + {"write on", "どれ", "に", "書く"}, + {"write with", "どれ", "を", "使って書く"}, + {"zap", "どれ", "を", "振りかざす"}, + {(void *)0, (void *)0}, +}; + +static struct trans_verb wield = + {"wield", "どれ", "を", (void *)0} +; + +static struct trans_verb dummyverb = + {(void *)0, "どれ", "を", (void *)0} +; + +struct trans_verb +*trans_verb(const char *en){ + struct trans_verb *list = trans_verb_list; + + if(!strcmp(en, wield.en)){ + wield.jp = body_part(HANDED); + return &wield; + } + + + while(list->en){ + if(!strcmp(en, list->en)){ + return list; + } + list++; + } + + dummyverb.en = en; + dummyverb.jp = en; + + return &dummyverb;; +} +#endif + /* * getobj returns: * struct obj *xxx: object to do something with. @@ -802,24 +858,14 @@ #if 1 /*JP*/ const char *jword; - const char *joshi = "を"; - const char *what = "どれ"; + const char *joshi; + const char *what; - if(!strcmp(word, "wield")){ - jword = body_part(HANDED); - } else { - jword = trans_verb(word); - } + struct trans_verb *tv = trans_verb(word); - if(!strncmp(jword, "に", 2)){ - jword += 2; - joshi = "に"; - } - else if(!strncmp(jword, "の", 2)){ - jword += 2; - joshi = "の"; - what = "ど"; - } + jword = tv->jp; + what = tv->what; + joshi = tv->particle; #endif if(*let == ALLOW_COUNT) let++, allowcnt = 1; #ifndef GOLDOBJ @@ -1278,12 +1324,12 @@ /* interactive version of getobj - used for Drop, Identify and */ /* Takeoff (A). Return the number of times fn was called successfully */ /* If combo is TRUE, we just use this to get a category list */ -/*JP CHECK: 3.4.1 の呼び出し元 -do.c:845: (result = ggetobj("置く", drop, 0, FALSE, (unsigned *)0)) < -1) -do.c:909: i = ggetobj("置く", drop, 0, TRUE, &ggoresults); -do_wear.c:2422: (result = ggetobj("の装備を解く", select_off, 0, FALSE, (unsigned *)0)) < -1) -do_wear.c:2475: if (ggetobj("の装備を解く", select_off, 0, TRUE, (unsigned *)0) == -2) -invent.c:1763: n = ggetobj("識別する", identify, id_limit, FALSE, (unsigned *)0); +/*JP CHECK: 3.4.3 の呼び出し元 +do.c:864: (result = ggetobj("drop", drop, 0, FALSE, (unsigned *)0)) < -1) +do.c:925: i = ggetobj("drop", drop, 0, TRUE, &ggoresults); +do_wear.c:2538: (result = ggetobj("take off", select_off, 0, FALSE, (unsigned *)0)) < -1) +do_wear.c:2586: if (ggetobj("take off", select_off, 0, TRUE, (unsigned *)0) == -2) +invent.c:1782: n = ggetobj("identify", identify, id_limit, FALSE, (unsigned *)0); */ int ggetobj(word, fn, mx, combo, resultflags) @@ -1306,23 +1352,16 @@ char buf[BUFSZ], qbuf[QBUFSZ]; #if 1 /*JP*/ const char *joshi = "を"; + const char *jword; - if(!strncmp(word, "に", 2)){ - word += 2; - joshi = "に"; - } - else if(!strncmp(word, "の", 2)){ - word += 2; - joshi = "の"; - } + const struct trans_verb *tv = trans_verb(word); + jword = tv->jp; + joshi = tv->particle; #endif if (resultflags) *resultflags = 0; #ifndef GOLDOBJ -/*JP allowgold = (u.ugold && !strcmp(word, "drop")) ? 1 : 0; -*/ - allowgold = (u.ugold && !strcmp(word, "置く")) ? 1 : 0; #endif takeoff = ident = allflag = m_seen = FALSE; #ifndef GOLDOBJ @@ -1333,17 +1372,14 @@ /*JP You("have nothing to %s.", word); */ - You("%sものは持っていない.", jcan(word)); + You("%sものは持っていない.", jcan(jword)); return(0); } add_valid_menu_class(0); /* reset */ if (taking_off(word)) { takeoff = TRUE; filter = is_worn; -/*JP } else if (!strcmp(word, "identify")) { -*/ - } else if (!strcmp(word, "識別する")) { ident = TRUE; filter = not_fully_identified; } @@ -1380,7 +1416,7 @@ word, ilets); #else Sprintf(qbuf,"どの種類のもの%s%sか?[%s]",joshi, - jconj(word,"ます"), ilets); + jconj(jword,"ます"), ilets); #endif getlin(qbuf, buf); if (buf[0] == '\033') return(0); @@ -1533,6 +1569,7 @@ invent.c:1512:ggetobj() int cnt = askchain(&invent, olets, allflag, fn, ckfn, mx, word); pickup.c:2615:("nodot") if (askchain((struct obj **)¤t_container->cobj, pickup.c:2711:("nodot") (void) askchain((struct obj **)&invent, + wordには動詞が英語で入る。 */ int askchain(objchn, olets, allflag, fn, ckfn, mx, word) @@ -1548,17 +1585,9 @@ char qbuf[QBUFSZ]; takeoff = taking_off(word); -/*JP ident = !strcmp(word, "identify"); -*/ - ident = !strcmp(word, "識別する"); -#if 0 /*JP*/ nodot = (!strcmp(word, "nodot") || !strcmp(word, "drop") || ident || takeoff); -#else - nodot = (!strcmp(word, "nodot") || !strcmp(word, "置く") || - ident || takeoff); -#endif ininv = (*objchn == invent); /* Changed so the askchain is interrogated in the order specified. * For example, if a person specifies =/ then first all rings will be @@ -1742,10 +1771,7 @@ n = 0; if (flags.menu_style == MENU_TRADITIONAL) do { -/*JP n = ggetobj("identify", identify, id_limit, FALSE, (unsigned *)0); -*/ - n = ggetobj("識別する", identify, id_limit, FALSE, (unsigned *)0); if (n < 0) break; /* quit or no eligible items */ } while ((id_limit -= n) > 0); if (n == 0 || n < -1)