Skip to content

Commit becdd6f

Browse files
authored
Make narrowing casts explicit. (CleverRaven#54203)
1 parent 581e87c commit becdd6f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/condition.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,19 +1078,19 @@ std::function<int( const T & )> conditional_t<T>::get_get_int( const JsonObject
10781078
std::string weather_aspect = jo.get_string( "weather" );
10791079
if( weather_aspect == "temperature" ) {
10801080
return []( const T & ) {
1081-
return get_weather().weather_precise->temperature;
1081+
return static_cast<int>( get_weather().weather_precise->temperature );
10821082
};
10831083
} else if( weather_aspect == "windpower" ) {
10841084
return []( const T & ) {
1085-
return get_weather().weather_precise->windpower;
1085+
return static_cast<int>( get_weather().weather_precise->windpower );
10861086
};
10871087
} else if( weather_aspect == "humidity" ) {
10881088
return []( const T & ) {
1089-
return get_weather().weather_precise->humidity;
1089+
return static_cast<int>( get_weather().weather_precise->humidity );
10901090
};
10911091
} else if( weather_aspect == "pressure" ) {
10921092
return []( const T & ) {
1093-
return get_weather().weather_precise->pressure;
1093+
return static_cast<int>( get_weather().weather_precise->pressure );
10941094
};
10951095
}
10961096
} else if( jo.has_member( "u_val" ) || jo.has_member( "npc_val" ) ||
@@ -1158,7 +1158,7 @@ std::function<int( const T & )> conditional_t<T>::get_get_int( const JsonObject
11581158
jo.throw_error( "allies count not supported for NPCs. In " + jo.str() );
11591159
} else {
11601160
return []( const T & ) {
1161-
return g->allies().size();
1161+
return static_cast<int>( g->allies().size() );
11621162
};
11631163
}
11641164
} else if( checked_value == "cash" ) {
@@ -1209,12 +1209,12 @@ std::function<int( const T & )> conditional_t<T>::get_get_int( const JsonObject
12091209
} else if( checked_value == "power" ) {
12101210
return [is_npc]( const T & d ) {
12111211
// Energy in milijoule
1212-
return d.actor( is_npc )->power_cur().value();
1212+
return static_cast<int>( d.actor( is_npc )->power_cur().value() );
12131213
};
12141214
} else if( checked_value == "power_max" ) {
12151215
return [is_npc]( const T & d ) {
12161216
// Energy in milijoule
1217-
return d.actor( is_npc )->power_max().value();
1217+
return static_cast<int>( d.actor( is_npc )->power_max().value() );
12181218
};
12191219
} else if( checked_value == "power_percentage" ) {
12201220
return [is_npc]( const T & d ) {

0 commit comments

Comments
 (0)