From 45aeff327756cde49736e03098d3e985cdb37f23 Mon Sep 17 00:00:00 2001 From: alef Date: Mon, 20 May 2024 15:41:49 +0100 Subject: [PATCH] * #68633 Avoid duplicates in speed adjustments * Obey astyle --- src/player_display.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/player_display.cpp b/src/player_display.cpp index 06bdd03dd7937..b10ee7fbd1927 100644 --- a/src/player_display.cpp +++ b/src/player_display.cpp @@ -948,21 +948,21 @@ static std::vector get_speedlist_entries( const Character &you, { std::vector entries; - for( const speed_bonus_effect &effect : you.get_speed_bonus_effects() ) { - if( effect.bonus != 0 ) { - const speedlist_entry entry { true, effect.description, effect.bonus, false }; + for( const std::pair &speed_effect : speed_effects ) { + if( speed_effect.second != 0 ) { + const speedlist_entry entry { true, speed_effect.first, speed_effect.second, false }; entries.push_back( entry ); } } - //FIXME I think these are already included above. Need more testing. - for( const std::pair &speed_effect : speed_effects ) { - if( speed_effect.second != 0 ) { - const speedlist_entry entry { true, speed_effect.first, speed_effect.second, false }; + for( const speed_bonus_effect &effect : you.get_speed_bonus_effects() ) { + if( effect.bonus != 0 && speed_effects.end() == speed_effects.find( effect.description ) ) { + const speedlist_entry entry { true, effect.description, effect.bonus, false }; entries.push_back( entry ); } } + float movecost = 100; for( const run_cost_effect &effect : you.run_cost_effects( movecost ) ) { const int percent = std::trunc( effect.times * 100 - 100 ); // truncate toward 0%