* This source herein may be modified and/or distributed by anybody who
* so desires, with the following restrictions:
* 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
static char sccsid
[] = "@(#)pack.c 5.1 (Berkeley) %G%";
char *curse_message
= "you can't, it appears to be cursed";
add_to_pack(obj
, pack
, condense
)
if (op
= check_duplicate(obj
, pack
)) {
obj
->ichar
= next_avail_ichar();
if (pack
->next_object
== 0) {
while (op
->next_object
) {
take_from_pack(obj
, pack
)
while (pack
->next_object
!= obj
) {
pack
= pack
->next_object
;
pack
->next_object
= pack
->next_object
->next_object
;
/* Note: *status is set to 0 if the rogue attempts to pick up a scroll
* of scare-monster and it turns to dust. *status is otherwise set to 1.
pick_up(row
, col
, status
)
message("you're floating in the air!", 0);
obj
= object_at(&level_objects
, row
, col
);
message("pick_up(): inconsistent", 1);
if ( (obj
->what_is
== SCROL
) &&
(obj
->which_kind
== SCARE_MONSTER
) &&
message("the scroll turns to dust as you pick it up", 0);
dungeon
[row
][col
] &= (~OBJECT
);
vanish(obj
, 0, &level_objects
);
if (id_scrolls
[SCARE_MONSTER
].id_status
== UNIDENTIFIED
) {
id_scrolls
[SCARE_MONSTER
].id_status
= IDENTIFIED
;
if (obj
->what_is
== GOLD
) {
rogue
.gold
+= obj
->quantity
;
dungeon
[row
][col
] &= ~(OBJECT
);
take_from_pack(obj
, &level_objects
);
return(obj
); /* obj will be free_object()ed in caller */
if (pack_count(obj
) >= MAX_PACK_COUNT
) {
message("pack too full", 1);
dungeon
[row
][col
] &= ~(OBJECT
);
take_from_pack(obj
, &level_objects
);
obj
= add_to_pack(obj
, &rogue
.pack
, 1);
if (dungeon
[rogue
.row
][rogue
.col
] & (OBJECT
| STAIRS
| TRAP
)) {
message("there's already something there", 0);
if (!rogue
.pack
.next_object
) {
message("you have nothing to drop", 0);
if ((ch
= pack_letter("drop what?", ALL_OBJECTS
)) == CANCEL
) {
if (!(obj
= get_letter_object(ch
))) {
message("no such item.", 0);
if (obj
->in_use_flags
& BEING_WIELDED
) {
message(curse_message
, 0);
} else if (obj
->in_use_flags
& BEING_WORN
) {
message(curse_message
, 0);
} else if (obj
->in_use_flags
& ON_EITHER_HAND
) {
message(curse_message
, 0);
if ((obj
->quantity
> 1) && (obj
->what_is
!= WEAPON
)) {
take_from_pack(obj
, &rogue
.pack
);
place_at(obj
, rogue
.row
, rogue
.col
);
(void) strcpy(desc
, "dropped ");
check_duplicate(obj
, pack
)
if (!(obj
->what_is
& (WEAPON
| FOOD
| SCROL
| POTION
))) {
if ((obj
->what_is
== FOOD
) && (obj
->which_kind
== FRUIT
)) {
if ((op
->what_is
== obj
->what_is
) &&
(op
->which_kind
== obj
->which_kind
)) {
if ((obj
->what_is
!= WEAPON
) ||
((obj
->what_is
== WEAPON
) &&
((obj
->which_kind
== ARROW
) ||
(obj
->which_kind
== DAGGER
) ||
(obj
->which_kind
== DART
) ||
(obj
->which_kind
== SHURIKEN
)) &&
(obj
->quiver
== op
->quiver
))) {
op
->quantity
+= obj
->quantity
;
for (i
= 0; i
< 26; i
++) {
obj
= rogue
.pack
.next_object
;
ichars
[(obj
->ichar
- 'a')] = 1;
for (i
= 0; i
< 26; i
++) {
while (rgetchar() != ' ') ;
pack_letter(prompt
, mask
)
unsigned short tmask
= mask
;
if (!mask_pack(&rogue
.pack
, mask
)) {
message("nothing appropriate", 0);
if (!is_pack_letter(&ch
, &mask
)) {
inventory(&rogue
.pack
, mask
);
if (rogue
.armor
->is_cursed
) {
message(curse_message
, 0);
(void) strcpy(desc
, "was wearing ");
message("not wearing any", 0);
message("your already wearing some", 0);
ch
= pack_letter("wear what?", ARMOR
);
if (!(obj
= get_letter_object(ch
))) {
message("no such item.", 0);
if (obj
->what_is
!= ARMOR
) {
message("you can't wear that", 0);
(void) strcpy(desc
, "wearing ");
obj
->in_use_flags
&= (~BEING_WORN
);
rogue
.armor
= (object
*) 0;
obj
->in_use_flags
|= BEING_WORN
;
if (rogue
.weapon
&& rogue
.weapon
->is_cursed
) {
message(curse_message
, 0);
ch
= pack_letter("wield what?", WEAPON
);
if (!(obj
= get_letter_object(ch
))) {
message("No such item.", 0);
if (obj
->what_is
& (ARMOR
| RING
)) {
sprintf(desc
, "you can't wield %s",
((obj
->what_is
== ARMOR
) ? "armor" : "rings"));
if (obj
->in_use_flags
& BEING_WIELDED
) {
(void) strcpy(desc
, "wielding ");
obj
->in_use_flags
|= BEING_WIELDED
;
obj
->in_use_flags
&= (~BEING_WIELDED
);
rogue
.weapon
= (object
*) 0;
char buf
[MAX_TITLE_LENGTH
+2];
ch
= pack_letter("call what?", (SCROL
| POTION
| WAND
| RING
));
if (!(obj
= get_letter_object(ch
))) {
message("no such item.", 0);
if (!(obj
->what_is
& (SCROL
| POTION
| WAND
| RING
))) {
message("surely you already know what that's called", 0);
id_table
= get_id_table(obj
);
if (get_input_line("call it:","",buf
,id_table
[obj
->which_kind
].title
,1,1)) {
id_table
[obj
->which_kind
].id_status
= CALLED
;
(void) strcpy(id_table
[obj
->which_kind
].title
, buf
);
obj
= rogue
.pack
.next_object
;
if (obj
->what_is
!= WEAPON
) {
} else if ((new_obj
->what_is
!= WEAPON
) ||
((obj
->which_kind
!= ARROW
) &&
(obj
->which_kind
!= DAGGER
) &&
(obj
->which_kind
!= DART
) &&
(obj
->which_kind
!= SHURIKEN
)) ||
(new_obj
->which_kind
!= obj
->which_kind
) ||
(obj
->quiver
!= new_obj
->quiver
)) {
while (pack
->next_object
) {
pack
= pack
->next_object
;
if (pack
->what_is
& mask
) {
if (((*c
== '?') || (*c
== '!') || (*c
== ':') || (*c
== '=') ||
(*c
== ')') || (*c
== ']') || (*c
== '/') || (*c
== ','))) {
return(((*c
>= 'a') && (*c
<= 'z')) || (*c
== CANCEL
) || (*c
== LIST
));
return(mask_pack(&rogue
.pack
, AMULET
));
if (!(dungeon
[rogue
.row
][rogue
.col
] & OBJECT
)) {
message("nothing here", 0);
if (obj
= pick_up(rogue
.row
, rogue
.col
, &stat
)) {
if (obj
->what_is
== GOLD
) {