+/* $NetBSD: pack.c,v 1.7 2003/08/07 09:37:39 agc Exp $ */
+
/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Timothy C. Stoehr.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-/*static char sccsid[] = "from: @(#)pack.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: pack.c,v 1.2 1993/08/01 18:52:20 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)pack.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: pack.c,v 1.7 2003/08/07 09:37:39 agc Exp $");
+#endif
#endif /* not lint */
/*
#include "rogue.h"
-char *curse_message = "you can't, it appears to be cursed";
-
-extern short levitate;
+const char *curse_message = "you can't, it appears to be cursed";
object *
add_to_pack(obj, pack, condense)
-object *obj, *pack;
+ object *obj, *pack;
+ int condense;
{
object *op;
if (condense) {
- if (op = check_duplicate(obj, pack)) {
+ if ((op = check_duplicate(obj, pack)) != NULL) {
free_object(obj);
return(op);
} else {
return(obj);
}
+void
take_from_pack(obj, pack)
-object *obj, *pack;
+ object *obj, *pack;
{
while (pack->next_object != obj) {
pack = pack->next_object;
object *
pick_up(row, col, status)
-short *status;
+ short *status;
+ int row, col;
{
object *obj;
return(obj);
}
+void
drop()
{
object *obj, *new;
object *
check_duplicate(obj, pack)
-object *obj, *pack;
+ object *obj, *pack;
{
object *op;
return(0);
}
+short
next_avail_ichar()
{
- register object *obj;
- register i;
+ object *obj;
+ int i;
boolean ichars[26];
for (i = 0; i < 26; i++) {
return('?');
}
+void
wait_for_ack()
{
while (rgetchar() != ' ') ;
}
+short
pack_letter(prompt, mask)
-char *prompt;
-unsigned short mask;
+ const char *prompt;
+ unsigned short mask;
{
short ch;
unsigned short tmask = mask;
if (ch == LIST) {
check_message();
+ mask = tmask;
inventory(&rogue.pack, mask);
} else {
break;
return(ch);
}
+void
take_off()
{
char desc[DCOLS];
}
}
+void
wear()
{
short ch;
- register object *obj;
+ object *obj;
char desc[DCOLS];
if (rogue.armor) {
(void) reg_move();
}
+void
unwear(obj)
-object *obj;
+ object *obj;
{
if (obj) {
obj->in_use_flags &= (~BEING_WORN);
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) {
}
}
+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);
rogue.weapon = (object *) 0;
}
+void
call_it()
{
short ch;
- register object *obj;
+ object *obj;
struct id *id_table;
char buf[MAX_TITLE_LENGTH+2];
}
}
+short
pack_count(new_obj)
-object *new_obj;
+ const object *new_obj;
{
object *obj;
short count = 0;
boolean
mask_pack(pack, mask)
-object *pack;
-unsigned short mask;
+ const object *pack;
+ unsigned short mask;
{
while (pack->next_object) {
pack = pack->next_object;
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 == ','))) {
return(((*c >= 'a') && (*c <= 'z')) || (*c == CANCEL) || (*c == LIST));
}
+boolean
has_amulet()
{
return(mask_pack(&rogue.pack, AMULET));
}
+void
kick_into_pack()
{
object *obj;
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);