From 85d0fbef2e47afd237e4bc90a91d34822081e88b Mon Sep 17 00:00:00 2001 From: Kevin Granade Date: Sun, 3 Apr 2022 23:54:16 -0700 Subject: [PATCH] Very misc fixes --- src/mapgen.cpp | 2 +- src/vehicle.cpp | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/mapgen.cpp b/src/mapgen.cpp index d3676e17f9473..23b9bdc885801 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -6769,7 +6769,7 @@ std::unique_ptr map::add_vehicle_to_map( } veh_to_add->refresh( true ); // this could probably be done in a single loop with installing parts above - std::vector parts_in_square = veh_to_add->parts_at_relative( source_point, true ); + std::vector parts_in_square = veh_to_add->parts_at_relative( source_point, false ); std::set parts_to_check; for( int index = parts_in_square.size() - 1; index >= 0; index-- ) { if( handler_ptr ) { diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 1526e813c9eff..f7905bfe4be3e 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -3334,9 +3334,8 @@ float vehicle::fuel_specific_energy( const itype_id &ftype ) const for( const vpart_reference &vpr : get_all_parts() ) { if( vpr.part().is_tank() && vpr.part().ammo_current() == ftype && vpr.part().base.only_item().made_of( phase_id::LIQUID ) ) { - float mass = to_gram( vpr.part().base.only_item().weight() ); - total_energy += vpr.part().base.only_item().specific_energy * mass; - total_mass += mass; + total_energy += vpr.part().base.only_item().get_item_thermal_energy(); + total_mass += to_gram( vpr.part().base.only_item().weight() ); } } return total_energy / total_mass; @@ -5900,11 +5899,6 @@ void vehicle::refresh( const bool remove_fakes ) std::set smzs = precalc_mounts( 0, pivot_rotation[0], pivot_anchor[0] ); // update the fakes, and then repopulate the cache update_active_fakes(); - map &here = get_map(); - here.add_vehicle_to_cache( this ); - for( const int dirty_z : smzs ) { - here.on_vehicle_moved( dirty_z ); - } check_environmental_effects = true; insides_dirty = true; zones_dirty = true; @@ -7415,7 +7409,8 @@ int vehicle::get_non_fake_part( const int part_num ) return part_num; } } - debugmsg( "Returning -1 for get_non_fake_part on part_num %d on %s.", part_num, disp_name() ); + debugmsg( "Returning -1 for get_non_fake_part on part_num %d on %s, which has %d parts.", part_num, + disp_name(), parts.size() ); return -1; }