From 82910353dce02ba86f5d7a1b2cf154aa0be95a89 Mon Sep 17 00:00:00 2001 From: KheirFerrum <102964889+KheirFerrum@users.noreply.github.com> Date: Sun, 4 Jun 2023 00:09:40 +0100 Subject: [PATCH] Fix RAS weapon range in target_ui (#2933) Spawn temp weapon for RAS weapons that is used to generate range. --- src/ranged.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ranged.cpp b/src/ranged.cpp index 14fe6a096cc7..44ae9d8d4b15 100644 --- a/src/ranged.cpp +++ b/src/ranged.cpp @@ -3098,7 +3098,13 @@ void target_ui::update_ammo_range_from_gun_mode() } else { ammo = activity->reload_loc ? activity->reload_loc.get_item()->type : relevant->gun_current_mode().target->ammo_data(); - range = relevant->gun_current_mode().target->gun_range( you ); + if( activity->reload_loc ) { + item temp_weapon = *relevant; + temp_weapon.ammo_set( ammo->get_id() ); + range = temp_weapon.gun_current_mode().target->gun_range( you ); + } else { + range = relevant->gun_current_mode().target->gun_range( you ); + } } }