1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
$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;
|