1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.worn.c - version 1.0.2 */
3 /* $FreeBSD: src/games/hack/hack.worn.c,v 1.3 1999/11/16 02:57:14 billf Exp $ */
4 /* $DragonFly: src/games/hack/hack.worn.c,v 1.3 2006/08/21 19:45:32 pavalos Exp $ */
26 setworn(struct obj
*obj
, long mask
)
31 for (wp
= worn
; wp
->w_mask
; wp
++)
32 if (wp
->w_mask
& mask
) {
34 if (oobj
&& !(oobj
->owornmask
& wp
->w_mask
))
35 impossible("Setworn: mask = %ld.", wp
->w_mask
);
37 oobj
->owornmask
&= ~wp
->w_mask
;
38 if (obj
&& oobj
&& wp
->w_mask
== W_ARM
) {
40 impossible("Setworn: uarm2 set?");
42 setworn(uarm
, W_ARM2
);
46 obj
->owornmask
|= wp
->w_mask
;
51 uarm
->owornmask
^= (W_ARM
| W_ARM2
);
55 /* called e.g. when obj is destroyed */
57 setnotworn(struct obj
*obj
)
61 for (wp
= worn
; wp
->w_mask
; wp
++)
62 if (obj
== *(wp
->w_obj
)) {
64 obj
->owornmask
&= ~wp
->w_mask
;
69 uarm
->owornmask
^= (W_ARM
| W_ARM2
);