Skip to content

Commit

Permalink
Merge pull request #29040 from KarateSnoopy/fix-vs-warnings
Browse files Browse the repository at this point in the history
Fix C4267 and C4244 warnings in Visual Studio 2017 compile
  • Loading branch information
ZhilkinSerg authored Mar 27, 2019
2 parents f8c24f1 + 0d08bec commit 021895a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ std::map<vitamin_id, int> player::vitamins_from( const item &it ) const
for( const auto &mat : mut.vitamin_absorb_multi ) {
// this is where we are able to check if the food actually is changed by the trait
if( mat.first == material_id( "all" ) || material_exists( mat.first, it ) ) {
std::map<vitamin_id, float> mat_vit_map = mat.second;
std::map<vitamin_id, double> mat_vit_map = mat.second;
// finally iterate over every vitamin in each material
for( const auto &vit : res ) {
// to avoid errors with undefined keys, and to initialize numbers to 1 if undefined
Expand Down
4 changes: 2 additions & 2 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2648,7 +2648,7 @@ void item_group::debug_spawn()
uilist menu;
menu.text = _( "Test which group?" );
for( size_t i = 0; i < groups.size(); i++ ) {
menu.entries.emplace_back( i, true, -2, groups[i] );
menu.entries.emplace_back( static_cast<int>( i ), true, -2, groups[i] );
}
while( true ) {
menu.query();
Expand All @@ -2674,7 +2674,7 @@ void item_group::debug_spawn()
for( const auto &e : itemnames2 ) {
std::ostringstream buffer;
buffer << e.first << " x " << e.second << "\n";
menu2.entries.emplace_back( menu2.entries.size(), true, -2, buffer.str() );
menu2.entries.emplace_back( static_cast<int>( menu2.entries.size() ), true, -2, buffer.str() );
}
menu2.query();
}
Expand Down
7 changes: 4 additions & 3 deletions src/lightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ void map::generate_lightmap( const int zlev )
continue;
}
if( vp.has_feature( VPFLAG_CARGO ) && !vp.has_feature( "COVERED" ) ) {
add_light_from_items( pp, v->get_items( p ).begin(), v->get_items( p ).end() );
add_light_from_items( pp, v->get_items( static_cast<int>( p ) ).begin(),
v->get_items( static_cast<int>( p ) ).end() );
}
}
}
Expand Down Expand Up @@ -1139,10 +1140,10 @@ void map::build_seen_cache( const tripoint &origin, const int target_z )
seen_cache[mirror_pos.x][mirror_pos.y] < LIGHT_TRANSPARENCY_SOLID + 0.1 ) {
continue;
} else if( !vp.info().has_flag( "CAMERA_CONTROL" ) ) {
mirrors.emplace_back( vp.part_index() );
mirrors.emplace_back( static_cast<int>( vp.part_index() ) );
} else {
if( square_dist( origin, mirror_pos ) <= 1 && veh->camera_on ) {
cam_control = vp.part_index();
cam_control = static_cast<int>( vp.part_index() );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mutation.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ struct mutation_branch {
std::map<vitamin_id, time_duration> vitamin_rates;

// Mutations may affect absorption rates of vitamins based on material (or "all")
std::map<material_id, std::map<vitamin_id, float>> vitamin_absorb_multi;
std::map<material_id, std::map<vitamin_id, double>> vitamin_absorb_multi;

std::vector<trait_id> prereqs; // Prerequisites; Only one is required
std::vector<trait_id> prereqs2; // Prerequisites; need one from here too
Expand Down
2 changes: 1 addition & 1 deletion src/mutation_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void mutation_branch::load( JsonObject &jo, const std::string & )
auto vam = jo.get_array( "vitamins_absorb_multi" );
while( vam.has_more() ) {
auto pair = vam.next_array();
std::map<vitamin_id, float> vit;
std::map<vitamin_id, double> vit;
auto vit_array = pair.get_array( 1 );
// fill the inner map with vitamins
while( vit_array.has_more() ) {
Expand Down
4 changes: 2 additions & 2 deletions src/trait_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void trait_group::debug_spawn()
uilist menu;
menu.text = _( "Test which group?" );
for( size_t i = 0; i < groups.size(); i++ ) {
menu.entries.emplace_back( i, true, -2, groups[i].str() );
menu.entries.emplace_back( static_cast<int>( i ), true, -2, groups[i].str() );
}
while( true ) {
menu.query();
Expand All @@ -108,7 +108,7 @@ void trait_group::debug_spawn()
for( const auto &e : traitnames2 ) {
std::ostringstream buffer;
buffer << e.first << " x " << e.second << "\n";
menu2.entries.emplace_back( menu2.entries.size(), true, -2, buffer.str() );
menu2.entries.emplace_back( static_cast<int>( menu2.entries.size() ), true, -2, buffer.str() );
}
menu2.query();
}
Expand Down

0 comments on commit 021895a

Please sign in to comment.