Neale Pickett
·
2011-10-13
network.c
1/*
2 * This file contains misc functions for dealing with armor
3 *
4 * @(#)network.c 4.14 (Berkeley) 02/05/99
5 */
6
7#include <curses.h>
8#include "netprot.h"
9
10/*
11 * wear:
12 * The player wants to wear something, so let him/her put it on.
13 */
14void
15wear(void)
16{
17 THING *obj;
18 char *sp;
19
20 if ((obj = get_item("wear", ARMOR)) == NULL)
21 return;
22 if (Cur_armor != NULL)
23 {
24 addmsg("you are already wearing some");
25 if (!Terse)
26 addmsg(". You'll have to take it off first");
27 endmsg();
28 After = FALSE;
29 return;
30 }
31 if (obj->o_type != ARMOR)
32 {
33 msg("you can't wear that");
34 return;
35 }
36 waste_time();
37 obj->o_flags |= ISKNOW;
38 sp = inv_name(obj, TRUE);
39 Cur_armor = obj;
40 if (!Terse)
41 addmsg("you are now ");
42 msg("wearing %s", sp);
43}
44
45/*
46 * take_off:
47 * Get the armor off of the players back
48 */
49void
50take_off(void)
51{
52 THING *obj;
53
54 if ((obj = Cur_armor) == NULL)
55 {
56 After = FALSE;
57 if (Terse)
58 msg("not wearing armor");
59 else
60 msg("you aren't wearing any armor");
61 return;
62 }
63 if (!dropcheck(Cur_armor))
64 return;
65 Cur_armor = NULL;
66 if (Terse)
67 addmsg("was");
68 else
69 addmsg("you used to be");
70 msg(" wearing %c) %s", obj->o_packch, inv_name(obj, TRUE));
71}
72
73/*
74 * waste_time:
75 * Do nothing but let other things happen
76 */
77void
78waste_time(void)
79{
80 do_daemons(BEFORE);
81 do_fuses(BEFORE);
82 do_daemons(AFTER);
83 do_fuses(AFTER);
84}