summaryrefslogtreecommitdiff
path: root/games/rogue/pack.c
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>1998-08-22 08:56:02 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>1998-08-22 08:56:02 +0000
commit6910826c1b27cf6a9d4cb8400743d571d3c9a27b (patch)
tree9562c830236235b683790903daad5db093658719 /games/rogue/pack.c
parent92cf145f2c1e59139400da3a8db7b06cc24b7b54 (diff)
More largely NetBSD-inspired code cleanup
Diffstat (limited to 'games/rogue/pack.c')
-rw-r--r--games/rogue/pack.c66
1 files changed, 41 insertions, 25 deletions
diff --git a/games/rogue/pack.c b/games/rogue/pack.c
index 5151e5d8c77..cf0003b7f16 100644
--- a/games/rogue/pack.c
+++ b/games/rogue/pack.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: pack.c,v 1.3 1998/08/22 08:55:38 pjanzen Exp $ */
/* $NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $ */
/*
@@ -52,7 +53,7 @@ static char rcsid[] = "$NetBSD: pack.c,v 1.3 1995/04/22 10:27:54 cgd Exp $";
* 1.) No portion of this notice shall be removed.
* 2.) Credit shall not be taken for the creation of this source.
* 3.) This code is not to be traded, sold, or used for personal
- * gain or profit.
+ * gain or profit.
*
*/
@@ -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))) {
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 row, col, *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))) {
get_desc(obj, desc);
if (obj->what_is == GOLD) {
message(desc, 0);