annotate arogue7/trader.c @ 219:f9ef86cf22b2

Advanced Rogue 7: convert to ANSI-style function declarations. Almost 1500 lines of compiler warnings remain, and the GCC developers are already working on a new version with even more warnings turned on by default.
author John "Elwin" Edwards
date Fri, 19 Feb 2016 21:02:28 -0500
parents adfa37e67084
children ad2570b5b21f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
2 * trader.c - Anything to do with trading posts
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
3 *
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
4 * Advanced Rogue
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
5 * Copyright (C) 1984, 1985, 1986 Michael Morgan, Ken Dalka and AT&T
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
6 * All rights reserved.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
7 *
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
8 * Based on "Rogue: Exploring the Dungeons of Doom"
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
9 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
10 * All rights reserved.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
11 *
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
12 * See the file LICENSE.TXT for full copyright and licensing information.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
13 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
14
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
15 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
16 * Anything to do with trading posts
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
17 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
18
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
19 #include <ctype.h>
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
20 #include <string.h>
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
21 #include "curses.h"
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
22 #include "rogue.h"
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
23
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
24 bool open_market(void);
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
25 void trans_line(void);
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
26 char *typ_name(struct object *obj);
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
27
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
28
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
29 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
30 * buy_it:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
31 * Buy the item on which the hero stands
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
32 */
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
33 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
34 buy_it(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
35 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
36 reg int wh;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
37 struct linked_list *item;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
38
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
39 if (purse <= 0) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
40 msg("You have no money.");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
41 return;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
42 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
43 if (curprice < 0) { /* if not yet priced */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
44 wh = price_it();
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
45 if (!wh) /* nothing to price */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
46 return;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
47 msg("Do you want to buy it? ");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
48 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
49 wh = tolower(readchar());
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
50 if (wh == ESCAPE || wh == 'n') {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
51 msg("");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
52 return;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
53 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
54 } until(wh == 'y');
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
55 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
56 mpos = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
57 if (curprice > purse) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
58 msg("You can't afford to buy that %s !",curpurch);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
59 return;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
60 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
61 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
62 * See if the hero has done all his transacting
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
63 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
64 if (!open_market())
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
65 return;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
66 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
67 * The hero bought the item here
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
68 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
69 item = find_obj(hero.y, hero.x);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
70 mpos = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
71 if (add_pack(NULL, TRUE, &item)) { /* try to put it in his pack */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
72 purse -= curprice; /* take his money */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
73 ++trader; /* another transaction */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
74 trans_line(); /* show remaining deals */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
75 curprice = -1; /* reset stuff */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
76 curpurch[0] = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
77 whatis (item); /* identify it after purchase */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
78 (OBJPTR(item))->o_flags &= ~ISPOST; /* turn off ISPOST */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
79 msg("%s", inv_name(OBJPTR(item), TRUE));
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
80 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
81 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
82
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
83 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
84 * do_post:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
85 * Put a trading post room and stuff on the screen
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
86 * startup: True if equipping the player at the beginning of the game
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
87 */
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
88 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
89 do_post(bool startup)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
90 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
91 coord tp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
92 reg int i, j, k;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
93 reg struct room *rp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
94 reg struct object *op;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
95 reg struct linked_list *ll;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
96
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
97 o_free_list(lvl_obj); /* throw old items away */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
98
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
99 for (rp = rooms; rp < &rooms[MAXROOMS]; rp++)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
100 rp->r_flags = ISGONE; /* kill all rooms */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
101
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
102 rp = &rooms[0]; /* point to only room */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
103 rp->r_flags = 0; /* this room NOT gone */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
104 rp->r_max.x = 40;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
105 rp->r_max.y = 10; /* 10 * 40 room */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
106 rp->r_pos.x = (cols - rp->r_max.x) / 2; /* center horizontal */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
107 rp->r_pos.y = 1; /* 2nd line */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
108 draw_room(rp); /* draw the only room */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
109
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
110 /* Are we equipping the player? */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
111 if (startup) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
112 int wpt;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
113
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
114 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
115 * Give the rogue some weaponry.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
116 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
117 for (wpt=0; wpt<MAXWEAPONS; wpt++) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
118 ll = spec_item(WEAPON, wpt, rnd(2), rnd(2)+1);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
119 attach(lvl_obj, ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
120 op = OBJPTR(ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
121 op->o_flags |= (ISPOST | ISKNOW);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
122 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
123 rnd_pos(rp,&tp);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
124 } until (mvinch(tp.y, tp.x) == FLOOR);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
125 op->o_pos = tp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
126 mvaddch(tp.y,tp.x,op->o_type);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
127 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
128
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
129 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
130 * And his suit of armor.......
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
131 * Thieves can only wear leather armor,
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
132 * so make sure some is available for them.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
133 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
134 for (i=0; i<MAXARMORS; i++) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
135 ll = spec_item(ARMOR, i, 0, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
136 attach(lvl_obj, ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
137 op = OBJPTR(ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
138 op->o_flags |= (ISPOST | ISKNOW);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
139 op->o_weight = armors[i].a_wght;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
140 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
141 rnd_pos(rp,&tp);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
142 } until (mvinch(tp.y, tp.x) == FLOOR);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
143 op->o_pos = tp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
144 mvaddch(tp.y,tp.x,op->o_type);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
145 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
146
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
147 /* Now create some wands */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
148 for (i=rnd(4)+2; i>0; i--) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
149 switch (rnd(8)) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
150 case 0: j = WS_SLOW_M;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
151 when 1: j = WS_TELMON;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
152 when 2: j = WS_CONFMON;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
153 when 3: j = WS_PARALYZE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
154 when 4: j = WS_MDEG;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
155 when 5: j = WS_WONDER;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
156 when 6: j = WS_FEAR;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
157 when 7: j = WS_LIGHT;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
158 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
159 ll = spec_item(STICK, j, 0, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
160 attach(lvl_obj, ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
161 op = OBJPTR(ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
162
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
163 /* Let clerics and MU'S know what kind they are */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
164 switch (player.t_ctype) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
165 case C_MAGICIAN:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
166 case C_CLERIC:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
167 case C_DRUID:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
168 op->o_flags |= (ISPOST | ISKNOW);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
169 otherwise:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
170 op->o_flags |= ISPOST;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
171 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
172 fix_stick(op);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
173 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
174 rnd_pos(rp,&tp);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
175 } until (mvinch(tp.y, tp.x) == FLOOR);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
176 op->o_pos = tp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
177 mvaddch(tp.y,tp.x,op->o_type);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
178 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
179
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
180 /* Now let's make some rings */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
181 for (i=rnd(4)+3; i>0; i--) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
182 k = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
183 switch (rnd(15)) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
184 case 0: j = R_PROTECT; k = roll(1,2);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
185 when 1: j = R_ADDSTR; k = roll(1,3);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
186 when 2: j = R_ADDHIT; k = roll(1,3);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
187 when 3: j = R_ADDDAM; k = roll(1,3);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
188 when 4: j = R_DIGEST; k = 1;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
189 when 5: j = R_ADDINTEL; k = roll(1,3);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
190 when 6: j = R_ADDWISDOM;k = roll(1,3);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
191 when 7: j = R_SUSABILITY;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
192 when 8: j = R_SEEINVIS;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
193 when 9: j = R_ALERT;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
194 when 10:j = R_HEALTH;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
195 when 11:j = R_HEROISM;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
196 when 12:j = R_FIRE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
197 when 13:j = R_WARMTH;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
198 when 14:j = R_FREEDOM;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
199 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
200 ll = spec_item(RING, j, k, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
201 attach(lvl_obj, ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
202 op = OBJPTR(ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
203
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
204 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
205 * Let fighters, assassins, monks, and thieves know what kind
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
206 * of rings these are.
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
207 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
208 switch (player.t_ctype) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
209 case C_FIGHTER:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
210 case C_THIEF:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
211 case C_ASSASIN:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
212 case C_MONK:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
213 op->o_flags |= (ISPOST | ISKNOW);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
214 otherwise:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
215 op->o_flags |= ISPOST;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
216 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
217 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
218 rnd_pos(rp,&tp);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
219 } until (mvinch(tp.y, tp.x) == FLOOR);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
220 op->o_pos = tp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
221 mvaddch(tp.y,tp.x,op->o_type);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
222 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
223
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
224 /* Let's offer some potions */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
225 for (i=rnd(3)+1; i>0; i--) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
226 /* Choose the type of potion */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
227 if (i == 1 && player.t_ctype == C_ASSASIN) j = P_POISON;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
228 else switch (rnd(8)) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
229 case 0: j = P_CLEAR;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
230 when 1: j = P_HEALING;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
231 when 2: j = P_MFIND;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
232 when 3: j = P_TFIND;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
233 when 4: j = P_HASTE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
234 when 5: j = P_RESTORE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
235 when 6: j = P_FLY;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
236 when 7: j = P_FFIND;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
237 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
238
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
239 /* Make the potion */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
240 ll = spec_item(POTION, j, 0, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
241 attach(lvl_obj, ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
242 op = OBJPTR(ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
243 op->o_flags |= ISPOST;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
244
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
245 /* Place the potion */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
246 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
247 rnd_pos(rp,&tp);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
248 } until (mvinch(tp.y, tp.x) == FLOOR);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
249 op->o_pos = tp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
250 mvaddch(tp.y,tp.x,op->o_type);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
251 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
252
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
253 /* Let's offer some scrolls */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
254 for (i=rnd(3)+1; i>0; i--) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
255 /* Choose the type of scrolls */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
256 switch (rnd(8)) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
257 case 0: j = S_CONFUSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
258 when 1: j = S_MAP;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
259 when 2: j = S_LIGHT;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
260 when 3: j = S_SLEEP;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
261 when 4: j = S_IDENT;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
262 when 5: j = S_GFIND;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
263 when 6: j = S_REMOVE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
264 when 7: j = S_CURING;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
265 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
266
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
267 /* Make the scroll */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
268 ll = spec_item(SCROLL, j, 0, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
269 attach(lvl_obj, ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
270 op = OBJPTR(ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
271 op->o_flags |= ISPOST;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
272
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
273 /* Place the scroll */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
274 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
275 rnd_pos(rp,&tp);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
276 } until (mvinch(tp.y, tp.x) == FLOOR);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
277 op->o_pos = tp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
278 mvaddch(tp.y,tp.x,op->o_type);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
279 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
280
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
281 /* And finally, let's get some food */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
282 for (i=rnd(3)+1; i>0; i--) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
283 ll = spec_item(FOOD, 0, 0, 0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
284 attach(lvl_obj, ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
285 op = OBJPTR(ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
286 op->o_weight = things[TYP_FOOD].mi_wght;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
287 op->o_flags |= ISPOST;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
288 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
289 rnd_pos(rp,&tp);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
290 } until (mvinch(tp.y, tp.x) == FLOOR);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
291 op->o_pos = tp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
292 mvaddch(tp.y,tp.x,op->o_type);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
293 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
294 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
295 else {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
296 i = roll(10, 4); /* 10 to 40 items */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
297 for (; i > 0 ; i--) { /* place all the items */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
298 ll = new_thing(ALL, TRUE); /* get something */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
299 attach(lvl_obj, ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
300 op = OBJPTR(ll);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
301 op->o_flags |= ISPOST; /* object in trading post */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
302 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
303 rnd_pos(rp,&tp);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
304 } until (mvinch(tp.y, tp.x) == FLOOR);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
305 op->o_pos = tp;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
306 mvaddch(tp.y,tp.x,op->o_type);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
307 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
308 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
309 wmove(cw,12,0);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
310 trader = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
311 if (startup) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
312 waddstr(cw,"Welcome to Friendly Fiend's Equipage\n\r");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
313 waddstr(cw,"====================================\n\r");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
314 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
315 else {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
316 waddstr(cw,"Welcome to Friendly Fiend's Flea Market\n\r");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
317 waddstr(cw,"=======================================\n\r");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
318 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
319 waddstr(cw,"$: Prices object that you stand upon.\n\r");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
320 waddstr(cw,"#: Buys the object that you stand upon.\n\r");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
321 waddstr(cw,"%: Trades in something in your pack for gold.\n\r");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
322 trans_line();
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
323 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
324
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
325
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
326 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
327 * get_worth:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
328 * Calculate an objects worth in gold
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
329 */
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
330 int
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
331 get_worth(struct object *obj)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
332 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
333 reg int worth, wh;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
334
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
335 worth = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
336 wh = obj->o_which;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
337 switch (obj->o_type) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
338 case FOOD:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
339 worth = 2;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
340 when WEAPON:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
341 if (wh < MAXWEAPONS) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
342 worth = weaps[wh].w_worth;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
343 worth += s_magic[S_ALLENCH].mi_worth *
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
344 (obj->o_hplus + obj->o_dplus);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
345 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
346 when ARMOR:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
347 if (wh < MAXARMORS) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
348 worth = armors[wh].a_worth;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
349 worth += s_magic[S_ALLENCH].mi_worth *
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
350 (armors[wh].a_class - obj->o_ac);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
351 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
352 when SCROLL:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
353 if (wh < MAXSCROLLS)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
354 worth = s_magic[wh].mi_worth;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
355 when POTION:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
356 if (wh < MAXPOTIONS)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
357 worth = p_magic[wh].mi_worth;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
358 when RING:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
359 if (wh < MAXRINGS) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
360 worth = r_magic[wh].mi_worth;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
361 worth += obj->o_ac * 40;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
362 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
363 when STICK:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
364 if (wh < MAXSTICKS) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
365 worth = ws_magic[wh].mi_worth;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
366 worth += 20 * obj->o_charges;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
367 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
368 when MM:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
369 if (wh < MAXMM) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
370 worth = m_magic[wh].mi_worth;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
371 switch (wh) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
372 case MM_BRACERS: worth += 40 * obj->o_ac;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
373 when MM_PROTECT: worth += 60 * obj->o_ac;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
374 when MM_DISP: /* ac already figured in price*/
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
375 otherwise: worth += 20 * obj->o_ac;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
376 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
377 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
378 when RELIC:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
379 if (wh < MAXRELIC) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
380 worth = rel_magic[wh].mi_worth;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
381 if (wh == quest_item) worth *= 10;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
382 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
383 otherwise:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
384 worth = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
385 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
386 if (obj->o_flags & ISPROT) /* 300% more for protected */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
387 worth *= 3;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
388 if (obj->o_flags & ISBLESSED) /* 50% more for blessed */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
389 worth = worth * 3 / 2;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
390 if (obj->o_flags & ISCURSED) /* half for cursed */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
391 worth /= 2;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
392 if (worth < 0)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
393 worth = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
394 return worth;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
395 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
396
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
397 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
398 * open_market:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
399 * Retruns TRUE when ok do to transacting
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
400 */
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
401 bool
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
402 open_market(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
403 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
404 if (trader >= MAXPURCH && !wizard && level != 0) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
405 msg("The market is closed. The stairs are that-a-way.");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
406 return FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
407 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
408 else {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
409 return TRUE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
410 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
411 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
412
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
413 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
414 * price_it:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
415 * Price the object that the hero stands on
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
416 */
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
417 bool
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
418 price_it(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
419 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
420 reg struct linked_list *item;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
421 reg struct object *obj;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
422 reg int worth;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
423 reg char *str;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
424
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
425 if (!open_market()) /* after buying hours */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
426 return FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
427 if ((item = find_obj(hero.y,hero.x)) == NULL) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
428 debug("Can't find the item");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
429 return FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
430 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
431 obj = OBJPTR(item);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
432 worth = get_worth(obj);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
433 if (worth < 0) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
434 msg("That's not for sale.");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
435 return FALSE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
436 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
437 if (worth < 25)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
438 worth = 25;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
439
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
440 /* Our shopkeeper is affected by the person's charisma */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
441 worth = (int) ((float) worth * (17. / (float)pstats.s_charisma));
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
442 str = inv_name(obj, TRUE);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
443 msg("%s for only %d pieces of gold", str, worth);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
444 curprice = worth; /* save price */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
445 strcpy(curpurch,str); /* save item */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
446 return TRUE;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
447 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
448
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
449
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
450
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
451 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
452 * sell_it:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
453 * Sell an item to the trading post
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
454 */
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
455 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
456 sell_it(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
457 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
458 reg struct linked_list *item;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
459 reg struct object *obj;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
460 reg int wo, ch;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
461
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
462 if (!open_market()) /* after selling hours */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
463 return;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
464
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
465 if ((item = get_item(pack, "sell", ALL, FALSE, FALSE)) == NULL)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
466 return;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
467 obj = OBJPTR(item);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
468 wo = get_worth(obj);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
469 if (wo <= 0) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
470 mpos = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
471 msg("We don't buy those.");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
472 return;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
473 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
474 if (wo < 25)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
475 wo = 25;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
476 msg("Your %s is worth %d pieces of gold.",typ_name(obj),wo);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
477 msg("Do you want to sell it? ");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
478 do {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
479 ch = tolower(readchar());
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
480 if (ch == ESCAPE || ch == 'n') {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
481 msg("");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
482 return;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
483 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
484 } until (ch == 'y');
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
485 mpos = 0;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
486 if (drop(item) == TRUE) { /* drop this item */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
487 purse += wo; /* give him his money */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
488 ++trader; /* another transaction */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
489 wo = obj->o_count;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
490 if (obj->o_group == 0) /* dropped one at a time */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
491 obj->o_count = 1;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
492 msg("Sold %s",inv_name(obj,TRUE));
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
493 obj->o_count = wo;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
494 trans_line(); /* show remaining deals */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
495 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
496 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
497
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
498 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
499 * trans_line:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
500 * Show how many transactions the hero has left
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
501 */
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
502 void
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
503 trans_line(void)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
504 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
505 if (level == 0)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
506 sprintf(prbuf, "You are welcome to spend whatever you have.");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
507 else if (!wizard)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
508 sprintf(prbuf,"You have %d transactions remaining.",
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
509 MAXPURCH - trader);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
510 else
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
511 sprintf(prbuf,
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
512 "You have infinite transactions remaining oh great wizard.");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
513 mvwaddstr(cw,lines - 3,0,prbuf);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
514 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
515
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
516
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
517
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
518 /*
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
519 * typ_name:
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
520 * Return the name for this type of object
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
521 */
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
522 char *
219
f9ef86cf22b2 Advanced Rogue 7: convert to ANSI-style function declarations.
John "Elwin" Edwards
parents: 125
diff changeset
523 typ_name(struct object *obj)
125
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
524 {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
525 static char buff[20];
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
526 reg int wh;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
527
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
528 switch (obj->o_type) {
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
529 case POTION: wh = TYP_POTION;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
530 when SCROLL: wh = TYP_SCROLL;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
531 when STICK: wh = TYP_STICK;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
532 when RING: wh = TYP_RING;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
533 when ARMOR: wh = TYP_ARMOR;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
534 when WEAPON: wh = TYP_WEAPON;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
535 when MM: wh = TYP_MM;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
536 when FOOD: wh = TYP_FOOD;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
537 when RELIC: wh = TYP_RELIC;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
538 otherwise: wh = -1;
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
539 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
540 if (wh < 0)
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
541 strcpy(buff,"unknown");
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
542 else
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
543 strcpy(buff,things[wh].mi_name);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
544 return (buff);
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
545 }
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
546
adfa37e67084 Import Advanced Rogue 7.7 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
547