1 /* $OpenBSD: hack.shknam.c,v 1.7 2003/07/06 02:07:45 avsm 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 #ifndef lint 65 static const char rcsid[] = "$OpenBSD: hack.shknam.c,v 1.7 2003/07/06 02:07:45 avsm Exp $"; 66 #endif /* not lint */ 67 68 #include "hack.h" 69 70 char *shkliquors[] = { 71 /* Ukraine */ 72 "Njezjin", "Tsjernigof", "Gomel", "Ossipewsk", "Gorlowka", 73 /* N. Russia */ 74 "Konosja", "Weliki Oestjoeg", "Syktywkar", "Sablja", 75 "Narodnaja", "Kyzyl", 76 /* Silezie */ 77 "Walbrzych", "Swidnica", "Klodzko", "Raciborz", "Gliwice", 78 "Brzeg", "Krnov", "Hradec Kralove", 79 /* Schweiz */ 80 "Leuk", "Brig", "Brienz", "Thun", "Sarnen", "Burglen", "Elm", 81 "Flims", "Vals", "Schuls", "Zum Loch", 82 0 83 }; 84 85 char *shkbooks[] = { 86 /* Eire */ 87 "Skibbereen", "Kanturk", "Rath Luirc", "Ennistymon", "Lahinch", 88 "Loughrea", "Croagh", "Maumakeogh", "Ballyjamesduff", 89 "Kinnegad", "Lugnaquillia", "Enniscorthy", "Gweebarra", 90 "Kittamagh", "Nenagh", "Sneem", "Ballingeary", "Kilgarvan", 91 "Cahersiveen", "Glenbeigh", "Kilmihil", "Kiltamagh", 92 "Droichead Atha", "Inniscrone", "Clonegal", "Lisnaskea", 93 "Culdaff", "Dunfanaghy", "Inishbofin", "Kesh", 94 0 95 }; 96 97 char *shkarmors[] = { 98 /* Turquie */ 99 "Demirci", "Kalecik", "Boyabai", "Yildizeli", "Gaziantep", 100 "Siirt", "Akhalataki", "Tirebolu", "Aksaray", "Ermenak", 101 "Iskenderun", "Kadirli", "Siverek", "Pervari", "Malasgirt", 102 "Bayburt", "Ayancik", "Zonguldak", "Balya", "Tefenni", 103 "Artvin", "Kars", "Makharadze", "Malazgirt", "Midyat", 104 "Birecik", "Kirikkale", "Alaca", "Polatli", "Nallihan", 105 0 106 }; 107 108 char *shkwands[] = { 109 /* Wales */ 110 "Yr Wyddgrug", "Trallwng", "Mallwyd", "Pontarfynach", 111 "Rhaeader", "Llandrindod", "Llanfair-ym-muallt", 112 "Y-Fenni", "Measteg", "Rhydaman", "Beddgelert", 113 "Curig", "Llanrwst", "Llanerchymedd", "Caergybi", 114 /* Scotland */ 115 "Nairn", "Turriff", "Inverurie", "Braemar", "Lochnagar", 116 "Kerloch", "Beinn a Ghlo", "Drumnadrochit", "Morven", 117 "Uist", "Storr", "Sgurr na Ciche", "Cannich", "Gairloch", 118 "Kyleakin", "Dunvegan", 119 0 120 }; 121 122 char *shkrings[] = { 123 /* Hollandse familienamen */ 124 "Feyfer", "Flugi", "Gheel", "Havic", "Haynin", "Hoboken", 125 "Imbyze", "Juyn", "Kinsky", "Massis", "Matray", "Moy", 126 "Olycan", "Sadelin", "Svaving", "Tapper", "Terwen", "Wirix", 127 "Ypey", 128 /* Skandinaviske navne */ 129 "Rastegaisa", "Varjag Njarga", "Kautekeino", "Abisko", 130 "Enontekis", "Rovaniemi", "Avasaksa", "Haparanda", 131 "Lulea", "Gellivare", "Oeloe", "Kajaani", "Fauske", 132 0 133 }; 134 135 char *shkfoods[] = { 136 /* Indonesia */ 137 "Djasinga", "Tjibarusa", "Tjiwidej", "Pengalengan", 138 "Bandjar", "Parbalingga", "Bojolali", "Sarangan", 139 "Ngebel", "Djombang", "Ardjawinangun", "Berbek", 140 "Papar", "Baliga", "Tjisolok", "Siboga", "Banjoewangi", 141 "Trenggalek", "Karangkobar", "Njalindoeng", "Pasawahan", 142 "Pameunpeuk", "Patjitan", "Kediri", "Pemboeang", "Tringanoe", 143 "Makin", "Tipor", "Semai", "Berhala", "Tegal", "Samoe", 144 0 145 }; 146 147 char *shkweapons[] = { 148 /* Perigord */ 149 "Voulgezac", "Rouffiac", "Lerignac", "Touverac", "Guizengeard", 150 "Melac", "Neuvicq", "Vanzac", "Picq", "Urignac", "Corignac", 151 "Fleac", "Lonzac", "Vergt", "Queyssac", "Liorac", "Echourgnac", 152 "Cazelon", "Eypau", "Carignan", "Monbazillac", "Jonzac", 153 "Pons", "Jumilhac", "Fenouilledes", "Laguiolet", "Saujon", 154 "Eymoutiers", "Eygurande", "Eauze", "Labouheyre", 155 0 156 }; 157 158 char *shkgeneral[] = { 159 /* Suriname */ 160 "Hebiwerie", "Possogroenoe", "Asidonhopo", "Manlobbi", 161 "Adjama", "Pakka Pakka", "Kabalebo", "Wonotobo", 162 "Akalapi", "Sipaliwini", 163 /* Greenland */ 164 "Annootok", "Upernavik", "Angmagssalik", 165 /* N. Canada */ 166 "Aklavik", "Inuvik", "Tuktoyaktuk", 167 "Chicoutimi", "Ouiatchouane", "Chibougamau", 168 "Matagami", "Kipawa", "Kinojevis", 169 "Abitibi", "Maganasipi", 170 /* Iceland */ 171 "Akureyri", "Kopasker", "Budereyri", "Akranes", "Bordeyri", 172 "Holmavik", 173 0 174 }; 175 176 struct shk_nx { 177 char x; 178 char **xn; 179 } shk_nx[] = { 180 { POTION_SYM, shkliquors }, 181 { SCROLL_SYM, shkbooks }, 182 { ARMOR_SYM, shkarmors }, 183 { WAND_SYM, shkwands }, 184 { RING_SYM, shkrings }, 185 { FOOD_SYM, shkfoods }, 186 { WEAPON_SYM, shkweapons }, 187 { 0, shkgeneral } 188 }; 189 190 void 191 findname(char *nampt, size_t len, char let) 192 { 193 struct shk_nx *p = shk_nx; 194 char **q; 195 int i; 196 197 while(p->x && p->x != let) p++; 198 q = p->xn; 199 for(i=0; i<dlevel; i++) if(!q[i]){ 200 /* Not enough names, try general name */ 201 if(let) findname(nampt, len, 0); 202 else { 203 (void) strlcpy(nampt, "Dirk", len); 204 } 205 return; 206 } 207 (void) strncpy(nampt, q[i], len-1); 208 nampt[len-1] = '\0'; 209 } 210