and use it for the chopping prompt. Also tweak eat.lua to allow y=e for inventory as well. Oh, and finally fix beheld handling to allow diagonal movement.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3787 c06c8d41-db1a-0410-9941-cceddc491573
VOXLOCDUHOAFIKRTSISYMOA2QFY3TSHQGR7BKGGQ2VZ5BUUKUQYAC
C3OUSRCHDUOJ6ELVDX6YWMQQVXDJLNEXTXWCDDAYWTKNPFPNSONAC
Q3XHNSHW6FI4JCXSEABATRFBJPMCF7PXNG2K6ZQTRRPVMIZFHUBQC
TOPYNQFDXFXNMNOW2LACAGZQIIBAZFS7NK4CBIA2IF6UUB6Y6ZJAC
YV5KGOLCV7DBD6P4ARYQDLVO4AAH7NDJPF6PNASLQSRAKJRVO4YAC
NJYEH3GBN6OXEMHKOTHVJNIPHXIVW3ZFCLIHYV7I5NFNJZACOYEQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
JM7UAK777RAVDAVLQLEOBRTGNW2B47S5G55XITJXO243IUNZHVYQC
L6YPJVODN32IYLEZQQZE2ENH3XDAZ63IQIDX3PB4CJEK3A4NUNSAC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
7Q4H6B62UZACQOUDHCHPMPBYEBXM5GVQINIHVHM4KLRENSH6VGTAC
5TG5LXU4DX65KMWCZ7YJHOB3VAETQAVBUHEUSQTPMA327XV2HQWAC
ACDPN464TK2LKLHSDN3YVRHAPF7WLSLLU3UHIYEXKFDEZPEU3XSQC
LJK4ZQATLSB4MKZG3ARZX5V6RFGTN3NLCN6GTCUGJQKU26SOXMUAC
static std::string _list_alternative_yes(char yes1, char yes2,
bool lowered = false,
bool brackets = false)
{
std::string help = "";
bool print_yes = false;
if (yes1 != 'Y')
{
if (lowered)
help += tolower(yes1);
else
help += yes1;
print_yes = true;
}
if (yes2 != 'Y' && yes2 != yes1)
{
if (print_yes)
help += "/";
if (lowered)
help += tolower(yes2);
else
help += yes2;
print_yes = true;
}
if (print_yes)
{
if (brackets)
help = " (" + help + ")";
else
help = "/" + help;
}
return help;
}
static const char* _list_allowed_keys(char yes1, char yes2,
bool lowered = false)
{
std::string result = " [";
result += (lowered ? "y" : "Y");
result += _list_alternative_yes(yes1, yes2, lowered);
result += (lowered ? "/n/q" : "/N/Q");
result += "]";
return (result.c_str());
}
mprf("%s %s? [y/n/q/c]", can_bottle_blood_from_corpse(mitm[o].plus)?
"Bottle" : "Butcher",
mitm[o].name(DESC_NOCAP_A).c_str());
// possible results:
// 0 - cancel all butchery (quit)
// 1 - say no to this butchery, continue prompting
// 2 - OK this butchery
// Yes, this is a hack because it's too annoying to adapt
// yesnoquit() to this purpose.
int result = 100;
while (result == 100)
snprintf(info, INFO_SIZE, "%s %s?",
can_bottle_blood_from_corpse(mitm[o].plus)? "Bottle" : "Butcher",
mitm[o].name(DESC_NOCAP_A).c_str());
const int result = yesnoquit(info, true, 'N', false, 'C', 'D');
if ( result == -1 )
const int keyin = getchm(KC_CONFIRM);
if (keyin == CK_ESCAPE || keyin == 'q' || keyin == 'Q')
result = 0;
if (keyin == ' ' || keyin == '\r' || keyin == '\n' ||
keyin == 'n' || keyin == 'N')
result = 1;
if (keyin == 'y' || keyin == 'Y' || keyin == 'c' || keyin == 'C'
|| keyin == 'D' ) // D for users of the old keyset
result = 2;
}
if ( result == 0 )
{
int olddist = distance(you.x_pos, you.y_pos, pos.x, pos.y);
int newdist = distance(you.x_pos + move_x, you.y_pos + move_y,
pos.x, pos.y);
int olddist = grid_distance(you.x_pos, you.y_pos, pos.x, pos.y);
int newdist = grid_distance(you.x_pos + move_x, you.y_pos + move_y,
pos.x, pos.y);