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++) if(wp->w_mask & mask) {
33 if(oobj && !(oobj->owornmask & wp->w_mask))
34 impossible("Setworn: mask = %ld.", wp->w_mask);
35 if(oobj) oobj->owornmask &= ~wp->w_mask;
36 if(obj && oobj && wp->w_mask == W_ARM){
38 impossible("Setworn: uarm2 set?");
40 setworn(uarm, W_ARM2);
43 if(obj) obj->owornmask |= wp->w_mask;
48 uarm->owornmask ^= (W_ARM | W_ARM2);
52 /* called e.g. when obj is destroyed */
54 setnotworn(struct obj *obj)
58 for(wp = worn; wp->w_mask; wp++)
59 if(obj == *(wp->w_obj)) {
61 obj->owornmask &= ~wp->w_mask;
66 uarm->owornmask ^= (W_ARM | W_ARM2);