BUC patch
This adds the BUC-patch, except that it includes four separate choices for blessed/cursed/uncursed/unknown. The patch only applies to full menu styles. --Ken A (Incidentally, I have a suggestion: when deciding what's the first line for purposes of mailing out messages, use the first nonblank line...)
This commit is contained in:
@@ -475,6 +475,7 @@ msg_window option for ^P in TTY mode (Jay Tilton)
|
|||||||
ninjas should get multishot bonus with yumi and ya (Dylan O'Donnell)
|
ninjas should get multishot bonus with yumi and ya (Dylan O'Donnell)
|
||||||
put prisoners in the Dark One's dungeon (Dylan O'Donnell)
|
put prisoners in the Dark One's dungeon (Dylan O'Donnell)
|
||||||
add leather cloak so soldiers don't have elven cloaks
|
add leather cloak so soldiers don't have elven cloaks
|
||||||
|
add Tom Friedetzky's BUC-patch (applies to full menustyle only)
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific New Features
|
Platform- and/or Interface-Specific New Features
|
||||||
|
|||||||
@@ -780,6 +780,7 @@ E void NDECL(free_invbuf);
|
|||||||
E void NDECL(reassign);
|
E void NDECL(reassign);
|
||||||
E int NDECL(doorganize);
|
E int NDECL(doorganize);
|
||||||
E int FDECL(count_unpaid, (struct obj *));
|
E int FDECL(count_unpaid, (struct obj *));
|
||||||
|
E int FDECL(count_buc, (struct obj *,int));
|
||||||
E void FDECL(carry_obj_effects, (struct obj *));
|
E void FDECL(carry_obj_effects, (struct obj *));
|
||||||
|
|
||||||
/* ### ioctl.c ### */
|
/* ### ioctl.c ### */
|
||||||
|
|||||||
@@ -158,6 +158,10 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
|
|||||||
#define ALL_TYPES 0x10
|
#define ALL_TYPES 0x10
|
||||||
#define BILLED_TYPES 0x20
|
#define BILLED_TYPES 0x20
|
||||||
#define CHOOSE_ALL 0x40
|
#define CHOOSE_ALL 0x40
|
||||||
|
#define BUC_BLESSED 0x80
|
||||||
|
#define BUC_CURSED 0x100
|
||||||
|
#define BUC_UNCURSED 0x200
|
||||||
|
#define BUC_UNKNOWN 0x400
|
||||||
#define ALL_TYPES_SELECTED -2
|
#define ALL_TYPES_SELECTED -2
|
||||||
|
|
||||||
/* Flags to control find_mid() */
|
/* Flags to control find_mid() */
|
||||||
|
|||||||
44
src/do.c
44
src/do.c
@@ -608,6 +608,10 @@ int retry;
|
|||||||
menu_item *pick_list;
|
menu_item *pick_list;
|
||||||
boolean all_categories = TRUE;
|
boolean all_categories = TRUE;
|
||||||
boolean drop_everything = FALSE;
|
boolean drop_everything = FALSE;
|
||||||
|
boolean drop_blessed = FALSE;
|
||||||
|
boolean drop_cursed = FALSE;
|
||||||
|
boolean drop_uncursed = FALSE;
|
||||||
|
boolean drop_buc_unknown = FALSE;
|
||||||
|
|
||||||
#ifndef GOLDOBJ
|
#ifndef GOLDOBJ
|
||||||
if (u.ugold) {
|
if (u.ugold) {
|
||||||
@@ -626,7 +630,8 @@ int retry;
|
|||||||
all_categories = FALSE;
|
all_categories = FALSE;
|
||||||
n = query_category("Drop what type of items?",
|
n = query_category("Drop what type of items?",
|
||||||
invent,
|
invent,
|
||||||
UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL,
|
UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL |
|
||||||
|
BUC_BLESSED | BUC_CURSED | BUC_UNCURSED | BUC_UNKNOWN,
|
||||||
&pick_list, PICK_ANY);
|
&pick_list, PICK_ANY);
|
||||||
if (!n) goto drop_done;
|
if (!n) goto drop_done;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
@@ -634,6 +639,14 @@ int retry;
|
|||||||
all_categories = TRUE;
|
all_categories = TRUE;
|
||||||
else if (pick_list[i].item.a_int == 'A')
|
else if (pick_list[i].item.a_int == 'A')
|
||||||
drop_everything = TRUE;
|
drop_everything = TRUE;
|
||||||
|
else if (pick_list[i].item.a_int == 'B')
|
||||||
|
drop_blessed = TRUE;
|
||||||
|
else if (pick_list[i].item.a_int == 'C')
|
||||||
|
drop_cursed = TRUE;
|
||||||
|
else if (pick_list[i].item.a_int == 'U')
|
||||||
|
drop_uncursed = TRUE;
|
||||||
|
else if (pick_list[i].item.a_int == 'X')
|
||||||
|
drop_buc_unknown = TRUE;
|
||||||
else
|
else
|
||||||
add_valid_menu_class(pick_list[i].item.a_int);
|
add_valid_menu_class(pick_list[i].item.a_int);
|
||||||
}
|
}
|
||||||
@@ -653,6 +666,35 @@ int retry;
|
|||||||
otmp2 = otmp->nobj;
|
otmp2 = otmp->nobj;
|
||||||
n_dropped += drop(otmp);
|
n_dropped += drop(otmp);
|
||||||
}
|
}
|
||||||
|
} else if (drop_blessed) {
|
||||||
|
for(otmp = invent; otmp; otmp = otmp2) {
|
||||||
|
/* zw, gold is never blessed or cursed */
|
||||||
|
otmp2 = otmp->nobj;
|
||||||
|
if (otmp->oclass != GOLD_CLASS && otmp->bknown && otmp->blessed)
|
||||||
|
n_dropped += drop(otmp);
|
||||||
|
}
|
||||||
|
} else if (drop_cursed) {
|
||||||
|
for(otmp = invent; otmp; otmp = otmp2) {
|
||||||
|
/* zw, gold is never blessed or cursed */
|
||||||
|
otmp2 = otmp->nobj;
|
||||||
|
if (otmp->oclass != GOLD_CLASS && otmp->bknown && otmp->cursed)
|
||||||
|
n_dropped += drop(otmp);
|
||||||
|
}
|
||||||
|
} else if (drop_uncursed) {
|
||||||
|
for(otmp = invent; otmp; otmp = otmp2) {
|
||||||
|
/* zw, gold is never blessed or cursed */
|
||||||
|
otmp2 = otmp->nobj;
|
||||||
|
if (otmp->oclass != GOLD_CLASS &&
|
||||||
|
otmp->bknown && !otmp->blessed && !otmp->cursed)
|
||||||
|
n_dropped += drop(otmp);
|
||||||
|
}
|
||||||
|
} else if (drop_buc_unknown) {
|
||||||
|
for(otmp = invent; otmp; otmp = otmp2) {
|
||||||
|
/* zw, gold is never blessed or cursed */
|
||||||
|
otmp2 = otmp->nobj;
|
||||||
|
if (otmp->oclass != GOLD_CLASS && !otmp->bknown)
|
||||||
|
n_dropped += drop(otmp);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* should coordinate with perm invent, maybe not show worn items */
|
/* should coordinate with perm invent, maybe not show worn items */
|
||||||
n = query_objlist("What would you like to drop?", invent,
|
n = query_objlist("What would you like to drop?", invent,
|
||||||
|
|||||||
39
src/invent.c
39
src/invent.c
@@ -1631,6 +1631,45 @@ count_unpaid(list)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the number of items with b/u/c/unknown within the given list.
|
||||||
|
* This does NOT include contained objects.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
count_buc(list, type)
|
||||||
|
struct obj *list;
|
||||||
|
int type;
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
while (list) {
|
||||||
|
switch(type) {
|
||||||
|
case BUC_BLESSED:
|
||||||
|
if (list->oclass != GOLD_CLASS && list->bknown && list->blessed)
|
||||||
|
count++;
|
||||||
|
break;
|
||||||
|
case BUC_CURSED:
|
||||||
|
if (list->oclass != GOLD_CLASS && list->bknown && list->cursed)
|
||||||
|
count++;
|
||||||
|
break;
|
||||||
|
case BUC_UNCURSED:
|
||||||
|
if (list->oclass != GOLD_CLASS &&
|
||||||
|
list->bknown && !list->blessed && !list->cursed)
|
||||||
|
count++;
|
||||||
|
break;
|
||||||
|
case BUC_UNKNOWN:
|
||||||
|
if (list->oclass != GOLD_CLASS && !list->bknown)
|
||||||
|
count++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
impossible("need count of curse status %d?", type);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
list = list->nobj;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
STATIC_OVL void
|
STATIC_OVL void
|
||||||
dounpaid()
|
dounpaid()
|
||||||
{
|
{
|
||||||
|
|||||||
50
src/pickup.c
50
src/pickup.c
@@ -716,14 +716,33 @@ int how; /* type of query */
|
|||||||
char invlet;
|
char invlet;
|
||||||
int ccount;
|
int ccount;
|
||||||
boolean do_unpaid = FALSE;
|
boolean do_unpaid = FALSE;
|
||||||
|
boolean do_blessed = FALSE, do_cursed = FALSE, do_uncursed = FALSE,
|
||||||
|
do_buc_unknown = FALSE;
|
||||||
|
int num_buc_types = 0;
|
||||||
|
|
||||||
*pick_list = (menu_item *) 0;
|
*pick_list = (menu_item *) 0;
|
||||||
if (!olist) return 0;
|
if (!olist) return 0;
|
||||||
if ((qflags & UNPAID_TYPES) && count_unpaid(olist)) do_unpaid = TRUE;
|
if ((qflags & UNPAID_TYPES) && count_unpaid(olist)) do_unpaid = TRUE;
|
||||||
|
if ((qflags & BUC_BLESSED) && count_buc(olist, BUC_BLESSED)) {
|
||||||
|
do_blessed = TRUE;
|
||||||
|
num_buc_types++;
|
||||||
|
}
|
||||||
|
if ((qflags & BUC_CURSED) && count_buc(olist, BUC_CURSED)) {
|
||||||
|
do_cursed = TRUE;
|
||||||
|
num_buc_types++;
|
||||||
|
}
|
||||||
|
if ((qflags & BUC_UNCURSED) && count_buc(olist, BUC_UNCURSED)) {
|
||||||
|
do_uncursed = TRUE;
|
||||||
|
num_buc_types++;
|
||||||
|
}
|
||||||
|
if ((qflags & BUC_UNKNOWN) && count_buc(olist, BUC_UNKNOWN)) {
|
||||||
|
do_buc_unknown = TRUE;
|
||||||
|
num_buc_types++;
|
||||||
|
}
|
||||||
|
|
||||||
ccount = count_categories(olist, qflags);
|
ccount = count_categories(olist, qflags);
|
||||||
/* no point in actually showing a menu for a single category */
|
/* no point in actually showing a menu for a single category */
|
||||||
if (ccount == 1 && !do_unpaid && !(qflags & BILLED_TYPES)) {
|
if (ccount == 1 && !do_unpaid && num_buc_types <= 1 && !(qflags & BILLED_TYPES)) {
|
||||||
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
|
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
|
||||||
if ((qflags & WORN_TYPES) &&
|
if ((qflags & WORN_TYPES) &&
|
||||||
!(curr->owornmask & (W_ARMOR|W_RING|W_AMUL|W_TOOL|W_WEP|W_SWAPWEP|W_QUIVER)))
|
!(curr->owornmask & (W_ARMOR|W_RING|W_AMUL|W_TOOL|W_WEP|W_SWAPWEP|W_QUIVER)))
|
||||||
@@ -805,6 +824,35 @@ int how; /* type of query */
|
|||||||
"Auto-select every item being worn" :
|
"Auto-select every item being worn" :
|
||||||
"Auto-select every item", MENU_UNSELECTED);
|
"Auto-select every item", MENU_UNSELECTED);
|
||||||
}
|
}
|
||||||
|
/* items with b/u/c/unknown if there are any */
|
||||||
|
if (do_blessed) {
|
||||||
|
invlet = 'B';
|
||||||
|
any.a_void = 0;
|
||||||
|
any.a_int = 'B';
|
||||||
|
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
|
||||||
|
"Auto-select blessed items", MENU_UNSELECTED);
|
||||||
|
}
|
||||||
|
if (do_cursed) {
|
||||||
|
invlet = 'C';
|
||||||
|
any.a_void = 0;
|
||||||
|
any.a_int = 'C';
|
||||||
|
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
|
||||||
|
"Auto-select cursed items", MENU_UNSELECTED);
|
||||||
|
}
|
||||||
|
if (do_uncursed) {
|
||||||
|
invlet = 'U';
|
||||||
|
any.a_void = 0;
|
||||||
|
any.a_int = 'U';
|
||||||
|
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
|
||||||
|
"Auto-select known uncursed items", MENU_UNSELECTED);
|
||||||
|
}
|
||||||
|
if (do_buc_unknown) {
|
||||||
|
invlet = 'X';
|
||||||
|
any.a_void = 0;
|
||||||
|
any.a_int = 'X';
|
||||||
|
add_menu(win, NO_GLYPH, &any, invlet, 0, ATR_NONE,
|
||||||
|
"Auto-select un-b/u/c known items", MENU_UNSELECTED);
|
||||||
|
}
|
||||||
end_menu(win, qstr);
|
end_menu(win, qstr);
|
||||||
n = select_menu(win, how, pick_list);
|
n = select_menu(win, how, pick_list);
|
||||||
destroy_nhwindow(win);
|
destroy_nhwindow(win);
|
||||||
|
|||||||
Reference in New Issue
Block a user