]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - hack/hack.worn.c
Negative exit code cleanup: Replace exit(-x) with exit(x).
[bsdgames-darwin.git] / hack / hack.worn.c
index 6dd5c2b13896ba7f7a8ed7d82e3ae736060c3b6a..3a8c8ae966d79197d98a76f10228cb4e8bcf4762 100644 (file)
@@ -1,52 +1,82 @@
+/*     $NetBSD: hack.worn.c,v 1.4 1997/10/19 16:59:32 christos Exp $   */
+
 /*
  * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
  */
 
+#include <sys/cdefs.h>
 #ifndef lint
-static char rcsid[] = "$NetBSD: hack.worn.c,v 1.3 1995/03/23 08:32:17 cgd Exp $";
-#endif /* not lint */
+__RCSID("$NetBSD: hack.worn.c,v 1.4 1997/10/19 16:59:32 christos Exp $");
+#endif                         /* not lint */
 
 #include "hack.h"
+#include "extern.h"
 
 struct worn {
-       long w_mask;
-       struct obj **w_obj;
-} worn[] = {
-       { W_ARM, &uarm },
-       { W_ARM2, &uarm2 },
-       { W_ARMH, &uarmh },
-       { W_ARMS, &uarms },
-       { W_ARMG, &uarmg },
-       { W_RINGL, &uleft },
-       { W_RINGR, &uright },
-       { W_WEP, &uwep },
-       { W_BALL, &uball },
-       { W_CHAIN, &uchain },
-       { 0, 0 }
+       long            w_mask;
+       struct obj    **w_obj;
+}               worn[] = {
+       {
+               W_ARM, &uarm
+       },
+       {
+               W_ARM2, &uarm2
+       },
+       {
+               W_ARMH, &uarmh
+       },
+       {
+               W_ARMS, &uarms
+       },
+       {
+               W_ARMG, &uarmg
+       },
+       {
+               W_RINGL, &uleft
+       },
+       {
+               W_RINGR, &uright
+       },
+       {
+               W_WEP, &uwep
+       },
+       {
+               W_BALL, &uball
+       },
+       {
+               W_CHAIN, &uchain
+       },
+       {
+               0, 0
+       }
 };
 
+void
 setworn(obj, mask)
-register struct obj *obj;
-long mask;
+       struct obj     *obj;
+       long            mask;
 {
-       register struct worn *wp;
-       register struct obj *oobj;
+       struct worn    *wp;
+       struct obj     *oobj;
 
-       for(wp = worn; wp->w_mask; wp++) if(wp->w_mask & mask) {
-               oobj = *(wp->w_obj);
-               if(oobj && !(oobj->owornmask & wp->w_mask))
-                       impossible("Setworn: mask = %ld.", wp->w_mask);
-               if(oobj) oobj->owornmask &= ~wp->w_mask;
-               if(obj && oobj && wp->w_mask == W_ARM){
-                       if(uarm2) {
-                               impossible("Setworn: uarm2 set?");
-                       } else
-                               setworn(uarm, W_ARM2);
+       for (wp = worn; wp->w_mask; wp++)
+               if (wp->w_mask & mask) {
+                       oobj = *(wp->w_obj);
+                       if (oobj && !(oobj->owornmask & wp->w_mask))
+                               impossible("Setworn: mask = %ld.", wp->w_mask);
+                       if (oobj)
+                               oobj->owornmask &= ~wp->w_mask;
+                       if (obj && oobj && wp->w_mask == W_ARM) {
+                               if (uarm2) {
+                                       impossible("Setworn: uarm2 set?");
+                               } else
+                                       setworn(uarm, W_ARM2);
+                       }
+                       *(wp->w_obj) = obj;
+                       if (obj)
+                               obj->owornmask |= wp->w_mask;
                }
-               *(wp->w_obj) = obj;
-               if(obj) obj->owornmask |= wp->w_mask;
-       }
-       if(uarm2 && !uarm) {
+       if (uarm2 && !uarm) {
                uarm = uarm2;
                uarm2 = 0;
                uarm->owornmask ^= (W_ARM | W_ARM2);
@@ -54,15 +84,18 @@ long mask;
 }
 
 /* called e.g. when obj is destroyed */
-setnotworn(obj) register struct obj *obj; {
-       register struct worn *wp;
+void
+setnotworn(obj)
+       struct obj     *obj;
+{
+       struct worn    *wp;
 
-       for(wp = worn; wp->w_mask; wp++)
-               if(obj == *(wp->w_obj)) {
+       for (wp = worn; wp->w_mask; wp++)
+               if (obj == *(wp->w_obj)) {
                        *(wp->w_obj) = 0;
                        obj->owornmask &= ~wp->w_mask;
                }
-       if(uarm2 && !uarm) {
+       if (uarm2 && !uarm) {
                uarm = uarm2;
                uarm2 = 0;
                uarm->owornmask ^= (W_ARM | W_ARM2);