-
Notifications
You must be signed in to change notification settings - Fork 1
/
armor.c
99 lines (80 loc) · 1.61 KB
/
armor.c
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
/*
* This file contains misc functions for dealing with armor
* @(#)armor.c 4.14 (Berkeley) 02/05/99
*
* Rogue: Exploring the Dungeons of Doom
* Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman
* All rights reserved.
*
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
#include "rogue.h"
/*
* wear:
* The player wants to wear something, so let him/her put it on.
*/
void
wear()
{
register THING *obj;
register char *sp;
if ((obj = get_item("wear", ARMOR)) == NULL)
return;
if (cur_armor != NULL) {
addmsg("you are already wearing some");
if (!terse)
addmsg(". You'll have to take it off first");
endmsg();
after = FALSE;
return;
}
if (obj->o_type != ARMOR) {
msg("you can't wear that");
return;
}
waste_time();
obj->o_flags |= ISKNOW;
sp = inv_name(obj, TRUE);
cur_armor = obj;
if (!terse)
addmsg("you are now ");
msg("wearing %s", sp);
}
/*
* take_off:
* Get the armor off of the players back
*/
void
take_off()
{
register THING *obj;
if ((obj = cur_armor) == NULL) {
after = FALSE;
if (terse)
msg("not wearing armor");
else
msg("you aren't wearing any armor");
return;
}
if (!dropcheck(cur_armor))
return;
cur_armor = NULL;
if (terse)
addmsg("was");
else
addmsg("you used to be");
msg(" wearing %c) %s", obj->o_packch, inv_name(obj, TRUE));
}
/*
* waste_time:
* Do nothing but let other things happen
*/
void
waste_time()
{
do_daemons(BEFORE);
do_fuses(BEFORE);
do_daemons(AFTER);
do_fuses(AFTER);
}