diff options
Diffstat (limited to 'crawl-ref/source/direct.cc')
-rw-r--r-- | crawl-ref/source/direct.cc | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 753adf3207..665ebef4e8 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -45,6 +45,8 @@ #include "macro.h" #endif +int fizzlecheck_on = 1; + enum LOSSelect { LOS_ANY = 0x00, @@ -127,7 +129,8 @@ static bool is_mapped(int x, int y) // // targetting mode is handled by look_around() //--------------------------------------------------------------- -void direction( struct dist &moves, int restrict, int mode ) + +void direction2( struct dist &moves, int restrict, int mode ) { bool dirChosen = false; bool targChosen = false; @@ -320,6 +323,35 @@ void direction( struct dist &moves, int restrict, int mode ) moves.ty = you.y_pos + moves.dy * my; } +/* safe version of direction */ +void direction( struct dist &moves, int restrict, int mode, + bool confirm_fizzle ) +{ + while ( 1 ) { + direction2( moves, restrict, mode ); + if ( moves.isMe && Options.confirm_self_target == true && + mode != TARG_FRIEND ) { + if ( yesno("Really target yourself? ", false, 'n') ) + return; + else + mpr("Choose a better target.", MSGCH_PROMPT); + } + else if ( confirm_fizzle && !moves.isValid && fizzlecheck_on && + Options.confirm_spell_fizzle ) + { + if ( yesno("Really fizzle? ", false, 'n') ) + return; + else + mpr("Try again.", MSGCH_PROMPT); + } + else + { + return; + } + } +} + + // Attempts to describe a square that's not in line-of-sight. If // there's a stash on the square, announces the top item and number // of items, otherwise, if there's a stair that's in the travel |