1 /* $NetBSD: hack.shknam.c,v 1.8 2012/06/19 05:46:08 dholland Exp $ */
2
3 /*
4 * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
5 * Amsterdam
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * - Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * - Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * - Neither the name of the Stichting Centrum voor Wiskunde en
20 * Informatica, nor the names of its contributors may be used to endorse or
21 * promote products derived from this software without specific prior
22 * written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
25 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
27 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
28 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37 /*
38 * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
39 * All rights reserved.
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
43 * are met:
44 * 1. Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * 2. Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in the
48 * documentation and/or other materials provided with the distribution.
49 * 3. The name of the author may not be used to endorse or promote products
50 * derived from this software without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
53 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
54 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
55 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
56 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
57 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
58 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
59 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
60 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
61 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 */
63
64 #include "hack.h"
65 #include "extern.h"
66
67 static const char *const shkliquors[] = {
68 /* Ukraine */
69 "Njezjin", "Tsjernigof", "Gomel", "Ossipewsk", "Gorlowka",
70 /* N. Russia */
71 "Konosja", "Weliki Oestjoeg", "Syktywkar", "Sablja",
72 "Narodnaja", "Kyzyl",
73 /* Silezie */
74 "Walbrzych", "Swidnica", "Klodzko", "Raciborz", "Gliwice",
75 "Brzeg", "Krnov", "Hradec Kralove",
76 /* Schweiz */
77 "Leuk", "Brig", "Brienz", "Thun", "Sarnen", "Burglen", "Elm",
78 "Flims", "Vals", "Schuls", "Zum Loch",
79 0
80 };
81
82 static const char *const shkbooks[] = {
83 /* Eire */
84 "Skibbereen", "Kanturk", "Rath Luirc", "Ennistymon", "Lahinch",
85 "Loughrea", "Croagh", "Maumakeogh", "Ballyjamesduff",
86 "Kinnegad", "Lugnaquillia", "Enniscorthy", "Gweebarra",
87 "Kittamagh", "Nenagh", "Sneem", "Ballingeary", "Kilgarvan",
88 "Cahersiveen", "Glenbeigh", "Kilmihil", "Kiltamagh",
89 "Droichead Atha", "Inniscrone", "Clonegal", "Lisnaskea",
90 "Culdaff", "Dunfanaghy", "Inishbofin", "Kesh",
91 0
92 };
93
94 static const char *const shkarmors[] = {
95 /* Turquie */
96 "Demirci", "Kalecik", "Boyabai", "Yildizeli", "Gaziantep",
97 "Siirt", "Akhalataki", "Tirebolu", "Aksaray", "Ermenak",
98 "Iskenderun", "Kadirli", "Siverek", "Pervari", "Malasgirt",
99 "Bayburt", "Ayancik", "Zonguldak", "Balya", "Tefenni",
100 "Artvin", "Kars", "Makharadze", "Malazgirt", "Midyat",
101 "Birecik", "Kirikkale", "Alaca", "Polatli", "Nallihan",
102 0
103 };
104
105 static const char *const shkwands[] = {
106 /* Wales */
107 "Yr Wyddgrug", "Trallwng", "Mallwyd", "Pontarfynach",
108 "Rhaeader", "Llandrindod", "Llanfair-ym-muallt",
109 "Y-Fenni", "Measteg", "Rhydaman", "Beddgelert",
110 "Curig", "Llanrwst", "Llanerchymedd", "Caergybi",
111 /* Scotland */
112 "Nairn", "Turriff", "Inverurie", "Braemar", "Lochnagar",
113 "Kerloch", "Beinn a Ghlo", "Drumnadrochit", "Morven",
114 "Uist", "Storr", "Sgurr na Ciche", "Cannich", "Gairloch",
115 "Kyleakin", "Dunvegan",
116 0
117 };
118
119 static const char *const shkrings[] = {
120 /* Hollandse familienamen */
121 "Feyfer", "Flugi", "Gheel", "Havic", "Haynin", "Hoboken",
122 "Imbyze", "Juyn", "Kinsky", "Massis", "Matray", "Moy",
123 "Olycan", "Sadelin", "Svaving", "Tapper", "Terwen", "Wirix",
124 "Ypey",
125 /* Skandinaviske navne */
126 "Rastegaisa", "Varjag Njarga", "Kautekeino", "Abisko",
127 "Enontekis", "Rovaniemi", "Avasaksa", "Haparanda",
128 "Lulea", "Gellivare", "Oeloe", "Kajaani", "Fauske",
129 0
130 };
131
132 static const char *const shkfoods[] = {
133 /* Indonesia */
134 "Djasinga", "Tjibarusa", "Tjiwidej", "Pengalengan",
135 "Bandjar", "Parbalingga", "Bojolali", "Sarangan",
136 "Ngebel", "Djombang", "Ardjawinangun", "Berbek",
137 "Papar", "Baliga", "Tjisolok", "Siboga", "Banjoewangi",
138 "Trenggalek", "Karangkobar", "Njalindoeng", "Pasawahan",
139 "Pameunpeuk", "Patjitan", "Kediri", "Pemboeang", "Tringanoe",
140 "Makin", "Tipor", "Semai", "Berhala", "Tegal", "Samoe",
141 0
142 };
143
144 static const char *const shkweapons[] = {
145 /* Perigord */
146 "Voulgezac", "Rouffiac", "Lerignac", "Touverac", "Guizengeard",
147 "Melac", "Neuvicq", "Vanzac", "Picq", "Urignac", "Corignac",
148 "Fleac", "Lonzac", "Vergt", "Queyssac", "Liorac", "Echourgnac",
149 "Cazelon", "Eypau", "Carignan", "Monbazillac", "Jonzac",
150 "Pons", "Jumilhac", "Fenouilledes", "Laguiolet", "Saujon",
151 "Eymoutiers", "Eygurande", "Eauze", "Labouheyre",
152 0
153 };
154
155 static const char *const shkgeneral[] = {
156 /* Suriname */
157 "Hebiwerie", "Possogroenoe", "Asidonhopo", "Manlobbi",
158 "Adjama", "Pakka Pakka", "Kabalebo", "Wonotobo",
159 "Akalapi", "Sipaliwini",
160 /* Greenland */
161 "Annootok", "Upernavik", "Angmagssalik",
162 /* N. Canada */
163 "Aklavik", "Inuvik", "Tuktoyaktuk",
164 "Chicoutimi", "Ouiatchouane", "Chibougamau",
165 "Matagami", "Kipawa", "Kinojevis",
166 "Abitibi", "Maganasipi",
167 /* Iceland */
168 "Akureyri", "Kopasker", "Budereyri", "Akranes", "Bordeyri",
169 "Holmavik",
170 0
171 };
172
173 static const struct shk_nx {
174 char x;
175 const char *const *xn;
176 } shk_nx[] = {
177 {
178 POTION_SYM, shkliquors
179 },
180 {
181 SCROLL_SYM, shkbooks
182 },
183 {
184 ARMOR_SYM, shkarmors
185 },
186 {
187 WAND_SYM, shkwands
188 },
189 {
190 RING_SYM, shkrings
191 },
192 {
193 FOOD_SYM, shkfoods
194 },
195 {
196 WEAPON_SYM, shkweapons
197 },
198 {
199 0, shkgeneral
200 }
201 };
202
203 void
findname(char * nampt,int let_i)204 findname(char *nampt, int let_i)
205 {
206 const struct shk_nx *p = shk_nx;
207 const char *const *q;
208 int i;
209 char let;
210
211 /* truncate to "char" width */
212 let = let_i;
213
214 while (p->x && p->x != let)
215 p++;
216 q = p->xn;
217 for (i = 0; i < dlevel; i++)
218 if (!q[i]) {
219 /* Not enough names, try general name */
220 if (let)
221 findname(nampt, 0);
222 else
223 (void) strcpy(nampt, "Dirk");
224 return;
225 }
226 (void) strncpy(nampt, q[i], PL_NSIZ);
227 nampt[PL_NSIZ - 1] = 0;
228 }
229