Add ^G as an alias for Escape in yesno and yesnoquit.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6764 c06c8d41-db1a-0410-9941-cceddc491573
UR4ND452TYBKRQ4W2CY6VXHOFSWU2Y4MVRNEMFM4LKLA6S7OBYHQC
SIDH2P7NBIG5KEOE27XHD3ZT2NQ2OJZFN6VZXWNWYFFY5YVXSSVQC
45FTVJJ5FMXBXQ2GVUZVJZU6Y6NUYG2JZIHWVMONA7QYYCZQSM2QC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
SSQP7MS6LZYY73QEF66EYNNQJJSB6TVLLWXLWL7JJAYBLXCEY2XAC
HIPFIMUOA7DFOFV3DQ55YZJVGNU2GNDYFUCB4MRPUR5DTYDO5YMAC
JJULXW764V5C2HJKZNWQAEWB6QM5YZADD7ZCE35LYTBFEM6PMYCAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
HMC247EGUJ3Q25DQ3VKUCIGLIO4SZORFQQWAPAF6S2WLQY3WU5TQC
77H4BWWPPGLM3PLZH4QTAJRXIZTSDVNCOKZE223I437FN2UJ34RQC
/*
* Warn if interlevel travel is going to take you outside levels in
* the range [src,dest].
*/
class deviant_route_warning
{
private:
travel_target target;
bool warned;
public:
deviant_route_warning(): target(), warned(false)
{
}
void new_dest(const travel_target &dest);
bool warn_continue_travel(const travel_target &des,
const level_id &deviant);
};
void deviant_route_warning::new_dest(const travel_target &dest)
{
if (target != dest)
{
warned = false;
target = dest;
}
}
// Returns true if the player wants to continue travelling after the warning.
bool deviant_route_warning::warn_continue_travel(
const travel_target &dest, const level_id &deviant)
{
// We've already prompted, don't ask again, on the player's head be it.
if (target == dest && warned)
return (true);
target = dest;
const std::string prompt =
make_stringf("Have to go through %s. Continue?",
deviant.describe().c_str());
// If the user says "Yes, shut up and take me there", we won't ask
// again for that destination. If the user says "No", we will
// prompt again.
cursor_control con(true);
return ((warned = yesno(prompt.c_str(), true, 'n', true, false)));
}
// Is this stair going offlevel?
if ((level_target.p.id != current
|| level_target.p.pos != best_stair)
&& _Src_Dest_Level_Delta != -1)
{
// If so, is the original level closer to the target level than
// the destination of the stair?
LevelInfo &li = travel_cache.get_level_info(current);
const stair_info *dest_stair = li.get_stair(best_stair);
if (dest_stair && dest_stair->destination.id.is_valid())
{
const int ndist =
level_distance(dest_stair->destination.id,
level_target.p.id);
if (_Src_Dest_Level_Delta < ndist
&& !_Route_Warning.warn_continue_travel(
level_target,
dest_stair->destination.id))
return (false);
}
}