comparison rogue3/armor.c @ 0:527e2150eaf0

Import Rogue 3.6 from the Roguelike Restoration Project (r1490)
author edwarj4
date Tue, 13 Oct 2009 13:33:34 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:527e2150eaf0
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 void
21 wear()
22 {
23 register struct linked_list *item;
24 register struct object *obj;
25
26 if (cur_armor != NULL)
27 {
28 addmsg("You are already wearing some");
29 if (!terse)
30 addmsg(". You'll have to take it off first");
31 endmsg();
32 after = FALSE;
33 return;
34 }
35 if ((item = get_item("wear", ARMOR)) == NULL)
36 return;
37 obj = (struct object *) ldata(item);
38 if (obj->o_type != ARMOR)
39 {
40 msg("You can't wear that.");
41 return;
42 }
43 waste_time();
44 if (!terse)
45 addmsg("You are now w");
46 else
47 addmsg("W");
48 msg("earing %s.", a_names[obj->o_which]);
49 cur_armor = obj;
50 obj->o_flags |= ISKNOW;
51 }
52
53 /*
54 * take_off:
55 * Get the armor off of the players back
56 */
57
58 void
59 take_off()
60 {
61 register struct object *obj;
62
63 if ((obj = cur_armor) == NULL)
64 {
65 if (terse)
66 msg("Not wearing armor");
67 else
68 msg("You aren't wearing any armor");
69 return;
70 }
71 if (!dropcheck(cur_armor))
72 return;
73 cur_armor = NULL;
74 if (terse)
75 addmsg("Was");
76 else
77 addmsg("You used to be ");
78 msg(" wearing %c) %s", pack_char(obj), inv_name(obj, TRUE));
79 }
80
81 /*
82 * waste_time:
83 * Do nothing but let other things happen
84 */
85
86 void
87 waste_time()
88 {
89 do_daemons(BEFORE);
90 do_fuses(BEFORE);
91 do_daemons(AFTER);
92 do_fuses(AFTER);
93 }