1*813e3e41Sdholland /* $NetBSD: hack.u_init.c,v 1.13 2011/08/06 19:32:58 dholland Exp $ */
23ea4a95cSchristos
3210cab45Smycroft /*
41c7f94e5Sjsm * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
51c7f94e5Sjsm * Amsterdam
61c7f94e5Sjsm * All rights reserved.
71c7f94e5Sjsm *
81c7f94e5Sjsm * Redistribution and use in source and binary forms, with or without
91c7f94e5Sjsm * modification, are permitted provided that the following conditions are
101c7f94e5Sjsm * met:
111c7f94e5Sjsm *
121c7f94e5Sjsm * - Redistributions of source code must retain the above copyright notice,
131c7f94e5Sjsm * this list of conditions and the following disclaimer.
141c7f94e5Sjsm *
151c7f94e5Sjsm * - Redistributions in binary form must reproduce the above copyright
161c7f94e5Sjsm * notice, this list of conditions and the following disclaimer in the
171c7f94e5Sjsm * documentation and/or other materials provided with the distribution.
181c7f94e5Sjsm *
191c7f94e5Sjsm * - Neither the name of the Stichting Centrum voor Wiskunde en
201c7f94e5Sjsm * Informatica, nor the names of its contributors may be used to endorse or
211c7f94e5Sjsm * promote products derived from this software without specific prior
221c7f94e5Sjsm * written permission.
231c7f94e5Sjsm *
241c7f94e5Sjsm * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
251c7f94e5Sjsm * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
261c7f94e5Sjsm * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
271c7f94e5Sjsm * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
281c7f94e5Sjsm * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
291c7f94e5Sjsm * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
301c7f94e5Sjsm * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
311c7f94e5Sjsm * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
321c7f94e5Sjsm * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
331c7f94e5Sjsm * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
341c7f94e5Sjsm * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
351c7f94e5Sjsm */
361c7f94e5Sjsm
371c7f94e5Sjsm /*
381c7f94e5Sjsm * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
391c7f94e5Sjsm * All rights reserved.
401c7f94e5Sjsm *
411c7f94e5Sjsm * Redistribution and use in source and binary forms, with or without
421c7f94e5Sjsm * modification, are permitted provided that the following conditions
431c7f94e5Sjsm * are met:
441c7f94e5Sjsm * 1. Redistributions of source code must retain the above copyright
451c7f94e5Sjsm * notice, this list of conditions and the following disclaimer.
461c7f94e5Sjsm * 2. Redistributions in binary form must reproduce the above copyright
471c7f94e5Sjsm * notice, this list of conditions and the following disclaimer in the
481c7f94e5Sjsm * documentation and/or other materials provided with the distribution.
491c7f94e5Sjsm * 3. The name of the author may not be used to endorse or promote products
501c7f94e5Sjsm * derived from this software without specific prior written permission.
511c7f94e5Sjsm *
521c7f94e5Sjsm * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
531c7f94e5Sjsm * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
541c7f94e5Sjsm * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
551c7f94e5Sjsm * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
561c7f94e5Sjsm * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
571c7f94e5Sjsm * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
581c7f94e5Sjsm * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
591c7f94e5Sjsm * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
601c7f94e5Sjsm * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
611c7f94e5Sjsm * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62210cab45Smycroft */
63210cab45Smycroft
643ea4a95cSchristos #include <sys/cdefs.h>
65210cab45Smycroft #ifndef lint
66*813e3e41Sdholland __RCSID("$NetBSD: hack.u_init.c,v 1.13 2011/08/06 19:32:58 dholland Exp $");
67210cab45Smycroft #endif /* not lint */
6861f28255Scgd
693ea4a95cSchristos #include <ctype.h>
7061f28255Scgd #include <signal.h>
713ea4a95cSchristos #include <stdlib.h>
723ea4a95cSchristos #include "hack.h"
733ea4a95cSchristos #include "extern.h"
743ea4a95cSchristos
7561f28255Scgd #define Strcpy (void) strcpy
7661f28255Scgd #define Strcat (void) strcat
7761f28255Scgd #define UNDEF_TYP 0
7861f28255Scgd #define UNDEF_SPE '\177'
7961f28255Scgd
8061f28255Scgd char pl_character[PL_CSIZ];
819b92b189Sdholland
829b92b189Sdholland static const struct you zerou;
839b92b189Sdholland static const char *(roles[]) = { /* must all have distinct first letter */
84047e0042Smycroft /* roles[4] may be changed to -woman */
8561f28255Scgd "Tourist", "Speleologist", "Fighter", "Knight",
8661f28255Scgd "Cave-man", "Wizard"
8761f28255Scgd };
8861f28255Scgd #define NR_OF_ROLES SIZE(roles)
899b92b189Sdholland static char rolesyms[NR_OF_ROLES + 1]; /* filled by u_init() */
9061f28255Scgd
9161f28255Scgd struct trobj {
9261f28255Scgd uchar trotyp;
9361f28255Scgd schar trspe;
9461f28255Scgd char trolet;
9561f28255Scgd Bitfield(trquan, 6);
9661f28255Scgd Bitfield(trknown, 1);
9761f28255Scgd };
9861f28255Scgd
9961f28255Scgd #ifdef WIZARD
1009b92b189Sdholland static struct trobj Extra_objs[] = {
10161f28255Scgd {0, 0, 0, 0, 0},
10261f28255Scgd {0, 0, 0, 0, 0}
10361f28255Scgd };
1043ea4a95cSchristos #endif /* WIZARD */
10561f28255Scgd
1069b92b189Sdholland static struct trobj Cave_man[] = {
10761f28255Scgd {MACE, 1, WEAPON_SYM, 1, 1},
10861f28255Scgd {BOW, 1, WEAPON_SYM, 1, 1},
10961f28255Scgd {ARROW, 0, WEAPON_SYM, 25, 1}, /* quan is variable */
11061f28255Scgd {LEATHER_ARMOR, 0, ARMOR_SYM, 1, 1},
11161f28255Scgd {0, 0, 0, 0, 0}
11261f28255Scgd };
11361f28255Scgd
1149b92b189Sdholland static struct trobj Fighter[] = {
11561f28255Scgd {TWO_HANDED_SWORD, 0, WEAPON_SYM, 1, 1},
11661f28255Scgd {RING_MAIL, 0, ARMOR_SYM, 1, 1},
11761f28255Scgd {0, 0, 0, 0, 0}
11861f28255Scgd };
11961f28255Scgd
1209b92b189Sdholland static struct trobj Knight[] = {
12161f28255Scgd {LONG_SWORD, 0, WEAPON_SYM, 1, 1},
12261f28255Scgd {SPEAR, 2, WEAPON_SYM, 1, 1},
12361f28255Scgd {RING_MAIL, 1, ARMOR_SYM, 1, 1},
12461f28255Scgd {HELMET, 0, ARMOR_SYM, 1, 1},
12561f28255Scgd {SHIELD, 0, ARMOR_SYM, 1, 1},
12661f28255Scgd {PAIR_OF_GLOVES, 0, ARMOR_SYM, 1, 1},
12761f28255Scgd {0, 0, 0, 0, 0}
12861f28255Scgd };
12961f28255Scgd
1309b92b189Sdholland static struct trobj Speleologist[] = {
13161f28255Scgd {STUDDED_LEATHER_ARMOR, 0, ARMOR_SYM, 1, 1},
13261f28255Scgd {UNDEF_TYP, 0, POTION_SYM, 2, 0},
13361f28255Scgd {FOOD_RATION, 0, FOOD_SYM, 3, 1},
13461f28255Scgd {PICK_AXE, UNDEF_SPE, TOOL_SYM, 1, 0},
13561f28255Scgd {ICE_BOX, 0, TOOL_SYM, 1, 0},
13661f28255Scgd {0, 0, 0, 0, 0}
13761f28255Scgd };
13861f28255Scgd
1399b92b189Sdholland static struct trobj Tinopener[] = {
14061f28255Scgd {CAN_OPENER, 0, TOOL_SYM, 1, 1},
14161f28255Scgd {0, 0, 0, 0, 0}
14261f28255Scgd };
14361f28255Scgd
1449b92b189Sdholland static struct trobj Tourist[] = {
14561f28255Scgd {UNDEF_TYP, 0, FOOD_SYM, 10, 1},
14661f28255Scgd {POT_EXTRA_HEALING, 0, POTION_SYM, 2, 0},
14761f28255Scgd {EXPENSIVE_CAMERA, 0, TOOL_SYM, 1, 1},
14861f28255Scgd {DART, 2, WEAPON_SYM, 25, 1}, /* quan is variable */
14961f28255Scgd {0, 0, 0, 0, 0}
15061f28255Scgd };
15161f28255Scgd
1529b92b189Sdholland static struct trobj Wizard[] = {
15361f28255Scgd {ELVEN_CLOAK, 0, ARMOR_SYM, 1, 1},
15461f28255Scgd {UNDEF_TYP, UNDEF_SPE, WAND_SYM, 2, 0},
15561f28255Scgd {UNDEF_TYP, UNDEF_SPE, RING_SYM, 2, 0},
15661f28255Scgd {UNDEF_TYP, UNDEF_SPE, POTION_SYM, 2, 0},
15761f28255Scgd {UNDEF_TYP, UNDEF_SPE, SCROLL_SYM, 3, 0},
15861f28255Scgd {0, 0, 0, 0, 0}
15961f28255Scgd };
16061f28255Scgd
1619b92b189Sdholland static void ini_inv(struct trobj *);
1629b92b189Sdholland static void wiz_inv(void);
1639b92b189Sdholland static int role_index(int);
1649b92b189Sdholland
1653ea4a95cSchristos void
u_init(void)1661fa8a9a6Sdholland u_init(void)
1673ea4a95cSchristos {
1683ea4a95cSchristos int i;
16961f28255Scgd char exper = 'y', pc;
17061f28255Scgd if (flags.female) /* should have been set in HACKOPTIONS */
17161f28255Scgd roles[4] = "Cave-woman";
17261f28255Scgd for (i = 0; i < NR_OF_ROLES; i++)
17361f28255Scgd rolesyms[i] = roles[i][0];
17461f28255Scgd rolesyms[i] = 0;
17561f28255Scgd
1763ea4a95cSchristos if ((pc = pl_character[0]) != '\0') {
17749f7d8a9Sdsl if (islower((unsigned char)pc))
17849f7d8a9Sdsl pc = toupper((unsigned char)pc);
17961f28255Scgd if ((i = role_index(pc)) >= 0)
18061f28255Scgd goto got_suffix; /* implies experienced */
18161f28255Scgd printf("\nUnknown role: %c\n", pc);
18261f28255Scgd pl_character[0] = pc = 0;
18361f28255Scgd }
18461f28255Scgd printf("\nAre you an experienced player? [ny] ");
18561f28255Scgd
1863ea4a95cSchristos while (!strchr("ynYN \n\004", (exper = readchar())))
18798eb8895Sroy sound_bell();
18861f28255Scgd if (exper == '\004') /* Give him an opportunity to get out */
18961f28255Scgd end_of_input();
19061f28255Scgd printf("%c\n", exper); /* echo */
1913ea4a95cSchristos if (strchr("Nn \n", exper)) {
19261f28255Scgd exper = 0;
19361f28255Scgd goto beginner;
19461f28255Scgd }
19561f28255Scgd printf("\nTell me what kind of character you are:\n");
19661f28255Scgd printf("Are you");
19761f28255Scgd for (i = 0; i < NR_OF_ROLES; i++) {
19861f28255Scgd printf(" a %s", roles[i]);
19961f28255Scgd if (i == 2) /* %% */
20061f28255Scgd printf(",\n\t");
20161f28255Scgd else if (i < NR_OF_ROLES - 2)
20261f28255Scgd printf(",");
20361f28255Scgd else if (i == NR_OF_ROLES - 2)
20461f28255Scgd printf(" or");
20561f28255Scgd }
20661f28255Scgd printf("? [%s] ", rolesyms);
20761f28255Scgd
2083ea4a95cSchristos while ((pc = readchar()) != '\0') {
20949f7d8a9Sdsl if (islower((unsigned char)pc))
21049f7d8a9Sdsl pc = toupper((unsigned char)pc);
21161f28255Scgd if ((i = role_index(pc)) >= 0) {
21261f28255Scgd printf("%c\n", pc); /* echo */
21361f28255Scgd (void) fflush(stdout); /* should be seen */
21461f28255Scgd break;
21561f28255Scgd }
21661f28255Scgd if (pc == '\n')
21761f28255Scgd break;
2183ea4a95cSchristos if (pc == '\004') /* Give him the opportunity to get
2193ea4a95cSchristos * out */
22061f28255Scgd end_of_input();
22198eb8895Sroy sound_bell();
22261f28255Scgd }
22361f28255Scgd if (pc == '\n')
22461f28255Scgd pc = 0;
22561f28255Scgd
22661f28255Scgd beginner:
22761f28255Scgd if (!pc) {
22861f28255Scgd printf("\nI'll choose a character for you.\n");
22961f28255Scgd i = rn2(NR_OF_ROLES);
23061f28255Scgd pc = rolesyms[i];
23161f28255Scgd printf("This game you will be a%s %s.\n",
23261f28255Scgd exper ? "n experienced" : "",
23361f28255Scgd roles[i]);
23461f28255Scgd getret();
23561f28255Scgd /* give him some feedback in case mklev takes much time */
23661f28255Scgd (void) putchar('\n');
23761f28255Scgd (void) fflush(stdout);
23861f28255Scgd }
239047e0042Smycroft #if 0
2403ea4a95cSchristos /*
2413ea4a95cSchristos * Given the above code, I can't see why this would ever change
2423ea4a95cSchristos * anything; it does core pretty well, though. - cmh 4/20/93
2433ea4a95cSchristos */
24461f28255Scgd if (exper) {
24561f28255Scgd roles[i][0] = pc;
24661f28255Scgd }
247047e0042Smycroft #endif
24861f28255Scgd
24961f28255Scgd got_suffix:
25061f28255Scgd
25161f28255Scgd (void) strncpy(pl_character, roles[i], PL_CSIZ - 1);
25261f28255Scgd pl_character[PL_CSIZ - 1] = 0;
25361f28255Scgd flags.beginner = 1;
25461f28255Scgd u = zerou;
25561f28255Scgd u.usym = '@';
25661f28255Scgd u.ulevel = 1;
25761f28255Scgd init_uhunger();
25861f28255Scgd #ifdef QUEST
25961f28255Scgd u.uhorizon = 6;
2603ea4a95cSchristos #endif /* QUEST */
26161f28255Scgd uarm = uarm2 = uarmh = uarms = uarmg = uwep = uball = uchain =
26261f28255Scgd uleft = uright = 0;
26361f28255Scgd
26461f28255Scgd switch (pc) {
26561f28255Scgd case 'c':
26661f28255Scgd case 'C':
26761f28255Scgd Cave_man[2].trquan = 12 + rnd(9) * rnd(9);
26861f28255Scgd u.uhp = u.uhpmax = 16;
26961f28255Scgd u.ustr = u.ustrmax = 18;
27061f28255Scgd ini_inv(Cave_man);
27161f28255Scgd break;
27261f28255Scgd case 't':
27361f28255Scgd case 'T':
27461f28255Scgd Tourist[3].trquan = 20 + rnd(20);
27561f28255Scgd u.ugold = u.ugold0 = rnd(1000);
27661f28255Scgd u.uhp = u.uhpmax = 10;
27761f28255Scgd u.ustr = u.ustrmax = 8;
27861f28255Scgd ini_inv(Tourist);
2793ea4a95cSchristos if (!rn2(25))
2803ea4a95cSchristos ini_inv(Tinopener);
28161f28255Scgd break;
28261f28255Scgd case 'w':
28361f28255Scgd case 'W':
2843ea4a95cSchristos for (i = 1; i <= 4; i++)
2853ea4a95cSchristos if (!rn2(5))
28661f28255Scgd Wizard[i].trquan += rn2(3) - 1;
28761f28255Scgd u.uhp = u.uhpmax = 15;
28861f28255Scgd u.ustr = u.ustrmax = 16;
28961f28255Scgd ini_inv(Wizard);
29061f28255Scgd break;
29161f28255Scgd case 's':
29261f28255Scgd case 'S':
29361f28255Scgd Fast = INTRINSIC;
29461f28255Scgd Stealth = INTRINSIC;
29561f28255Scgd u.uhp = u.uhpmax = 12;
29661f28255Scgd u.ustr = u.ustrmax = 10;
29761f28255Scgd ini_inv(Speleologist);
2983ea4a95cSchristos if (!rn2(10))
2993ea4a95cSchristos ini_inv(Tinopener);
30061f28255Scgd break;
30161f28255Scgd case 'k':
30261f28255Scgd case 'K':
30361f28255Scgd u.uhp = u.uhpmax = 12;
30461f28255Scgd u.ustr = u.ustrmax = 10;
30561f28255Scgd ini_inv(Knight);
30661f28255Scgd break;
30761f28255Scgd case 'f':
30861f28255Scgd case 'F':
30961f28255Scgd u.uhp = u.uhpmax = 14;
31061f28255Scgd u.ustr = u.ustrmax = 17;
31161f28255Scgd ini_inv(Fighter);
31261f28255Scgd break;
31361f28255Scgd default: /* impossible */
31461f28255Scgd u.uhp = u.uhpmax = 12;
31561f28255Scgd u.ustr = u.ustrmax = 16;
31661f28255Scgd }
31761f28255Scgd find_ac();
31861f28255Scgd if (!rn2(20)) {
3193c439f43Sdholland int dr = rn2(7) - 2; /* biased variation */
3203c439f43Sdholland u.ustr += dr;
3213c439f43Sdholland u.ustrmax += dr;
32261f28255Scgd }
32361f28255Scgd #ifdef WIZARD
3243ea4a95cSchristos if (wizard)
3253ea4a95cSchristos wiz_inv();
3263ea4a95cSchristos #endif /* WIZARD */
32761f28255Scgd
32861f28255Scgd /* make sure he can carry all he has - especially for T's */
32961f28255Scgd while (inv_weight() > 0 && u.ustr < 118)
33061f28255Scgd u.ustr++, u.ustrmax++;
33161f28255Scgd }
33261f28255Scgd
3333ea4a95cSchristos void
ini_inv(struct trobj * trop)3341fa8a9a6Sdholland ini_inv(struct trobj *trop)
3353ea4a95cSchristos {
3363ea4a95cSchristos struct obj *obj;
33761f28255Scgd while (trop->trolet) {
33861f28255Scgd obj = mkobj(trop->trolet);
33961f28255Scgd obj->known = trop->trknown;
34061f28255Scgd /* not obj->dknown = 1; - let him look at it at least once */
34161f28255Scgd obj->cursed = 0;
34261f28255Scgd if (obj->olet == WEAPON_SYM) {
34361f28255Scgd obj->quan = trop->trquan;
34461f28255Scgd trop->trquan = 1;
34561f28255Scgd }
34661f28255Scgd if (trop->trspe != UNDEF_SPE)
34761f28255Scgd obj->spe = trop->trspe;
34861f28255Scgd if (trop->trotyp != UNDEF_TYP)
34961f28255Scgd obj->otyp = trop->trotyp;
3503ea4a95cSchristos else if (obj->otyp == WAN_WISHING) /* gitpyr!robert */
35161f28255Scgd obj->otyp = WAN_DEATH;
35261f28255Scgd obj->owt = weight(obj); /* defined after setting otyp+quan */
35361f28255Scgd obj = addinv(obj);
35461f28255Scgd if (obj->olet == ARMOR_SYM) {
35561f28255Scgd switch (obj->otyp) {
35661f28255Scgd case SHIELD:
3573ea4a95cSchristos if (!uarms)
3583ea4a95cSchristos setworn(obj, W_ARMS);
35961f28255Scgd break;
36061f28255Scgd case HELMET:
3613ea4a95cSchristos if (!uarmh)
3623ea4a95cSchristos setworn(obj, W_ARMH);
36361f28255Scgd break;
36461f28255Scgd case PAIR_OF_GLOVES:
3653ea4a95cSchristos if (!uarmg)
3663ea4a95cSchristos setworn(obj, W_ARMG);
36761f28255Scgd break;
36861f28255Scgd case ELVEN_CLOAK:
36961f28255Scgd if (!uarm2)
37061f28255Scgd setworn(obj, W_ARM);
37161f28255Scgd break;
37261f28255Scgd default:
3733ea4a95cSchristos if (!uarm)
3743ea4a95cSchristos setworn(obj, W_ARM);
37561f28255Scgd }
37661f28255Scgd }
37761f28255Scgd if (obj->olet == WEAPON_SYM)
3783ea4a95cSchristos if (!uwep)
3793ea4a95cSchristos setuwep(obj);
3803ea4a95cSchristos if (--trop->trquan)
3813ea4a95cSchristos continue; /* make a similar object */
38261f28255Scgd trop++;
38361f28255Scgd }
38461f28255Scgd }
38561f28255Scgd
38661f28255Scgd #ifdef WIZARD
3873ea4a95cSchristos void
wiz_inv(void)3881fa8a9a6Sdholland wiz_inv(void)
3893ea4a95cSchristos {
3903ea4a95cSchristos struct trobj *trop = &Extra_objs[0];
3913ea4a95cSchristos char *ep = getenv("INVENT");
3923ea4a95cSchristos int type;
39361f28255Scgd while (ep && *ep) {
39461f28255Scgd type = atoi(ep);
3953ea4a95cSchristos ep = strchr(ep, ',');
3963ea4a95cSchristos if (ep)
3973ea4a95cSchristos while (*ep == ',' || *ep == ' ')
3983ea4a95cSchristos ep++;
3993ea4a95cSchristos if (type <= 0 || type > NROFOBJECTS)
4003ea4a95cSchristos continue;
40161f28255Scgd trop->trotyp = type;
40261f28255Scgd trop->trolet = objects[type].oc_olet;
40361f28255Scgd trop->trspe = 4;
40461f28255Scgd trop->trknown = 1;
40561f28255Scgd trop->trquan = 1;
40661f28255Scgd ini_inv(trop);
40761f28255Scgd }
40861f28255Scgd /* give him a wand of wishing by default */
40961f28255Scgd trop->trotyp = WAN_WISHING;
41061f28255Scgd trop->trolet = WAND_SYM;
41161f28255Scgd trop->trspe = 20;
41261f28255Scgd trop->trknown = 1;
41361f28255Scgd trop->trquan = 1;
41461f28255Scgd ini_inv(trop);
41561f28255Scgd }
4163ea4a95cSchristos #endif /* WIZARD */
41761f28255Scgd
4183ea4a95cSchristos void
plnamesuffix(void)4191fa8a9a6Sdholland plnamesuffix(void)
4203ea4a95cSchristos {
4213ea4a95cSchristos char *p;
4223ea4a95cSchristos if ((p = strrchr(plname, '-')) != NULL) {
42361f28255Scgd *p = 0;
42461f28255Scgd pl_character[0] = p[1];
42561f28255Scgd pl_character[1] = 0;
42661f28255Scgd if (!plname[0]) {
42761f28255Scgd askname();
42861f28255Scgd plnamesuffix();
42961f28255Scgd }
43061f28255Scgd }
43161f28255Scgd }
43261f28255Scgd
4333ea4a95cSchristos int
role_index(int pc)4341fa8a9a6Sdholland role_index(int pc)
43561f28255Scgd { /* must be called only from u_init() */
43661f28255Scgd /* so that rolesyms[] is defined */
4373ea4a95cSchristos char *cp;
43861f28255Scgd
4393ea4a95cSchristos if ((cp = strchr(rolesyms, pc)) != NULL)
44061f28255Scgd return (cp - rolesyms);
44161f28255Scgd return (-1);
44261f28255Scgd }
443