From 87c95a753d11b0b540f7c6a3d3e7f8a8b67ae3c1 Mon Sep 17 00:00:00 2001 From: ennewalker Date: Sat, 5 Jul 2008 14:53:04 +0000 Subject: [2010192] Fixing issue where cancelling a ranged attack (e.g. "Really fire on...?") wouldn't really cancel the attack. Also, s/beam_stopped/beam_cancelled/ for clarity. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6409 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/beam.cc') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index e8e09d2707..b7ad0d4ce4 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -701,15 +701,18 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range) pbolt.fr_helped = pbolt.fr_hurt = 0; pbolt.foe_helped = pbolt.foe_hurt = 0; pbolt.foe_ratio = 100; - pbolt.beam_stopped = false; + pbolt.beam_cancelled= false; pbolt.dont_stop_foe = pbolt.dont_stop_fr = false; fire_beam(pbolt); // Should only happen if the player answered 'n' to one of those // "Fire through friendly?" prompts. - if (pbolt.beam_stopped) + if (pbolt.beam_cancelled) { +#if DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "%s", "Beam stopped."); +#endif canned_msg(MSG_OK); you.turn_is_over = false; return (false); @@ -1934,6 +1937,9 @@ void fire_beam(bolt &pbolt, item_def *item, bool drop_item) } } + if (pbolt.beam_cancelled) + return; + // Always decrease range by 1. rangeRemaining--; @@ -4352,7 +4358,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item) if (stop_attack_prompt(mon, true, target)) { - beam.beam_stopped = true; + beam.beam_cancelled = true; return (BEAM_STOP); } if (beam.fr_count == 1 && !beam.dont_stop_fr) @@ -4514,7 +4520,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item) if (stop_attack_prompt(mon, true, target)) { - beam.beam_stopped = true; + beam.beam_cancelled = true; return (BEAM_STOP); } if (beam.fr_count == 1 && !beam.dont_stop_fr) @@ -5632,7 +5638,7 @@ bolt::bolt() : range(0), rangeMax(0), type('*'), msg_generated(false), in_explosion_phase(false), smart_monster(false), can_see_invis(false), attitude(ATT_HOSTILE), foe_ratio(0), chose_ray(false), - beam_stopped(false), dont_stop_foe(false), dont_stop_fr(false) + beam_cancelled(false), dont_stop_foe(false), dont_stop_fr(false) { } -- cgit v1.2.3-54-g00ecf