$NetBSD: patch-at,v 1.1.1.1 2001/04/27 15:27:32 agc Exp $

--- object.c.orig	Fri Jun 19 13:55:36 1992
+++ object.c	Sat Jan 13 21:54:23 2001
@@ -1,4 +1,5 @@
 /*	object.c		*/
+#include <stdlib.h>
 #include "header.h"
 #include "monst.h"
 #include "itm.h"
@@ -13,7 +14,7 @@
 	subroutine to look for an object and give the player his options
 	if an object was found.
  */
-lookforobject()
+void lookforobject(void)
 {
 	int i,j;
 
@@ -39,14 +40,14 @@
 	case OPOTION:	
 		lprcat("\n\nYou have found a magic potion");
 		i = iarg[playerx][playery];
-		if (potionname[i][0]) lprintf(" of %s",&potionname[i][1]);  
+		if (potionknown[i]) 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])	lprintf(" of %s",&scrollname[i][1]);
+		if (scrollknown[i])	lprintf(" of %s",scrollname[i]);
 		oscroll(i);  
 		break;
 
@@ -684,7 +685,7 @@
 /*
 	function to say what object we found and ask if player wants to take it
  */
-finditem(itm)
+void finditem(itm)
 int itm;
 {
 	int tmp,i;
@@ -732,7 +733,7 @@
 	subroutine to process the stair cases
 	if dir > 0 then up else down
  */
-ostairs(dir)
+void ostairs(dir)
 int dir;
 {
 	int x, y;
@@ -806,7 +807,7 @@
 
 	subroutine to handle a teleport trap +/- 1 level maximum
  */
-oteleport(err)
+void oteleport(err)
 int err;
 {
 	int tmp;
@@ -845,24 +846,10 @@
 	*******
 	OPOTION
 	*******
-	}
-	playerx = rnd(MAXX-2);	
-	playery = rnd(MAXY-2);
-	if (level != tmp)
-		newcavelevel(tmp);  
-	positionplayer();
-	draws(0,MAXX,0,MAXY); 
-	bot_linex();
-}
-
-/*
-	*******
-	OPOTION
-	*******
 
 	function to process a potion
  */
-opotion(pot)
+void opotion(pot)
 int pot;
 {
 	lprcat("\nDo you (d) drink it, (t) take it"); 
@@ -890,7 +877,7 @@
 /*
 	function to drink a potion
  */
-quaffpotion(pot)
+void quaffpotion(pot)
 int pot;
 {
 	int i,j;
@@ -899,8 +886,8 @@
 	if (pot<0 || pot>=MAXPOTION) 
 		return; /* check for within bounds */
 
-	if (potionname[pot][0] == '\0')
-		potionname[pot][0] = ' ';
+	if (potionknown[pot] == 0)
+		potionknown[pot] = 1;
 
 	switch(pot) {
 	case 0:	
@@ -1072,7 +1059,7 @@
 
 	function to process a magic scroll
  */
-oscroll(typ)
+void oscroll(typ)
 int typ;
 {
 	lprcat("\nDo you ");
@@ -1110,13 +1097,13 @@
 	data for the function to read a scroll
  */
 static int xh,yh,yl,xl;
-static char curse[] = { 
+static int curse[] = { 
 	BLINDCOUNT, CONFUSE, AGGRAVATE, HASTEMONST, ITCHING,
 	LAUGHING, DRAINSTRENGTH, CLUMSINESS, INFEEBLEMENT, HALFDAM };
-static char exten[] = { 
+static int exten[] = { 
 	PROTECTIONTIME, DEXCOUNT, STRCOUNT, CHARMCOUNT,
 	INVISIBILITY, CANCELLATION, HASTESELF, GLOBE, SCAREMONST, HOLDMONST, TIMESTOP };
-char time_change[] = { 
+int time_change[] = { 
 	HASTESELF,HERO,ALTPRO,PROTECTIONTIME,DEXCOUNT,
 	STRCOUNT,GIANTSTR,CHARMCOUNT,INVISIBILITY,CANCELLATION,
 	HASTESELF,AGGRAVATE,SCAREMONST,STEALTH,AWARENESS,HOLDMONST,HASTEMONST,
@@ -1125,7 +1112,7 @@
 /*
  *	function to adjust time when time warping and taking courses in school
  */
-adjusttime(tim)
+void adjusttime(tim)
 long tim;
 {
 	int j;
@@ -1143,13 +1130,13 @@
 /*
 	function to read a scroll
  */
-read_scroll(typ)
+void read_scroll(typ)
 int typ;
 {
 	int i,j;
 	if (typ<0 || typ>=MAXSCROLL) 
 		return;  /* be sure we are within bounds */
-	scrollname[typ][0] = ' ';
+	scrollknown[typ] = 1;
 	switch(typ) {
 	case 0:	
 		lprcat("\nYour armor glows for a moment");  
@@ -1282,9 +1269,9 @@
 		for (i=0; i<IVENSIZE; i++)	/* identify */
 		{
 			if (iven[i]==OPOTION)  
-				potionname[ivenarg[i]][0] = ' ';
+				potionknown[ivenarg[i]] = 1;
 			if (iven[i]==OSCROLL)  
-				scrollname[ivenarg[i]][0] = ' ';
+				scrollknown[ivenarg[i]] = 1;
 		}
 		break;
 
@@ -1309,7 +1296,7 @@
 }
 
 
-opit()
+void opit(void)
 {
 	int i;
 	if (rnd(101)>81)
@@ -1341,7 +1328,7 @@
 	}
 }
 
-obottomless()
+void obottomless(void)
 {
 	lprcat("\nYou fell into a pit leading straight to HELL!");  
 	beep(); 
@@ -1350,7 +1337,7 @@
 	died(262);
 }
 
-oelevator(dir)
+void oelevator(dir)
 int dir;
 {
 	if (dir==1) { 
@@ -1382,14 +1369,14 @@
 	bot_linex();
 }
 
-ostatue()
+void ostatue(void)
 { }	/* nothing happens when you move on a statue */
 
 
-omirror()
+void omirror(void)
 { }	/* nothing happens when you move on a mirror */
 
-obook()
+void obook(void)
 {
 	lprcat("\nDo you ");
 	if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); 
@@ -1421,7 +1408,7 @@
 /*
 	function to read a book
  */
-readbook(arg)
+void readbook(arg)
 int arg;
 {
 	int i,tmp;
@@ -1443,7 +1430,7 @@
 	}
 }
 
-ocookie()
+void ocookie(void)
 {
 	char *fortune(), *p;
 
@@ -1474,7 +1461,7 @@
 
 
 /* routine to pick up some gold -- if arg==OMAXGOLD then the pile is worth 100* the argument */
-ogold(arg)
+void ogold(arg)
 int arg;
 {
 	long i;
@@ -1491,7 +1478,7 @@
 	item[playerx][playery] = know[playerx][playery] = 0;/*destroy gold*/
 }
 
-ohome()
+void ohome(void)
 {
 	int i;
 
@@ -1501,7 +1488,7 @@
 		if (iven[i]==OPOTION) 
 			if (ivenarg[i]==21) {   
 				iven[i]=0;	
-				clear(); 
+				ularn_clear(); 
 lprcat("Congratulations.  You found the potion of cure dianthroritis!\n");
 lprcat("\nFrankly, No one thought you could do it.");
 lprcat("  Boy!  Did you surprise them!\n");
@@ -1531,7 +1518,7 @@
 			}
 
 	while (1) {
-		clear();
+		ularn_clear();
 lprintf("Welcome home %s.",logname);
 lprcat("  Latest word from the doctor is not good.\n");
 
@@ -1571,16 +1558,16 @@
 }
 
 /*	routine to save program space	*/
-iopts()
+void iopts(void)
 {	
 	lprcat(", or (i) ignore it? ");	
 }
-ignore()
+void ignore(void)
 {	
 	lprcat("ignore\n");	
 }
 
-closedoor()
+void closedoor(void)
 {
 	int i;
 
