From 93d5c85d6558548a84c9bf4d5ac50382a162beb1 Mon Sep 17 00:00:00 2001 From: olanti-p Date: Sat, 8 Feb 2020 23:57:47 +0300 Subject: [PATCH] Fix type cast warnings --- src/magic.cpp | 3 ++- src/mission.cpp | 2 +- src/npctrade.cpp | 2 +- src/vehicle.cpp | 2 +- src/weather.cpp | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/magic.cpp b/src/magic.cpp index 55d3f5dd03ed1..791ce2006fda8 100644 --- a/src/magic.cpp +++ b/src/magic.cpp @@ -1902,7 +1902,8 @@ static void draw_spellbook_info( const spell_type &sp, uilist *menu ) } if( sp.min_duration != 0 && sp.max_duration != 0 ) { - rows.emplace_back( _( "Duration" ), sp.min_duration, sp.duration_increment, sp.max_duration ); + rows.emplace_back( _( "Duration" ), sp.min_duration, static_cast( sp.duration_increment ), + sp.max_duration ); } rows.emplace_back( _( "Cast Cost" ), sp.base_energy_cost, sp.energy_increment, diff --git a/src/mission.cpp b/src/mission.cpp index 05374d5af7af2..358e06a0eec11 100644 --- a/src/mission.cpp +++ b/src/mission.cpp @@ -372,7 +372,7 @@ bool mission::is_complete( const character_id &_npc_id ) const int total_match = std::accumulate( matches.begin(), matches.end(), 0, []( const std::size_t previous, const std::pair &p ) { - return previous + p.second; + return static_cast( previous + p.second ); } ); if( total_match >= ( type->item_count ) ) { diff --git a/src/npctrade.cpp b/src/npctrade.cpp index 1ff771223b665..4a3cbab663727 100644 --- a/src/npctrade.cpp +++ b/src/npctrade.cpp @@ -90,7 +90,7 @@ std::vector npc_trading::init_selling( npc &np ) const int price = it.price( true ); int val = np.value( it ); if( np.wants_to_sell( it, val, price ) ) { - result.emplace_back( np, i->front(), val, i->size() ); + result.emplace_back( np, i->front(), val, static_cast( i->size() ) ); } } diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 31ef0eb9bd544..e3af48e641080 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -4450,7 +4450,7 @@ void vehicle::consume_fuel( int load, const int t_seconds, bool skip_electric ) double amnt_precise_j = static_cast( fuel_pr.second ) * t_seconds; amnt_precise_j *= load / 1000.0 * ( 1.0 + st * st * 100.0 ); - auto inserted = fuel_used_last_turn.insert( { ft, 0 } ); + auto inserted = fuel_used_last_turn.insert( { ft, 0.0f } ); inserted.first->second += amnt_precise_j; double remainder = fuel_remainder[ ft ]; amnt_precise_j -= remainder; diff --git a/src/weather.cpp b/src/weather.cpp index 3ea86a26700a6..f5ec156dcf76d 100644 --- a/src/weather.cpp +++ b/src/weather.cpp @@ -638,7 +638,7 @@ std::string weather_forecast( const point &abs_sm_pos ) day = _( "Today" ); started_at_night = false; } - if( d > 0 && started_at_night != d % 2 ) { + if( d > 0 && static_cast( started_at_night ) != d % 2 ) { day = string_format( pgettext( "Mon Night", "%s Night" ), to_string( day_of_week( c ) ) ); } else { day = to_string( day_of_week( c ) );