Fandom

Wikihack

Source:NetHack 2.3e/u init.c

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Below is the full text to u_init.c from the source code of NetHack 2.3e. To link to a particular line, write [[NetHack 2.3e/u_init.c#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

Screenshots and source code from Hack are used under the CWI license.
1.    /*	SCCS Id: @(#)u_init.c	2.3	88/01/21
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    
4.    #include <stdio.h>
5.    #include <signal.h>
6.    #include "hack.h"
7.    #ifdef GENIX
8.    #define	void	int
9.    #endif
10.   
11.   #define Strcpy	(void) strcpy
12.   #define	Strcat	(void) strcat
13.   #define	UNDEF_TYP	0
14.   #define	UNDEF_SPE	'\177'
15.   extern struct obj *addinv();
16.   extern char *eos();
17.   extern char plname[];
18.   #define IS_MAGIC(x)	((x)->olet == WAND_SYM || (x)->olet == POTION_SYM || \
19.   			 (x)->olet == RING_SYM || (x)->olet == SCROLL_SYM || \
20.   			 (x)->olet == SPBOOK_SYM)
21.   
22.   struct you zerou;
23.   char pl_character[PL_CSIZ];
24.   char *(roles[]) = {	/* must all have distinct first letter */
25.   			/* roles[4] & [7] may be changed for females */
26.   	"Archeologist", "Tourist", "Barbarian", "Knight", "Cave-man",
27.   #ifdef NEWCLASS
28.   	"Samurai", "Ninja", "Priest",
29.   #endif
30.   #ifdef KAA
31.   	"Valkyrie", "Elf", "Healer",
32.   #endif
33.   	"Wizard"
34.   };
35.   #define	NR_OF_ROLES	SIZE(roles)
36.   char rolesyms[NR_OF_ROLES + 1];		/* filled by u_init() */
37.   
38.   struct trobj {
39.   	unsigned short trotyp;
40.   	schar trspe;
41.   	char trolet;
42.   	Bitfield(trquan,6);
43.   	Bitfield(trknown,1);
44.   };
45.   
46.   #ifdef WIZARD
47.   struct trobj Extra_objs[] = {
48.   	{ 0, 0, 0, 0, 0 },
49.   	{ 0, 0, 0, 0, 0 }
50.   };
51.   #endif
52.   
53.   struct trobj Cave_man[] = {
54.   #define C_ARROWS	2
55.   	{ CLUB, 1, WEAPON_SYM, 1, 1 },
56.   	{ BOW, 1, WEAPON_SYM, 1, 1 },
57.   	{ ARROW, 0, WEAPON_SYM, 25, 1 },	/* quan is variable */
58.   	{ LEATHER_ARMOR, 0, ARMOR_SYM, 1, 1 },
59.   	{ 0, 0, 0, 0, 0}
60.   };
61.   
62.   struct trobj Barbarian[] = {
63.   	{ TWO_HANDED_SWORD, 0, WEAPON_SYM, 1, 1 },
64.   	{ RING_MAIL, 0, ARMOR_SYM, 1, 1 },
65.   	{ 0, 0, 0, 0, 0 }
66.   };
67.   
68.   struct trobj Knight[] = {
69.   	{ LONG_SWORD, 0, WEAPON_SYM, 1, 1 },
70.   	{ SPEAR, 2, WEAPON_SYM, 1, 1 },
71.   	{ RING_MAIL, 1, ARMOR_SYM, 1, 1 },
72.   	{ HELMET, 0, ARMOR_SYM, 1, 1 },
73.   	{ SHIELD, 0, ARMOR_SYM, 1, 1 },
74.   	{ PAIR_OF_GLOVES, 0, ARMOR_SYM, 1, 1 },
75.   	{ 0, 0, 0, 0, 0 }
76.   };
77.   
78.   #ifdef KAA
79.   struct trobj Elf[] = {
80.   #define E_ARROWS	2
81.   #define E_ARMOR		3
82.   	{ SHORT_SWORD, 0, WEAPON_SYM, 1, 1 },
83.   	{ BOW, 0, WEAPON_SYM, 1, 1 },
84.   	{ ARROW, 0, WEAPON_SYM, 25, 1 },
85.   	{ UNDEF_TYP, 0, ARMOR_SYM, 1, 1 },
86.   	{ 0, 0, 0, 0, 0 }
87.   };
88.   
89.   struct trobj Valkyrie[] = {
90.   	{ LONG_SWORD, 1, WEAPON_SYM, 1, 1 },
91.   	{ SHIELD, 3, ARMOR_SYM, 1, 1 },
92.   	{ FOOD_RATION, 0, FOOD_SYM, 1, 1 },
93.   	{ 0, 0, 0, 0, 0 }
94.   };
95.   
96.   struct trobj Healer[] = {
97.   	{ STETHOSCOPE, 0, TOOL_SYM, 1, 0 },
98.   	{ POT_HEALING, 0, POTION_SYM, 4, 1 },
99.   	{ POT_EXTRA_HEALING, 0, POTION_SYM, 4, 1 },
100.  	{ APPLE, 0, FOOD_SYM, 5, 0 },
101.  	{ 0, 0, 0, 0, 0}
102.  };
103.  #endif /* KAA /**/
104.  
105.  struct trobj Archeologist[] = {
106.  	{ STUDDED_LEATHER_ARMOR, 0, ARMOR_SYM, 1, 1 },
107.  	{ UNDEF_TYP, 0, POTION_SYM, 2, 0 },
108.  	{ FOOD_RATION, 0, FOOD_SYM, 3, 1 },
109.  	{ PICK_AXE, UNDEF_SPE, TOOL_SYM, 1, 0 },
110.  	{ ICE_BOX, 0, TOOL_SYM, 1, 0 },
111.  	{ 0, 0, 0, 0, 0}
112.  };
113.  
114.  struct trobj Tinopener[] = {
115.  	{ CAN_OPENER, 0, TOOL_SYM, 1, 1 },
116.  	{ 0, 0, 0, 0, 0 }
117.  };
118.  
119.  #ifdef MARKER
120.  struct trobj Magicmarker[] = {
121.  	{ MAGIC_MARKER, 50, TOOL_SYM, 1, 0 },
122.  	{ 0, 0, 0, 0, 0 }
123.  };
124.  #endif
125.  
126.  struct trobj Lamp[] = {
127.  	{ LAMP, 5, TOOL_SYM, 1, 0 },
128.  	{ 0, 0, 0, 0, 0 }
129.  };
130.  
131.  #ifdef WALKIES
132.  struct trobj Leash[] = {
133.  	{ LEASH, 0, TOOL_SYM, 1, 0 },
134.  	{ 0, 0, 0, 0, 0 }
135.  };
136.  #endif
137.  
138.  struct trobj Blindfold[] = {
139.  	{ BLINDFOLD, 0, TOOL_SYM, 1, 0 },
140.  	{ 0, 0, 0, 0, 0 }
141.  };
142.  
143.  struct trobj Tourist[] = {
144.  #define	T_DARTS		3
145.  	{ UNDEF_TYP, 0, FOOD_SYM, 10, 1 },
146.  	{ POT_EXTRA_HEALING, 0, POTION_SYM, 2, 0 },
147.  	{ EXPENSIVE_CAMERA, 0, TOOL_SYM, 1, 1 },
148.  	{ DART, 2, WEAPON_SYM, 25, 1 },	/* quan is variable */
149.  #ifdef SHIRT
150.  	{ HAWAIIAN_SHIRT, 0, ARMOR_SYM, 1, 1 },
151.  #endif
152.  	{ 0, 0, 0, 0, 0 }
153.  };
154.  
155.  struct trobj Wizard[] = {
156.  #define W_MULTSTART	2
157.  #define W_MULTEND	6
158.  	{ ELVEN_CLOAK, 0, ARMOR_SYM, 1, 1 },
159.  	{ DAGGER, 0, WEAPON_SYM, 1, 1 },	/* for dealing with ghosts */
160.  	{ UNDEF_TYP, UNDEF_SPE, WAND_SYM, 2, 1 },
161.  	{ UNDEF_TYP, UNDEF_SPE, RING_SYM, 2, 1 },
162.  	{ UNDEF_TYP, UNDEF_SPE, POTION_SYM, 2, 1 },
163.  	{ UNDEF_TYP, UNDEF_SPE, SCROLL_SYM, 3, 1 },
164.  #ifdef SPELLS
165.  	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_SYM, 3, 1 },
166.  #endif
167.  	{ 0, 0, 0, 0, 0 }
168.  };
169.  
170.  #ifdef NEWCLASS
171.  struct	trobj	Samurai[] = {
172.  #define S_ARROWS	3
173.  	{ KATANA, 0, WEAPON_SYM, 1, 1 },
174.  	{ SHORT_SWORD, 0, WEAPON_SYM, 1, 1 },	/* the wakizashi */
175.  	{ BOW,    1, WEAPON_SYM, 1, 1 },
176.  	{ ARROW,  0, WEAPON_SYM, 25, 1 },	/* quan is variable */
177.  	{ SPLINT_MAIL, 0, ARMOR_SYM, 1, 1},
178.  	{ 0, 0, 0, 0, 0 }
179.  };
180.  
181.  struct	trobj	Ninja[] = {
182.  #define N_SHURIKEN	1
183.  	{ KATANA, 0, WEAPON_SYM, 1, 1 },
184.  	{ SHURIKEN, 0, WEAPON_SYM, 25, 1 },	/* quan is variable */
185.  	{ LEATHER_ARMOR, 1, ARMOR_SYM, 1, 1},
186.  	{ 0, 0, 0, 0, 0 }
187.  };
188.  
189.  struct	trobj	Priest[] = {
190.  	{ CHAIN_MAIL, 0, ARMOR_SYM, 1, 1 },
191.  	{ SHIELD, 0, ARMOR_SYM, 1, 1 },
192.  	{ MACE, 1, WEAPON_SYM, 1, 1 },
193.  	{ POT_HOLY_WATER, 0, POTION_SYM, 4, 1 },
194.  #ifdef SPELLS
195.  	{ UNDEF_TYP, UNDEF_SPE, SPBOOK_SYM, 2, 0 },
196.  #endif
197.  	{ 0, 0, 0, 0, 0 }
198.  };
199.  #endif /* NEWCLASS /**/
200.  
201.  u_init(){
202.  register int i;
203.  char exper = 'y', pc;
204.  extern char readchar();
205.  	if(flags.female)  {	/* should have been set in HACKOPTIONS */
206.  		roles[4] = "Cave-woman";
207.  #ifdef NEWCLASS
208.  		roles[7] = "Priestess";
209.  #endif
210.  	}
211.  	for(i = 0; i < NR_OF_ROLES; i++)
212.  		rolesyms[i] = roles[i][0];
213.  	rolesyms[i] = 0;
214.  
215.  	if(pc = pl_character[0]) {
216.  		if('a' <= pc && pc <= 'z') pc += 'A'-'a';
217.  		if((i = role_index(pc)) >= 0)
218.  			goto got_suffix;	/* implies experienced */
219.  		printf("\nUnknown role: %c\n", pc);
220.  		pl_character[0] = pc = 0;
221.  	}
222.  
223.  	printf("\nShall I pick a character for you (yes, no, or quit) ? [ynq] ");
224.  
225.  	while(!index("yYnNqQ", (exper = readchar())))	bell();
226.  
227.  	printf("%c\n", exper);		/* echo */
228.  
229.  	if (index("qQ", exper)) {
230.  		clearlocks();
231.  		settty((char *) 0);
232.  		exit(0);
233.  	}
234.  
235.  	if(index("Yy", exper)) {
236.  		exper = 0;
237.  		goto beginner;
238.  	}
239.  
240.  	printf("\n Tell me what kind of character you are:\n");
241.  	printf(" Are you");
242.  	for(i = 0; i < NR_OF_ROLES; i++) {
243.  		printf(" %s %s", index("AEIOU",roles[i][0]) ? "an" : "a", roles[i]);
244.  		if((((i + 1) % 4) == 0) && (i != NR_OF_ROLES -1)) printf(",\n        ");
245.  		else if(i < NR_OF_ROLES - 2)	printf(",");
246.  		if(i == NR_OF_ROLES - 2)	printf(" or");
247.  	}
248.  	printf("? [%s or q(quit)] ", rolesyms);
249.  
250.  	while(pc = readchar()) {
251.  		if (pc == 'q' || pc == 'Q') {
252.  
253.  			clearlocks();
254.  			settty((char *) 0);
255.  			exit(0);
256.  		}
257.  		if('a' <= pc && pc <= 'z') pc += 'A'-'a';
258.  		if((i = role_index(pc)) >= 0) {
259.  			printf("%c\n", pc);	/* echo */
260.  			(void) fflush(stdout);	/* should be seen */
261.  			break;
262.  		}
263.  		if(pc == '\n') break;
264.  		bell();
265.  	}
266.  	if(pc == '\n')	pc = 0;
267.  
268.  beginner:
269.  	if(!pc) {
270.  		i = rn2(NR_OF_ROLES);
271.  		pc = rolesyms[i];
272.  		printf("\nThis game you will be %s %s%s.\n",
273.  			(exper || index("AEIOU", roles[i][0])) ? "an" : "a",
274.  			exper ? "experienced " : "", roles[i]);
275.  		getret();
276.  		/* give him some feedback in case mklev takes much time */
277.  		(void) putchar('\n');
278.  		(void) fflush(stdout);
279.  	}
280.  	if(exper) {
281.  		roles[i][0] = pc;
282.  	}
283.  
284.  got_suffix:
285.  
286.  	(void) strncpy(pl_character, roles[i], PL_CSIZ-1);
287.  	pl_character[PL_CSIZ-1] = 0;
288.  	flags.beginner = 1;
289.  	u = zerou;
290.  	u.usym = '@';
291.  	u.ulevel = 1;
292.  	u.uluck  = 0;
293.  	init_uhunger();
294.  	uarm = uarm2 = uarmh = uarms = uarmg = uwep =
295.  #ifdef SHIRT
296.  	uarmu =
297.  #endif
298.  	uball = uchain = uleft = uright = 0;
299.  
300.  #ifdef SPELLS
301.  	u.uen = u.uenmax = 1;
302.  	for (i = 0; i <= MAXSPELL; i++) spl_book[i].sp_id = NO_SPELL;
303.  #endif
304.  #ifdef PRAYERS
305.  	u.ublesscnt = 300;			/* no prayers just yet */
306.  	u.ublessed = 0;				/* not worthy yet */
307.  	u.ugangr   = 0;				/* gods not angry */
308.  #endif
309.  #ifdef HARD
310.  	u.udemigod = u.udg_cnt = 0;		/* not a demi-god yet... */
311.  #endif
312.  #ifdef KAA
313.  	u.mh = u.mhmax = u.umonnum = u.mtimedone = 0;
314.  #endif
315.  #ifdef QUEST
316.  	u.uhorizon = 6;
317.  #endif
318.  	switch(pc) {
319.  	case 'c':
320.  	case 'C':
321.  		Cave_man[C_ARROWS].trquan = 12 + rnd(9)*rnd(9);
322.  		u.uhp = u.uhpmax = 16;
323.  		u.ustr = u.ustrmax = 18;
324.  		ini_inv(Cave_man);
325.  		break;
326.  	case 't':
327.  	case 'T':
328.  #ifdef KAA
329.  		objects[POT_EXTRA_HEALING].oc_name_known=1;
330.  #endif
331.  		Tourist[T_DARTS].trquan = 20 + rnd(20);
332.  		u.ugold = u.ugold0 = rnd(1000);
333.  		u.uhp = u.uhpmax = 10;
334.  		u.ustr = u.ustrmax = 8;
335.  		ini_inv(Tourist);
336.  		if(!rn2(25)) ini_inv(Tinopener);
337.  		else if(!rn2(4)) ini_inv(Lamp);
338.  #ifdef MARKER
339.  		else if(!rn2(25)) ini_inv(Magicmarker);
340.  #endif
341.  #ifdef WALKIES
342.  		else if(!rn2(25)) ini_inv(Leash);
343.  #endif
344.  		break;
345.  	case 'w':
346.  	case 'W':
347.  		for(i = W_MULTSTART; i <= W_MULTEND; i++)
348.  		    if(!rn2(5))
349.  			Wizard[i].trquan += rn2(3) - 1;
350.  		u.uhp = u.uhpmax = 15;
351.  		u.ustr = u.ustrmax = 16;
352.  #ifdef SPELLS
353.  		u.uen = u.uenmax += rn2(4);
354.  #endif
355.  		ini_inv(Wizard);
356.  #ifdef MARKER
357.  		if(!rn2(5)) ini_inv(Magicmarker);
358.  #endif
359.  		if(!rn2(5)) ini_inv(Blindfold);
360.  		break;
361.  	case 'a':
362.  	case 'A':
363.  		Fast = INTRINSIC;
364.  		Stealth = INTRINSIC;
365.  		u.uhp = u.uhpmax = 12;
366.  		u.ustr = u.ustrmax = 10;
367.  		ini_inv(Archeologist);
368.  		if(!rn2(10)) ini_inv(Tinopener);
369.  #ifdef MARKER
370.  		else if(!rn2(10)) ini_inv(Magicmarker);
371.  #endif
372.  		break;
373.  #ifdef KAA
374.  	case 'e':
375.  	case 'E':
376.  		Elf[E_ARROWS].trquan = 15+rnd(20);
377.  		Elf[E_ARMOR].trotyp = (rn2(2) ? ELFIN_CHAIN_MAIL : ELVEN_CLOAK);
378.  		Fast = INTRINSIC;
379.  		HSee_invisible = INTRINSIC;
380.  		u.uhp = u.uhpmax = 16;
381.  		u.ustr = u.ustrmax = 16;
382.  		ini_inv(Elf);
383.  		if(!rn2(5)) ini_inv(Blindfold);
384.  		else if(!rn2(6)) ini_inv(Lamp);
385.  		break;
386.  	case 'v':
387.  	case 'V':
388.  		Stealth = INTRINSIC;
389.  		HCold_resistance = INTRINSIC;
390.  		flags.female = TRUE;
391.  		u.uhp = u.uhpmax = 16;
392.  		u.ustr = u.ustrmax = 17;
393.  		ini_inv(Valkyrie);
394.  		if(!rn2(6)) ini_inv(Lamp);
395.  		break;
396.  	case 'h':
397.  	case 'H':
398.  		objects[POT_HEALING].oc_name_known=1;
399.  		objects[POT_EXTRA_HEALING].oc_name_known=1;
400.  		HPoison_resistance = INTRINSIC;
401.  		u.uhp = u.uhpmax = 16;
402.  		u.ustr = u.ustrmax = 15;
403.  		ini_inv(Healer);
404.  		if(!rn2(25)) ini_inv(Lamp);
405.  		break;
406.  #endif
407.  	case 'k':
408.  	case 'K':
409.  		u.uhp = u.uhpmax = 12;
410.  		u.ustr = u.ustrmax = 10;
411.  		ini_inv(Knight);
412.  		break;
413.  	case 'b':
414.  	case 'B':
415.  		u.uhp = u.uhpmax = 14;
416.  		u.ustr = u.ustrmax = 17;
417.  		ini_inv(Barbarian);
418.  		if(!rn2(6)) ini_inv(Lamp);
419.  		break;
420.  #ifdef NEWCLASS
421.  	case 's':
422.  	case 'S':
423.  		Fast = INTRINSIC;
424.  		u.uhp = u.uhpmax = 16;
425.  		u.ustr = u.ustrmax = 16;
426.  		Samurai[S_ARROWS].trquan = 12 + rnd(9)*rnd(9);
427.  		ini_inv(Samurai);
428.  		break;
429.  	case 'n':
430.  	case 'N':
431.  		Fast = INTRINSIC;
432.  		Stealth = INTRINSIC;
433.  		u.uhp = u.uhpmax = 15;
434.  		u.ustr = u.ustrmax = 10;
435.  		Ninja[N_SHURIKEN].trquan = 12 + rnd(9)*rnd(9);
436.  		ini_inv(Ninja);
437.  		if(!rn2(5)) ini_inv(Blindfold);
438.  		break;
439.  	case 'p':
440.  	case 'P':
441.  		u.uhp = u.uhpmax = 13;
442.  		u.ustr = u.ustrmax = 15;
443.  # ifdef SPELLS
444.  		u.uen = u.uenmax += rn2(4);
445.  # endif
446.  		ini_inv(Priest);
447.  # ifdef KAA
448.  		uwep->dknown = 1;	/* bless his primary weapon */
449.  # endif
450.  # ifdef MARKER
451.  		if(!rn2(10)) ini_inv(Magicmarker);
452.  # endif
453.  		else if(!rn2(10)) ini_inv(Lamp);
454.  		objects[POT_HOLY_WATER].oc_name_known = 1;
455.  		break;
456.  #endif /* NEWCLASS /**/
457.  	default:	/* impossible */
458.  		u.uhp = u.uhpmax = 12;
459.  		u.ustr = u.ustrmax = 16;
460.  	}
461.  	find_ac();
462.  	if(!rn2(20)) {
463.  		register int d = rn2(7) - 2;	/* biased variation */
464.  		u.ustr += d;
465.  		u.ustrmax += d;
466.  	}
467.  
468.  #ifdef WIZARD
469.  	wiz_inv();
470.  #endif
471.  	/* make sure he can carry all he has - especially for T's */
472.  	while(inv_weight() > 0 && u.ustr < 118)
473.  		u.ustr++, u.ustrmax++;
474.  }
475.  
476.  ini_inv(trop) register struct trobj *trop; {
477.  register struct obj *obj;
478.  extern struct obj *mkobj();
479.  	while(trop->trolet) {
480.  		obj = mkobj(trop->trolet);
481.  		obj->known = trop->trknown;
482.  		/* not obj->dknown = 1; - let him look at it at least once */
483.  		obj->cursed = 0;
484.  		if(obj->olet == WEAPON_SYM){
485.  			obj->quan = trop->trquan;
486.  			trop->trquan = 1;
487.  		}
488.  		if(trop->trspe != UNDEF_SPE)
489.  			obj->spe = trop->trspe;
490.  		if(trop->trotyp != UNDEF_TYP)
491.  			obj->otyp = trop->trotyp;
492.  		else
493.  			if(obj->otyp == WAN_WISHING)	/* gitpyr!robert */
494.  				obj->otyp = WAN_DEATH;
495.  		obj->owt = weight(obj);	/* defined after setting otyp+quan */
496.  		obj = addinv(obj);
497.  
498.  		/*
499.  		 * if a magic item's 'known' bit is on, set its name known
500.  		 */
501.  		if (IS_MAGIC(obj) && obj->known)
502.  		    objects[obj->otyp].oc_name_known=1;
503.  
504.  		if(obj->olet == ARMOR_SYM){
505.  			switch(obj->otyp){
506.  			case SHIELD:
507.  				if(!uarms) setworn(obj, W_ARMS);
508.  				break;
509.  			case HELMET:
510.  				if(!uarmh) setworn(obj, W_ARMH);
511.  				break;
512.  			case PAIR_OF_GLOVES:
513.  				if(!uarmg) setworn(obj, W_ARMG);
514.  				break;
515.  #ifdef SHIRT
516.  			case HAWAIIAN_SHIRT:
517.  				if(!uarmu) setworn(obj, W_ARMU);
518.  				break;
519.  #endif
520.  			case ELVEN_CLOAK:
521.  				if(!uarm2)
522.  					setworn(obj, W_ARM);
523.  				break;
524.  			default:
525.  				if(!uarm) setworn(obj, W_ARM);
526.  			}
527.  		}
528.  		/* below changed by GAN 01/09/87 to allow wielding of
529.  		 * pick-axe or can-opener if there is no weapon
530.  		 */
531.  		if(obj->olet == WEAPON_SYM || obj->otyp == PICK_AXE ||
532.  		   obj->otyp == CAN_OPENER)
533.  			if(!uwep) setuwep(obj);
534.  #ifndef PYRAMID_BUG
535.  		if(--trop->trquan) continue;	/* make a similar object */
536.  #else
537.  		if(trop->trquan) {		/* check if zero first */
538.  			--trop->trquan;
539.  			if(trop->trquan)
540.  				continue;	/* make a similar object */
541.  		}
542.  #endif
543.  		trop++;
544.  	}
545.  }
546.  
547.  #ifdef WIZARD
548.  wiz_inv(){
549.  register struct trobj *trop = &Extra_objs[0];
550.  extern char *getenv();
551.  register char *ep = getenv("INVENT");
552.  register int type;
553.  	while(ep && *ep) {
554.  		type = atoi(ep);
555.  		ep = index(ep, ',');
556.  		if(ep) while(*ep == ',' || *ep == ' ') ep++;
557.  		if(type <= 0 || type > NROFOBJECTS) continue;
558.  		trop->trotyp = type;
559.  		trop->trolet = objects[type].oc_olet;
560.  		trop->trspe = 4;
561.  		trop->trknown = 1;
562.  		trop->trquan = 1;
563.  		ini_inv(trop);
564.  	}
565.  }
566.  #endif /* WIZARD /**/
567.  
568.  plnamesuffix() {
569.  register char *p;
570.  	if(p = rindex(plname, '-')) {
571.  		*p = 0;
572.  		pl_character[0] = p[1];
573.  		pl_character[1] = 0;
574.  		if(!plname[0]) {
575.  			askname();
576.  			plnamesuffix();
577.  		}
578.  	}
579.  }
580.  
581.  role_index(pc)
582.  char pc;
583.  {		/* must be called only from u_init() */
584.  		/* so that rolesyms[] is defined */
585.  	register char *cp;
586.  
587.  	if(cp = index(rolesyms, pc))
588.  		return(cp - rolesyms);
589.  	return(-1);
590.  }

Also on Fandom

Random Wiki