• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision754bb2dc4ca3ebc413f6209bd987f0630ec76d6b (tree)
Time2019-06-12 21:01:44
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 english.c/h を作成して plural_aux() を分離.

Change Summary

Incremental Difference

--- a/Hengband_vcs2017/Hengband/Hengband.vcxproj
+++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj
@@ -155,6 +155,7 @@
155155 <ClCompile Include="..\..\src\creature.c" />
156156 <ClCompile Include="..\..\src\dungeon-file.c" />
157157 <ClCompile Include="..\..\src\dungeon.c" />
158+ <ClCompile Include="..\..\src\english.c" />
158159 <ClCompile Include="..\..\src\feature.c" />
159160 <ClCompile Include="..\..\src\floor-events.c" />
160161 <ClCompile Include="..\..\src\floor-generate.c" />
@@ -290,6 +291,7 @@
290291 <ClCompile Include="..\..\src\z-term.c" />
291292 <ClCompile Include="..\..\src\z-util.c" />
292293 <ClCompile Include="..\..\src\z-virt.c" />
294+ <ClInclude Include="..\..\src\english.h" />
293295 <ClInclude Include="japanese.h" />
294296 </ItemGroup>
295297 <ItemGroup>
--- a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
+++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
@@ -397,6 +397,9 @@
397397 <ClCompile Include="..\..\src\japanese.c">
398398 <Filter>locale</Filter>
399399 </ClCompile>
400+ <ClCompile Include="..\..\src\english.c">
401+ <Filter>locale</Filter>
402+ </ClCompile>
400403 </ItemGroup>
401404 <ItemGroup>
402405 <ClInclude Include="..\..\src\gamevalue.h" />
@@ -770,6 +773,9 @@
770773 <ClInclude Include="japanese.h">
771774 <Filter>locale</Filter>
772775 </ClInclude>
776+ <ClInclude Include="..\..\src\english.h">
777+ <Filter>locale</Filter>
778+ </ClInclude>
773779 </ItemGroup>
774780 <ItemGroup>
775781 <None Include="..\..\src\wall.bmp" />
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,7 +32,9 @@ hengband_SOURCES = \
3232 gameoption.c gameoption.h gamevalue.h \
3333 grid.c grid.h h-basic.h h-config.h h-define.h \
3434 history.h history.c \
35- h-system.h h-type.h inet.c inet.h init.c init.h japanese.c japanese.h load.c load.h \
35+ h-system.h h-type.h inet.c inet.h init.c init.h \
36+ japanese.c japanese.h english.c english.h \
37+ load.c load.h \
3638 dungeon-file.c dungeon-file.h \
3739 main.c main-x11.c main-gcu.c \
3840 melee.h melee1.c mind.c mind.h \
--- a/src/cmd-dump.c
+++ b/src/cmd-dump.c
@@ -81,6 +81,8 @@
8181 #include "realm.h"
8282 #include "view-mainwindow.h"
8383
84+#include "english.h"
85+
8486 /*
8587 * Mark strings for auto dump
8688 */
@@ -5564,131 +5566,6 @@ static void do_cmd_knowledge_skill_exp(void)
55645566
55655567
55665568 /*!
5567- * @brief 英単語、句、説を複数形を変換する / Pluralize a monster name
5568- * @param Name 変換したい文字列の参照ポインタ
5569- * @return なし
5570- */
5571-void plural_aux(char *Name)
5572-{
5573- int NameLen = strlen(Name);
5574-
5575- if (my_strstr(Name, "Disembodied hand"))
5576- {
5577- strcpy(Name, "Disembodied hands that strangled people");
5578- }
5579- else if (my_strstr(Name, "Colour out of space"))
5580- {
5581- strcpy(Name, "Colours out of space");
5582- }
5583- else if (my_strstr(Name, "stairway to hell"))
5584- {
5585- strcpy(Name, "stairways to hell");
5586- }
5587- else if (my_strstr(Name, "Dweller on the threshold"))
5588- {
5589- strcpy(Name, "Dwellers on the threshold");
5590- }
5591- else if (my_strstr(Name, " of "))
5592- {
5593- concptr aider = my_strstr(Name, " of ");
5594- char dummy[80];
5595- int i = 0;
5596- concptr ctr = Name;
5597-
5598- while (ctr < aider)
5599- {
5600- dummy[i] = *ctr;
5601- ctr++; i++;
5602- }
5603-
5604- if (dummy[i-1] == 's')
5605- {
5606- strcpy(&(dummy[i]), "es");
5607- i++;
5608- }
5609- else
5610- {
5611- strcpy(&(dummy[i]), "s");
5612- }
5613-
5614- strcpy(&(dummy[i+1]), aider);
5615- strcpy(Name, dummy);
5616- }
5617- else if (my_strstr(Name, "coins"))
5618- {
5619- char dummy[80];
5620- strcpy(dummy, "piles of ");
5621- strcat(dummy, Name);
5622- strcpy(Name, dummy);
5623- return;
5624- }
5625- else if (my_strstr(Name, "Manes"))
5626- {
5627- return;
5628- }
5629- else if (streq(&(Name[NameLen - 2]), "ey"))
5630- {
5631- strcpy(&(Name[NameLen - 2]), "eys");
5632- }
5633- else if (Name[NameLen - 1] == 'y')
5634- {
5635- strcpy(&(Name[NameLen - 1]), "ies");
5636- }
5637- else if (streq(&(Name[NameLen - 4]), "ouse"))
5638- {
5639- strcpy(&(Name[NameLen - 4]), "ice");
5640- }
5641- else if (streq(&(Name[NameLen - 2]), "us"))
5642- {
5643- strcpy(&(Name[NameLen - 2]), "i");
5644- }
5645- else if (streq(&(Name[NameLen - 6]), "kelman"))
5646- {
5647- strcpy(&(Name[NameLen - 6]), "kelmen");
5648- }
5649- else if (streq(&(Name[NameLen - 8]), "wordsman"))
5650- {
5651- strcpy(&(Name[NameLen - 8]), "wordsmen");
5652- }
5653- else if (streq(&(Name[NameLen - 7]), "oodsman"))
5654- {
5655- strcpy(&(Name[NameLen - 7]), "oodsmen");
5656- }
5657- else if (streq(&(Name[NameLen - 7]), "eastman"))
5658- {
5659- strcpy(&(Name[NameLen - 7]), "eastmen");
5660- }
5661- else if (streq(&(Name[NameLen - 8]), "izardman"))
5662- {
5663- strcpy(&(Name[NameLen - 8]), "izardmen");
5664- }
5665- else if (streq(&(Name[NameLen - 5]), "geist"))
5666- {
5667- strcpy(&(Name[NameLen - 5]), "geister");
5668- }
5669- else if (streq(&(Name[NameLen - 2]), "ex"))
5670- {
5671- strcpy(&(Name[NameLen - 2]), "ices");
5672- }
5673- else if (streq(&(Name[NameLen - 2]), "lf"))
5674- {
5675- strcpy(&(Name[NameLen - 2]), "lves");
5676- }
5677- else if (suffix(Name, "ch") ||
5678- suffix(Name, "sh") ||
5679- suffix(Name, "nx") ||
5680- suffix(Name, "s") ||
5681- suffix(Name, "o"))
5682- {
5683- strcpy(&(Name[NameLen]), "es");
5684- }
5685- else
5686- {
5687- strcpy(&(Name[NameLen]), "s");
5688- }
5689-}
5690-
5691-/*!
56925569 * @brief 現在のペットを表示するコマンドのメインルーチン /
56935570 * Display current pets
56945571 * @return なし
--- a/src/cmd-dump.h
+++ b/src/cmd-dump.h
@@ -70,7 +70,6 @@ extern void do_cmd_save_screen(void);
7070 extern void do_cmd_knowledge_quests_completed(FILE *fff, QUEST_IDX quest_num[]);
7171 extern void do_cmd_knowledge_quests_failed(FILE *fff, QUEST_IDX quest_num[]);
7272 extern void do_cmd_knowledge(void);
73-extern void plural_aux(char * Name);
7473 extern void do_cmd_checkquest(void);
7574 extern void do_cmd_time(void);
7675 extern void do_cmd_suicide(void);
--- /dev/null
+++ b/src/english.c
@@ -0,0 +1,130 @@
1+
2+#include "angband.h"
3+#include "util.h"
4+#include "japanese.h"
5+
6+
7+/*!
8+ * @brief 英単語、句、説を複数形を変換する / Pluralize a monster name
9+ * @param Name 変換したい文字列の参照ポインタ
10+ * @return なし
11+ */
12+void plural_aux(char *Name)
13+{
14+ int NameLen = strlen(Name);
15+
16+ if (my_strstr(Name, "Disembodied hand"))
17+ {
18+ strcpy(Name, "Disembodied hands that strangled people");
19+ }
20+ else if (my_strstr(Name, "Colour out of space"))
21+ {
22+ strcpy(Name, "Colours out of space");
23+ }
24+ else if (my_strstr(Name, "stairway to hell"))
25+ {
26+ strcpy(Name, "stairways to hell");
27+ }
28+ else if (my_strstr(Name, "Dweller on the threshold"))
29+ {
30+ strcpy(Name, "Dwellers on the threshold");
31+ }
32+ else if (my_strstr(Name, " of "))
33+ {
34+ concptr aider = my_strstr(Name, " of ");
35+ char dummy[80];
36+ int i = 0;
37+ concptr ctr = Name;
38+
39+ while (ctr < aider)
40+ {
41+ dummy[i] = *ctr;
42+ ctr++; i++;
43+ }
44+
45+ if (dummy[i - 1] == 's')
46+ {
47+ strcpy(&(dummy[i]), "es");
48+ i++;
49+ }
50+ else
51+ {
52+ strcpy(&(dummy[i]), "s");
53+ }
54+
55+ strcpy(&(dummy[i + 1]), aider);
56+ strcpy(Name, dummy);
57+ }
58+ else if (my_strstr(Name, "coins"))
59+ {
60+ char dummy[80];
61+ strcpy(dummy, "piles of ");
62+ strcat(dummy, Name);
63+ strcpy(Name, dummy);
64+ return;
65+ }
66+ else if (my_strstr(Name, "Manes"))
67+ {
68+ return;
69+ }
70+ else if (streq(&(Name[NameLen - 2]), "ey"))
71+ {
72+ strcpy(&(Name[NameLen - 2]), "eys");
73+ }
74+ else if (Name[NameLen - 1] == 'y')
75+ {
76+ strcpy(&(Name[NameLen - 1]), "ies");
77+ }
78+ else if (streq(&(Name[NameLen - 4]), "ouse"))
79+ {
80+ strcpy(&(Name[NameLen - 4]), "ice");
81+ }
82+ else if (streq(&(Name[NameLen - 2]), "us"))
83+ {
84+ strcpy(&(Name[NameLen - 2]), "i");
85+ }
86+ else if (streq(&(Name[NameLen - 6]), "kelman"))
87+ {
88+ strcpy(&(Name[NameLen - 6]), "kelmen");
89+ }
90+ else if (streq(&(Name[NameLen - 8]), "wordsman"))
91+ {
92+ strcpy(&(Name[NameLen - 8]), "wordsmen");
93+ }
94+ else if (streq(&(Name[NameLen - 7]), "oodsman"))
95+ {
96+ strcpy(&(Name[NameLen - 7]), "oodsmen");
97+ }
98+ else if (streq(&(Name[NameLen - 7]), "eastman"))
99+ {
100+ strcpy(&(Name[NameLen - 7]), "eastmen");
101+ }
102+ else if (streq(&(Name[NameLen - 8]), "izardman"))
103+ {
104+ strcpy(&(Name[NameLen - 8]), "izardmen");
105+ }
106+ else if (streq(&(Name[NameLen - 5]), "geist"))
107+ {
108+ strcpy(&(Name[NameLen - 5]), "geister");
109+ }
110+ else if (streq(&(Name[NameLen - 2]), "ex"))
111+ {
112+ strcpy(&(Name[NameLen - 2]), "ices");
113+ }
114+ else if (streq(&(Name[NameLen - 2]), "lf"))
115+ {
116+ strcpy(&(Name[NameLen - 2]), "lves");
117+ }
118+ else if (suffix(Name, "ch") ||
119+ suffix(Name, "sh") ||
120+ suffix(Name, "nx") ||
121+ suffix(Name, "s") ||
122+ suffix(Name, "o"))
123+ {
124+ strcpy(&(Name[NameLen]), "es");
125+ }
126+ else
127+ {
128+ strcpy(&(Name[NameLen]), "s");
129+ }
130+}
--- /dev/null
+++ b/src/english.h
@@ -0,0 +1,3 @@
1+#pragma once
2+
3+extern void plural_aux(char * Name);
--- a/src/monster1.c
+++ b/src/monster1.c
@@ -36,6 +36,7 @@
3636 #include "japanese.h"
3737 #include "view-mainwindow.h"
3838 #include "player-class.h"
39+#include "english.h"
3940
4041
4142 /*
--- a/src/quest.c
+++ b/src/quest.c
@@ -15,6 +15,7 @@
1515 #include "feature.h"
1616 #include "world.h"
1717 #include "cmd-dump.h"
18+#include "english.h"
1819
1920 quest_type *quest; /*!< Quest info */
2021 QUEST_IDX max_q_idx; /*!< Maximum number of quests */
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -54,6 +54,7 @@
5454 #include "monsterrace.h"
5555 #include "targeting.h"
5656 #include "realm-song.h"
57+#include "english.h"
5758
5859 /*!
5960 * @brief プレイヤー周辺の地形を感知する
--- a/src/util.h
+++ b/src/util.h
@@ -1,5 +1,7 @@
11 #pragma once
22
3+
4+
35 /*
46 * Hack -- allow use of "ASCII" and "EBCDIC" for "indexes", "digits",
57 * and "Control-Characters".
Show on old repository browser