Subject: Re: possible bug in "larn" in NetBSD 1.0A
To: None <mike@virtual.cuc.ab.ca, netbsd-bugs@NetBSD.ORG>
From: Charles Hannum <mycroft@NetBSD.ORG>
List: netbsd-bugs
Date: 10/21/1994 14:21:27
This should fix your problem with larn(6), as well as a couple of
others.

===================================================================
RCS file: /b/source/CVS/src/games/larn/diag.c,v
retrieving revision 1.3
diff -c -2 -r1.3 diag.c
*** 1.3	1993/08/02 17:19:58
--- diag.c	1994/10/21 19:23:36
***************
*** 83,89 ****
  
  	lprcat("\n\nHere's the list of available potions:\n\n");
! 	for (i=0; i<MAXPOTION; i++)	lprintf("%20s\n",&potionname[i][1]);
  	lprcat("\n\nHere's the list of available scrolls:\n\n");
! 	for (i=0; i<MAXSCROLL; i++)	lprintf("%20s\n",&scrollname[i][1]);
  	lprcat("\n\nHere's the spell list:\n\n");
  	lprcat("spell          name           description\n");
--- 83,89 ----
  
  	lprcat("\n\nHere's the list of available potions:\n\n");
! 	for (i=0; i<MAXPOTION; i++)	lprintf("%20s\n",&potionhide[i][1]);
  	lprcat("\n\nHere's the list of available scrolls:\n\n");
! 	for (i=0; i<MAXSCROLL; i++)	lprintf("%20s\n",&scrollhide[i][1]);
  	lprcat("\n\nHere's the spell list:\n\n");
  	lprcat("spell          name           description\n");
