Rogue 3.6 reconstruction from http://rogue.rogueforge.net/rogue36/.
[rogue-pphs.git] / armor.c
1 /*
2 * This file contains misc functions for dealing with armor
3 * @(#)armor.c 3.9 (Berkeley) 6/15/81
4 *
5 * Rogue: Exploring the Dungeons of Doom
6 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
7 * All rights reserved.
8 *
9 * See the file LICENSE.TXT for full copyright and licensing information.
10 */
11
12 #include "curses.h"
13 #include "rogue.h"
14
15 /*
16 * wear:
17 * The player wants to wear something, so let him/her put it on.
18 */
19
20 wear()
21 {
22 register struct linked_list *item;
23 register struct object *obj;
24
25 if (cur_armor != NULL)
26 {
27 addmsg("You are already wearing some");
28 if (!terse)
29 addmsg(". You'll have to take it off first");
30 endmsg();
31 after = FALSE;
32 return;
33 }
34 if ((item = get_item("wear", ARMOR)) == NULL)
35 return;
36 obj = (struct object *) ldata(item);
37 if (obj->o_type != ARMOR)
38 {
39 msg("You can't wear that.");
40 return;
41 }
42 waste_time();
43 if (!terse)
44 addmsg("You are now w");
45 else
46 addmsg("W");
47 msg("earing %s.", a_names[obj->o_which]);
48 cur_armor = obj;
49 obj->o_flags |= ISKNOW;
50 }
51
52 /*
53 * take_off:
54 * Get the armor off of the players back
55 */
56
57 take_off()
58 {
59 register struct object *obj;
60
61 if ((obj = cur_armor) == NULL)
62 {
63 if (terse)
64 msg("Not wearing armor");
65 else
66 msg("You aren't wearing any armor");
67 return;
68 }
69 if (!dropcheck(cur_armor))
70 return;
71 cur_armor = NULL;
72 if (terse)
73 addmsg("Was");
74 else
75 addmsg("You used to be ");
76 msg(" wearing %c) %s", pack_char(obj), inv_name(obj, TRUE));
77 }
78
79 /*
80 * waste_time:
81 * Do nothing but let other things happen
82 */
83
84 waste_time()
85 {
86 do_daemons(BEFORE);
87 do_fuses(BEFORE);
88 do_daemons(AFTER);
89 do_fuses(AFTER);
90 }