X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/d378ebfd8ce254d9b5f99bbf4f415c5859a30154..d83ae3073815d24b7f25631da96992bf92984230:/hack/hack.mkobj.c?ds=sidebyside diff --git a/hack/hack.mkobj.c b/hack/hack.mkobj.c index 4a72255f..334d1f2e 100644 --- a/hack/hack.mkobj.c +++ b/hack/hack.mkobj.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mkobj.c,v 1.6 2003/04/02 18:36:38 jsm Exp $ */ +/* $NetBSD: hack.mkobj.c,v 1.9 2011/08/07 06:03:45 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,17 +63,16 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.mkobj.c,v 1.6 2003/04/02 18:36:38 jsm Exp $"); +__RCSID("$NetBSD: hack.mkobj.c,v 1.9 2011/08/07 06:03:45 dholland Exp $"); #endif /* not lint */ #include "hack.h" #include "extern.h" -char mkobjstr[] = "))[[!!!!????%%%%/=**))[[!!!!????%%%%/=**(%"; +static const char mkobjstr[] = "))[[!!!!????%%%%/=**))[[!!!!????%%%%/=**(%"; struct obj * -mkobj_at(let, x, y) - int let, x, y; +mkobj_at(int let, int x, int y) { struct obj *otmp = mkobj(let); otmp->ox = x; @@ -84,8 +83,7 @@ mkobj_at(let, x, y) } void -mksobj_at(otyp, x, y) - int otyp, x, y; +mksobj_at(int otyp, int x, int y) { struct obj *otmp = mksobj(otyp); otmp->ox = x; @@ -95,8 +93,7 @@ mksobj_at(otyp, x, y) } struct obj * -mkobj(let) - int let; +mkobj(int let) { if (!let) let = mkobjstr[rn2(sizeof(mkobjstr) - 1)]; @@ -113,8 +110,7 @@ mkobj(let) struct obj zeroobj; struct obj * -mksobj(otyp) - int otyp; +mksobj(int otyp) { struct obj *otmp; char let = objects[otyp].oc_olet; @@ -145,9 +141,10 @@ mksobj(otyp) if (otmp->otyp == TIN) otmp->spe = rnd(...); #endif /* NOT_YET_IMPLEMENTED */ - /* fall into next case */ + /* FALLTHROUGH */ case GEM_SYM: otmp->quan = rn2(6) ? 1 : 2; + break; case TOOL_SYM: case CHAIN_SYM: case BALL_SYM: @@ -193,15 +190,13 @@ mksobj(otyp) } int -letter(c) - int c; +letter(int c) { return (('@' <= c && c <= 'Z') || ('a' <= c && c <= 'z')); } int -weight(obj) - struct obj *obj; +weight(struct obj *obj) { int wt = objects[obj->otyp].oc_weight; return (wt ? wt * obj->quan : (obj->quan + 1) / 2);