===================================================================
RCS file: /b/source/CVS/src/games/larn/header.h,v
retrieving revision 1.3
diff -c -2 -r1.3 header.h
*** 1.3	1993/08/02 17:20:03
--- header.h	1994/10/21 19:37:02
***************
*** 49,53 ****
  	{
  	short	price;
- 	char	**mem;
  	char	obj;
  	char	arg;
--- 49,52 ----
===================================================================
RCS file: /b/source/CVS/src/games/larn/main.c,v
retrieving revision 1.3
diff -c -2 -r1.3 main.c
*** 1.3	1993/08/02 17:20:07
--- main.c	1994/10/21 21:18:04
***************
*** 439,445 ****
  	register char *str2[];
  	{
! 	if (str2==0)  lprintf("\n%c)   %s",idx+'a',objectname[iven[idx]]);
! 	else if (*str2[ivenarg[idx]]==0)  lprintf("\n%c)   %s",idx+'a',objectname[iven[idx]]);
! 	else lprintf("\n%c)   %s of%s",idx+'a',objectname[iven[idx]],str2[ivenarg[idx]]);
  	}
  
--- 439,444 ----
  	register char *str2[];
  	{
! 	lprintf("\n%c)   %s",idx+'a',objectname[iven[idx]]);
! 	if (str2!=0 && str2[ivenarg[idx]][0]!=0)  lprintf(" of%s",str2[ivenarg[idx]]);
  	}
  
===================================================================
RCS file: /b/source/CVS/src/games/larn/object.c,v
retrieving revision 1.3
diff -c -2 -r1.3 object.c
*** 1.3	1993/08/02 17:20:16
--- object.c	1994/10/21 21:17:00
***************
*** 27,35 ****
  	case OPOTION:	lprcat("\n\nYou have found a magic potion");
  				i = iarg[playerx][playery];
! 				if (potionname[i][0]) lprintf(" of %s",&potionname[i][1]);  opotion(i);  break;
  
  	case OSCROLL:	lprcat("\n\nYou have found a magic scroll");
  				i = iarg[playerx][playery];
! 				if (scrollname[i][0])	lprintf(" of %s",&scrollname[i][1]);
  				oscroll(i);  break;
  
--- 27,36 ----
  	case OPOTION:	lprcat("\n\nYou have found a magic potion");
  				i = iarg[playerx][playery];
! 				if (potionname[i][0]!=0)	lprintf(" of%s", potionname[i]);
! 				opotion(i);  break;
  
  	case OSCROLL:	lprcat("\n\nYou have found a magic scroll");
  				i = iarg[playerx][playery];
! 				if (scrollname[i][0]!=0)	lprintf(" of%s", scrollname[i]);
  				oscroll(i);  break;
  
===================================================================
RCS file: /b/source/CVS/src/games/larn/pathnames.h,v
retrieving revision 1.2
diff -c -2 -r1.2 pathnames.h
*** 1.2	1993/08/01 18:54:15
--- pathnames.h	1994/10/21 19:04:39
***************
*** 40,42 ****
  #define	_PATH_LEVELS		"/usr/share/games/larn/larnmaze"
  #define	_PATH_FORTS		"/usr/share/games/larn/lfortune"
! #define	_PATH_PLAYERIDS		"/usr/share/games/larn/playerids"
--- 40,42 ----
  #define	_PATH_LEVELS		"/usr/share/games/larn/larnmaze"
  #define	_PATH_FORTS		"/usr/share/games/larn/lfortune"
! #define	_PATH_PLAYERIDS		"/var/games/larn/playerids"
===================================================================
RCS file: /b/source/CVS/src/games/larn/store.c,v
retrieving revision 1.2
diff -c -2 -r1.2 store.c
*** 1.2	1993/08/01 18:54:12
--- store.c	1994/10/21 21:15:29
***************
*** 44,161 ****
  int maxitm=83;	/* number of items in the dnd inventory table	*/
  struct _itm itm[90] = {
! /*cost	  memory 	iven name	iven arg   how
!   gp	 pointer	  iven[]	ivenarg[]  many */
  
! { 2,		0,		OLEATHER,		0,		3	},
! { 10,		0,		OSTUDLEATHER,	0,		2	},
! { 40,		0,		ORING,			0,		2	},
! { 85,		0,		OCHAIN,			0,		2	},
! { 220,		0,		OSPLINT,		0,		1	},
! { 400,		0,		OPLATE,			0,		1	},
! { 900,		0,		OPLATEARMOR,	0,		1	},
! { 2600,		0,		OSSPLATE,		0,		1	},
! { 150,		0,		OSHIELD,		0,		1	},
! 
! /*cost	  memory 	iven name	iven arg   how
!   gp	 pointer	  iven[]	ivenarg[]  many */
! 
! { 2,		0,		ODAGGER,		0,		3	},
! { 20,		0,		OSPEAR,			0,		3	},
! { 80,		0,		OFLAIL,			0,		2	},
! { 150,		0,		OBATTLEAXE,		0,		2	},
! { 450,		0,		OLONGSWORD,		0,		2	},
! { 1000,		0,		O2SWORD,		0,		2	},
! { 5000,		0,		OSWORD,			0,		1	},
! { 16500,	0,		OLANCE,			0,		1	},
! { 6000,		0,	 OSWORDofSLASHING,	0,		0	},
! { 10000,	0,		OHAMMER,		0,		0	},
! 
! /*cost	  memory 	iven name	iven arg   how
!   gp	 pointer	  iven[]	ivenarg[]  many */
! 
! { 150,		0,		OPROTRING,		1,		1	},
! { 85,		0,		OSTRRING,		1,		1	},
! { 120,		0,		ODEXRING,		1,		1	},
! { 120,		0,		OCLEVERRING,	1,		1	},
! { 180,		0,		OENERGYRING,	0,		1	},
! { 125,		0,		ODAMRING,		0,		1	},
! { 220,		0,		OREGENRING,		0,		1	},
! { 1000,		0,		ORINGOFEXTRA,	0,		1	},
! 
! { 280,		0,		OBELT,			0,		1	},
! 
! { 400,		0,		OAMULET,		0,		1	},
! 
! { 6500,		0,		OORBOFDRAGON,	0,		0	},
! { 5500,		0,		OSPIRITSCARAB,	0,		0	},
! { 5000,		0,		OCUBEofUNDEAD,	0,		0	},
! { 6000,		0,		ONOTHEFT,		0,		0	},
! 
! { 590,		0,		OCHEST,			6,		1	},
! { 200,		0,		OBOOK,			8,		1	},
! { 10,		0,		OCOOKIE,		0,		3	},
! 
! /*cost	  memory 	iven name	iven arg   how
!   gp	 pointer	  iven[]	ivenarg[]  many */
! 
! {	20,		potionname,	OPOTION,	0,		6	},
! {	90,		potionname,	OPOTION,	1,		5	},
! {	520,	potionname,	OPOTION,	2,		1	},
! { 	100,	potionname,	OPOTION,	3,		2	},
! {	50,		potionname,	OPOTION,	4,		2	},
! {	150,	potionname,	OPOTION,	5,		2	},
! {	70,		potionname,	OPOTION,	6,		1	},
! {	30,		potionname,	OPOTION,	7,		7	},
! {	200,	potionname,	OPOTION,	8,		1	},
! {	50,		potionname,	OPOTION,	9,		1	},
! {	80,		potionname,	OPOTION,	10,		1	},
! 
! /*cost	  memory 	iven name	iven arg   how
!   gp	 pointer	  iven[]	ivenarg[]  many */
! 
! {	30,		potionname,	OPOTION,	11,		3	},
! {	20,		potionname,	OPOTION,	12,		5	},
! {	40,		potionname,	OPOTION,	13,		3	},
! {	35,		potionname,	OPOTION,	14,		2	},
! {	520,	potionname,	OPOTION,	15,		1	},
! {	90,		potionname,	OPOTION,	16,		2	},
! {	200,	potionname,	OPOTION,	17,		2	},
! {	220,	potionname,	OPOTION,	18,		4	},
! {	80,		potionname,	OPOTION,	19,		6	},
! {	370,	potionname,	OPOTION,	20,		3	},
! {	50,		potionname,	OPOTION,	22,		1	},
! {	150,	potionname,	OPOTION,	23,		3	},
! 
! /*cost	  memory 	iven name	iven arg   how
!   gp	 pointer	  iven[]	ivenarg[]  many */
! 
! { 100,	scrollname,		OSCROLL,	0,		2	},
! { 125,	scrollname,		OSCROLL,	1,		2	},
! { 60,	scrollname,		OSCROLL,	2,		4	},
! { 10,	scrollname,		OSCROLL,	3,		4	},
! { 100,	scrollname,		OSCROLL,	4,		3	},
! { 200,	scrollname,		OSCROLL,	5,		2	},
! { 110,	scrollname,		OSCROLL,	6,		1	},
! { 500,	scrollname,		OSCROLL,	7,		2	},
! { 200,	scrollname,		OSCROLL,	8,		2	},
! { 250,	scrollname,		OSCROLL,	9,		4	},
! { 20,	scrollname,		OSCROLL,	10,		5	},
! { 30,	scrollname,		OSCROLL,	11,		3	},
! 
! /*cost	  memory 	iven name	iven arg   how
!   gp	 pointer	  iven[]	ivenarg[]  many */
! 
! { 340,	scrollname,		OSCROLL,	12,		1	},
! { 340,	scrollname,		OSCROLL,	13,		1	},
! { 300,	scrollname,		OSCROLL,	14,		2	},
! { 400,	scrollname,		OSCROLL,	15,		2	},
! { 500,	scrollname,		OSCROLL,	16,		2	},
! { 1000,	scrollname,		OSCROLL,	17,		1	},
! { 500,	scrollname,		OSCROLL,	18,		1	},
! { 340,	scrollname,		OSCROLL,	19,		2	},
! { 220,	scrollname,		OSCROLL,	20,		3	},
! { 3900,	scrollname,		OSCROLL,	21,		0	},
! { 610,	scrollname,		OSCROLL,	22,		1	},
! { 3000,	scrollname,		OSCROLL,	23,		0	}
   };
  
--- 44,161 ----
  int maxitm=83;	/* number of items in the dnd inventory table	*/
  struct _itm itm[90] = {
! /*cost 		iven name		iven arg   how
!   gp		  iven[]		ivenarg[]  many */
  
! { 2,		OLEATHER,		0,		3	},
! { 10,		OSTUDLEATHER,		0,		2	},
! { 40,		ORING,			0,		2	},
! { 85,		OCHAIN,			0,		2	},
! { 220,		OSPLINT,		0,		1	},
! { 400,		OPLATE,			0,		1	},
! { 900,		OPLATEARMOR,		0,		1	},
! { 2600,		OSSPLATE,		0,		1	},
! { 150,		OSHIELD,		0,		1	},
! 
! /*cost	 	iven name		iven arg   how
!   gp		  iven[]		ivenarg[]  many */
! 
! { 2,		ODAGGER,		0,		3	},
! { 20,		OSPEAR,			0,		3	},
! { 80,		OFLAIL,			0,		2	},
! { 150,		OBATTLEAXE,		0,		2	},
! { 450,		OLONGSWORD,		0,		2	},
! { 1000,		O2SWORD,		0,		2	},
! { 5000,		OSWORD,			0,		1	},
! { 16500,	OLANCE,			0,		1	},
! { 6000,		OSWORDofSLASHING,	0,		0	},
! { 10000,	OHAMMER,		0,		0	},
! 
! /*cost		iven name		iven arg   how
!   gp		  iven[]		ivenarg[]  many */
! 
! { 150,		OPROTRING,		1,		1	},
! { 85,		OSTRRING,		1,		1	},
! { 120,		ODEXRING,		1,		1	},
! { 120,		OCLEVERRING,		1,		1	},
! { 180,		OENERGYRING,		0,		1	},
! { 125,		ODAMRING,		0,		1	},
! { 220,		OREGENRING,		0,		1	},
! { 1000,		ORINGOFEXTRA,		0,		1	},
! 
! { 280,		OBELT,			0,		1	},
! 
! { 400,		OAMULET,		0,		1	},
! 
! { 6500,		OORBOFDRAGON,		0,		0	},
! { 5500,		OSPIRITSCARAB,		0,		0	},
! { 5000,		OCUBEofUNDEAD,		0,		0	},
! { 6000,		ONOTHEFT,		0,		0	},
! 
! { 590,		OCHEST,			6,		1	},
! { 200,		OBOOK,			8,		1	},
! { 10,		OCOOKIE,		0,		3	},
! 
! /*cost		iven name		iven arg   how
!   gp		  iven[]		ivenarg[]  many */
! 
! { 20,		OPOTION,		0,		6	},
! { 90,		OPOTION,		1,		5	},
! { 520,		OPOTION,		2,		1	},
! { 100,		OPOTION,		3,		2	},
! { 50,		OPOTION,		4,		2	},
! { 150,		OPOTION,		5,		2	},
! { 70,		OPOTION,		6,		1	},
! { 30,		OPOTION,		7,		7	},
! { 200,		OPOTION,		8,		1	},
! { 50,		OPOTION,		9,		1	},
! { 80,		OPOTION,		10,		1	},
! 
! /*cost		iven name		iven arg   how
!   gp		  iven[]		ivenarg[]  many */
! 
! { 30,		OPOTION,		11,		3	},
! { 20,		OPOTION,		12,		5	},
! { 40,		OPOTION,		13,		3	},
! { 35,		OPOTION,		14,		2	},
! { 520,		OPOTION,		15,		1	},
! { 90,		OPOTION,		16,		2	},
! { 200,		OPOTION,		17,		2	},
! { 220,		OPOTION,		18,		4	},
! { 80,		OPOTION,		19,		6	},
! { 370,		OPOTION,		20,		3	},
! { 50,		OPOTION,		22,		1	},
! { 150,		OPOTION,		23,		3	},
! 
! /*cost		iven name		iven arg   how
!   gp		  iven[]		ivenarg[]  many */
! 
! { 100,		OSCROLL,		0,		2	},
! { 125,		OSCROLL,		1,		2	},
! { 60,		OSCROLL,		2,		4	},
! { 10,		OSCROLL,		3,		4	},
! { 100,		OSCROLL,		4,		3	},
! { 200,		OSCROLL,		5,		2	},
! { 110,		OSCROLL,		6,		1	},
! { 500,		OSCROLL,		7,		2	},
! { 200,		OSCROLL,		8,		2	},
! { 250,		OSCROLL,		9,		4	},
! { 20,		OSCROLL,		10,		5	},
! { 30,		OSCROLL,		11,		3	},
! 
! /*cost 		iven name		iven arg   how
!   gp		  iven[]		ivenarg[]  many */
! 
! { 340,		OSCROLL,		12,		1	},
! { 340,		OSCROLL,		13,		1	},
! { 300,		OSCROLL,		14,		2	},
! { 400,		OSCROLL,		15,		2	},
! { 500,		OSCROLL,		16,		2	},
! { 1000,		OSCROLL,		17,		1	},
! { 500,		OSCROLL,		18,		1	},
! { 340,		OSCROLL,		19,		2	},
! { 220,		OSCROLL,		20,		3	},
! { 3900,		OSCROLL,		21,		0	},
! { 610,		OSCROLL,		22,		1	},
! { 3000,		OSCROLL,		23,		0	}
   };
  
***************
*** 247,251 ****
  		if (c[GOLD] < itm[i].price*10) nogold(); else
  			{
! 			if (itm[i].mem != 0) *itm[i].mem[itm[i].arg] = ' ';
  			c[GOLD] -= itm[i].price*10;
  			itm[i].qty--;  take(itm[i].obj,itm[i].arg);
--- 247,254 ----
  		if (c[GOLD] < itm[i].price*10) nogold(); else
  			{
! 			if (itm[i].obj == OPOTION)
! 				{ potionname[itm[i].arg] = potionhide[itm[i].arg]; }
! 			else if (itm[i].obj == OSCROLL)
! 				{ scrollname[itm[i].arg] = scrollhide[itm[i].arg]; }
  			c[GOLD] -= itm[i].price*10;
  			itm[i].qty--;  take(itm[i].obj,itm[i].arg);
***************
*** 272,278 ****
  	lprintf("%c) ",(i%26)+'a');
  	if (itm[i].obj == OPOTION)
! 		{ lprcat("potion of "); lprintf("%s",&potionname[itm[i].arg][1]); }
  	else if (itm[i].obj == OSCROLL)
! 		{ lprcat("scroll of "); lprintf("%s",&scrollname[itm[i].arg][1]); }
  	else lprintf("%s",objectname[itm[i].obj]);
  	cursor( j+31,k );  lprintf("%6d",(long)(itm[i].price*10));
--- 275,281 ----
  	lprintf("%c) ",(i%26)+'a');
  	if (itm[i].obj == OPOTION)
! 		{ lprintf("potion of%s", potionhide[itm[i].arg]); }
  	else if (itm[i].obj == OSCROLL)
! 		{ lprintf("scroll of%s", scrollhide[itm[i].arg]); }
  	else lprintf("%s",objectname[itm[i].obj]);
  	cursor( j+31,k );  lprintf("%6d",(long)(itm[i].price*10));