-/* $NetBSD: pack.c,v 1.8 2007/12/27 23:53:00 dholland Exp $ */
+/* $NetBSD: pack.c,v 1.12 2011/05/23 23:01:17 joerg Exp $ */
/*
* Copyright (c) 1988, 1993
#if 0
static char sccsid[] = "@(#)pack.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pack.c,v 1.8 2007/12/27 23:53:00 dholland Exp $");
+__RCSID("$NetBSD: pack.c,v 1.12 2011/05/23 23:01:17 joerg Exp $");
#endif
#endif /* not lint */
#include "rogue.h"
-const char *curse_message = "you can't, it appears to be cursed";
+const char curse_message[] = "you can't, it appears to be cursed";
+
+static object *check_duplicate(object *, object *);
+static boolean is_pack_letter(short *, unsigned short *);
+static boolean mask_pack(const object *, unsigned short);
+static short next_avail_ichar(void);
object *
-add_to_pack(obj, pack, condense)
- object *obj, *pack;
- int condense;
+add_to_pack(object *obj, object *pack, int condense)
{
object *op;
}
void
-take_from_pack(obj, pack)
- object *obj, *pack;
+take_from_pack(object *obj, object *pack)
{
while (pack->next_object != obj) {
pack = pack->next_object;
*/
object *
-pick_up(row, col, status)
- short *status;
- int row, col;
+pick_up(int row, int col, short *status)
{
object *obj;
if (levitate) {
messagef(0, "you're floating in the air!");
- return((object *) 0);
+ return NULL;
}
obj = object_at(&level_objects, row, col);
if (!obj) {
if (id_scrolls[SCARE_MONSTER].id_status == UNIDENTIFIED) {
id_scrolls[SCARE_MONSTER].id_status = IDENTIFIED;
}
- return((object *) 0);
+ return NULL;
}
if (obj->what_is == GOLD) {
rogue.gold += obj->quantity;
}
if (pack_count(obj) >= MAX_PACK_COUNT) {
messagef(1, "pack too full");
- return((object *) 0);
+ return NULL;
}
dungeon[row][col] &= ~(OBJECT);
take_from_pack(obj, &level_objects);
}
void
-drop()
+drop(void)
{
object *obj, *new;
short ch;
place_at(obj, rogue.row, rogue.col);
get_desc(obj, desc, sizeof(desc));
messagef(0, "dropped %s", desc);
- (void) reg_move();
+ (void)reg_move();
}
-object *
-check_duplicate(obj, pack)
- object *obj, *pack;
+static object *
+check_duplicate(object *obj, object *pack)
{
object *op;
op = pack->next_object;
while (op) {
- if ((op->what_is == obj->what_is) &&
+ if ((op->what_is == obj->what_is) &&
(op->which_kind == obj->which_kind)) {
if ((obj->what_is != WEAPON) ||
return(0);
}
-short
-next_avail_ichar()
+static short
+next_avail_ichar(void)
{
object *obj;
int i;
}
void
-wait_for_ack()
+wait_for_ack(void)
{
- while (rgetchar() != ' ') ;
+ while (rgetchar() != ' ')
+ ;
}
short
-pack_letter(prompt, mask)
- const char *prompt;
- unsigned short mask;
+pack_letter(const char *prompt, unsigned short mask)
{
short ch;
unsigned short tmask = mask;
}
void
-take_off()
+take_off(void)
{
char desc[DCOLS];
object *obj;
get_desc(obj, desc, sizeof(desc));
messagef(0, "was wearing %s", desc);
print_stats(STAT_ARMOR);
- (void) reg_move();
+ (void)reg_move();
}
} else {
messagef(0, "not wearing any");
}
void
-wear()
+wear(void)
{
short ch;
object *obj;
messagef(0, "wearing %s", desc);
do_wear(obj);
print_stats(STAT_ARMOR);
- (void) reg_move();
+ (void)reg_move();
}
void
-unwear(obj)
- object *obj;
+unwear(object *obj)
{
if (obj) {
obj->in_use_flags &= (~BEING_WORN);
}
- rogue.armor = (object *) 0;
+ rogue.armor = NULL;
}
void
-do_wear(obj)
- object *obj;
+do_wear(object *obj)
{
rogue.armor = obj;
obj->in_use_flags |= BEING_WORN;
}
void
-wield()
+wield(void)
{
short ch;
object *obj;
get_desc(obj, desc, sizeof(desc));
messagef(0, "wielding %s", desc);
do_wield(obj);
- (void) reg_move();
+ (void)reg_move();
}
}
void
-do_wield(obj)
- object *obj;
+do_wield(object *obj)
{
rogue.weapon = obj;
obj->in_use_flags |= BEING_WIELDED;
}
void
-unwield(obj)
- object *obj;
+unwield(object *obj)
{
if (obj) {
obj->in_use_flags &= (~BEING_WIELDED);
}
- rogue.weapon = (object *) 0;
+ rogue.weapon = NULL;
}
void
-call_it()
+call_it(void)
{
short ch;
object *obj;
if (get_input_line("call it:", "", buf, sizeof(buf),
id_table[obj->which_kind].title, 1, 1)) {
id_table[obj->which_kind].id_status = CALLED;
- (void) strlcpy(id_table[obj->which_kind].title, buf,
+ (void)strlcpy(id_table[obj->which_kind].title, buf,
sizeof(id_table[obj->which_kind].title));
}
}
short
-pack_count(new_obj)
- const object *new_obj;
+pack_count(const object *new_obj)
{
object *obj;
short count = 0;
return(count);
}
-boolean
-mask_pack(pack, mask)
- const object *pack;
- unsigned short mask;
+static boolean
+mask_pack(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;
+static boolean
+is_pack_letter(short *c, unsigned short *mask)
{
if (((*c == '?') || (*c == '!') || (*c == ':') || (*c == '=') ||
(*c == ')') || (*c == ']') || (*c == '/') || (*c == ','))) {
}
boolean
-has_amulet()
+has_amulet(void)
{
return(mask_pack(&rogue.pack, AMULET));
}
void
-kick_into_pack()
+kick_into_pack(void)
{
object *obj;
char desc[DCOLS];
}
}
if (obj || (!stat)) {
- (void) reg_move();
+ (void)reg_move();
}
}
}