diff options
Diffstat (limited to 'rogue/pack.c')
| -rw-r--r-- | rogue/pack.c | 68 |
1 files changed, 42 insertions, 26 deletions
diff --git a/rogue/pack.c b/rogue/pack.c index b91bc5a8..fdf0943d 100644 --- a/rogue/pack.c +++ b/rogue/pack.c @@ -1,4 +1,4 @@ -/* $NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $ */ +/* $NetBSD: pack.c,v 1.4 1997/10/12 11:45:37 lukem Exp $ */ /* * Copyright (c) 1988, 1993 @@ -36,11 +36,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)pack.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $"; +__RCSID("$NetBSD: pack.c,v 1.4 1997/10/12 11:45:37 lukem Exp $"); #endif #endif /* not lint */ @@ -60,16 +61,14 @@ static char rcsid[] = "$NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $"; char *curse_message = "you can't, it appears to be cursed"; -extern short levitate; - object * add_to_pack(obj, pack, condense) -object *obj, *pack; + object *obj, *pack; { object *op; if (condense) { - if (op = check_duplicate(obj, pack)) { + if ((op = check_duplicate(obj, pack)) != NULL) { free_object(obj); return(op); } else { @@ -90,8 +89,9 @@ object *obj, *pack; return(obj); } +void take_from_pack(obj, pack) -object *obj, *pack; + object *obj, *pack; { while (pack->next_object != obj) { pack = pack->next_object; @@ -105,7 +105,7 @@ object *obj, *pack; object * pick_up(row, col, status) -short *status; + short *status; { object *obj; @@ -150,6 +150,7 @@ short *status; return(obj); } +void drop() { object *obj, *new; @@ -214,7 +215,7 @@ drop() object * check_duplicate(obj, pack) -object *obj, *pack; + object *obj, *pack; { object *op; @@ -246,10 +247,11 @@ object *obj, *pack; return(0); } +short next_avail_ichar() { - register object *obj; - register i; + object *obj; + int i; boolean ichars[26]; for (i = 0; i < 26; i++) { @@ -268,14 +270,16 @@ next_avail_ichar() return('?'); } +void wait_for_ack() { while (rgetchar() != ' ') ; } +short pack_letter(prompt, mask) -char *prompt; -unsigned short mask; + char *prompt; + unsigned short mask; { short ch; unsigned short tmask = mask; @@ -310,6 +314,7 @@ unsigned short mask; return(ch); } +void take_off() { char desc[DCOLS]; @@ -333,10 +338,11 @@ take_off() } } +void wear() { short ch; - register object *obj; + object *obj; char desc[DCOLS]; if (rogue.armor) { @@ -365,8 +371,9 @@ wear() (void) reg_move(); } +void unwear(obj) -object *obj; + object *obj; { if (obj) { obj->in_use_flags &= (~BEING_WORN); @@ -374,18 +381,20 @@ object *obj; rogue.armor = (object *) 0; } +void do_wear(obj) -object *obj; + object *obj; { rogue.armor = obj; obj->in_use_flags |= BEING_WORN; obj->identified = 1; } +void wield() { short ch; - register object *obj; + object *obj; char desc[DCOLS]; if (rogue.weapon && rogue.weapon->is_cursed) { @@ -419,15 +428,17 @@ wield() } } +void do_wield(obj) -object *obj; + object *obj; { rogue.weapon = obj; obj->in_use_flags |= BEING_WIELDED; } +void unwield(obj) -object *obj; + object *obj; { if (obj) { obj->in_use_flags &= (~BEING_WIELDED); @@ -435,10 +446,11 @@ object *obj; rogue.weapon = (object *) 0; } +void call_it() { short ch; - register object *obj; + object *obj; struct id *id_table; char buf[MAX_TITLE_LENGTH+2]; @@ -463,8 +475,9 @@ call_it() } } +short pack_count(new_obj) -object *new_obj; + object *new_obj; { object *obj; short count = 0; @@ -492,8 +505,8 @@ object *new_obj; boolean mask_pack(pack, mask) -object *pack; -unsigned short mask; + object *pack; + unsigned short mask; { while (pack->next_object) { pack = pack->next_object; @@ -504,9 +517,10 @@ unsigned short mask; return(0); } +boolean is_pack_letter(c, mask) -short *c; -unsigned short *mask; + short *c; + unsigned short *mask; { if (((*c == '?') || (*c == '!') || (*c == ':') || (*c == '=') || (*c == ')') || (*c == ']') || (*c == '/') || (*c == ','))) { @@ -542,11 +556,13 @@ unsigned short *mask; return(((*c >= 'a') && (*c <= 'z')) || (*c == CANCEL) || (*c == LIST)); } +boolean has_amulet() { return(mask_pack(&rogue.pack, AMULET)); } +void kick_into_pack() { object *obj; @@ -556,7 +572,7 @@ kick_into_pack() if (!(dungeon[rogue.row][rogue.col] & OBJECT)) { message("nothing here", 0); } else { - if (obj = pick_up(rogue.row, rogue.col, &stat)) { + if ((obj = pick_up(rogue.row, rogue.col, &stat)) != NULL) { get_desc(obj, desc); if (obj->what_is == GOLD) { message(desc, 0); |
