From a47eef207b8637555ec8c896e19b3801f3a14cf6 Mon Sep 17 00:00:00 2001 From: alef Date: Wed, 27 Dec 2023 17:58:19 +0100 Subject: [PATCH 1/3] #70432 Do not walk back past vector's `begin()` --- src/magic_spell_effect.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/magic_spell_effect.cpp b/src/magic_spell_effect.cpp index 03cd31114bf2a..6856cc871ad37 100644 --- a/src/magic_spell_effect.cpp +++ b/src/magic_spell_effect.cpp @@ -1654,7 +1654,9 @@ void spell_effect::dash( const spell &sp, Creature &caster, const tripoint &targ if( caster_you != nullptr ) { if( creatures.creature_at( here.getlocal( *walk_point ) ) || !g->walk_move( here.getlocal( *walk_point ), false ) ) { - --walk_point; + if (walk_point != trajectory.begin()) { + --walk_point; + } break; } else { sp.create_field( here.getlocal( *( walk_point - 1 ) ), caster ); From ef201d63a06596c97b70d65c95aca4e405401fe1 Mon Sep 17 00:00:00 2001 From: alef Date: Wed, 27 Dec 2023 18:00:03 +0100 Subject: [PATCH 2/3] `trajectory` items are not local points --- src/magic_spell_effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/magic_spell_effect.cpp b/src/magic_spell_effect.cpp index 6856cc871ad37..ab041218c6dec 100644 --- a/src/magic_spell_effect.cpp +++ b/src/magic_spell_effect.cpp @@ -1644,7 +1644,7 @@ void spell_effect::dash( const spell &sp, Creature &caster, const tripoint &targ } avatar *caster_you = caster.as_avatar(); auto walk_point = trajectory.begin(); - if( *walk_point == source ) { + if( here.getlocal( *walk_point ) == source ) { ++walk_point; } // save the amount of moves the caster has so we can restore them after the dash From 0ea74c342c0f792ad1bcb1789b9551f2ec4b007b Mon Sep 17 00:00:00 2001 From: alef Date: Wed, 27 Dec 2023 18:52:47 +0100 Subject: [PATCH 3/3] Update src/magic_spell_effect.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/magic_spell_effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/magic_spell_effect.cpp b/src/magic_spell_effect.cpp index ab041218c6dec..1f43349553426 100644 --- a/src/magic_spell_effect.cpp +++ b/src/magic_spell_effect.cpp @@ -1654,7 +1654,7 @@ void spell_effect::dash( const spell &sp, Creature &caster, const tripoint &targ if( caster_you != nullptr ) { if( creatures.creature_at( here.getlocal( *walk_point ) ) || !g->walk_move( here.getlocal( *walk_point ), false ) ) { - if (walk_point != trajectory.begin()) { + if( walk_point != trajectory.begin() ) { --walk_point; } break;