|
|
@@ -89,7 +89,7 @@ units::volume vehicle_stack::max_volume() const |
|
|
|
// Set max volume for vehicle cargo to prevent integer overflow |
|
|
|
return std::min( myorigin->parts[part_num].info().size, 10000000_ml ); |
|
|
|
} |
|
|
|
return 0; |
|
|
|
return 0_ml; |
|
|
|
} |
|
|
|
|
|
|
|
// Vehicle class methods. |
|
|
@@ -666,8 +666,8 @@ bool vehicle::is_alternator_on( const int a ) const |
|
|
|
bool vehicle::has_security_working() const |
|
|
|
{ |
|
|
|
bool found_security = false; |
|
|
|
for( size_t s = 0; s < speciality.size(); s++ ) { |
|
|
|
if( part_flag( speciality[ s ], "SECURITY" ) && parts[ speciality[ s ] ].is_available() ) { |
|
|
|
for( int s : speciality ) { |
|
|
|
if( part_flag( s, "SECURITY" ) && parts[ s ].is_available() ) { |
|
|
|
found_security = true; |
|
|
|
break; |
|
|
|
} |
|
|
@@ -2548,7 +2548,7 @@ player *vehicle::get_passenger( int p ) const |
|
|
|
if( p >= 0 && parts[p].has_flag( vehicle_part::passenger_flag ) ) { |
|
|
|
return g->critter_by_id<player>( parts[p].passenger_id ); |
|
|
|
} |
|
|
|
return 0; |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
|
|
|
|
tripoint vehicle::global_pos3() const |
|
|
@@ -2588,7 +2588,7 @@ units::mass vehicle::total_mass() const |
|
|
|
|
|
|
|
units::volume vehicle::total_folded_volume() const |
|
|
|
{ |
|
|
|
units::volume m = 0; |
|
|
|
units::volume m = 0_ml; |
|
|
|
for( const vpart_reference &vp : get_all_parts() ) { |
|
|
|
if( vp.part().removed ) { |
|
|
|
continue; |
|
|
@@ -5164,14 +5164,14 @@ void vehicle::calc_mass_center( bool use_precalc ) const |
|
|
|
{ |
|
|
|
units::quantity<float, units::mass::unit_type> xf = 0; |
|
|
|
units::quantity<float, units::mass::unit_type> yf = 0; |
|
|
|
units::mass m_total = 0; |
|
|
|
units::mass m_total = 0_gram; |
|
|
|
for( const vpart_reference &vp : get_all_parts() ) { |
|
|
|
const size_t i = vp.part_index(); |
|
|
|
if( vp.part().removed ) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
units::mass m_part = 0; |
|
|
|
units::mass m_part = 0_gram; |
|
|
|
m_part += vp.part().base.weight(); |
|
|
|
for( const auto &j : get_items( i ) ) { |
|
|
|
//m_part += j.type->weight; |
|
|
@@ -5182,7 +5182,7 @@ void vehicle::calc_mass_center( bool use_precalc ) const |
|
|
|
if( vp.has_feature( VPFLAG_BOARDABLE ) && vp.part().has_flag( vehicle_part::passenger_flag ) ) { |
|
|
|
const player *p = get_passenger( i ); |
|
|
|
// Sometimes flag is wrongly set, don't crash! |
|
|
|
m_part += p != nullptr ? p->get_weight() : units::mass( 0 ); |
|
|
|
m_part += p != nullptr ? p->get_weight() : 0_gram; |
|
|
|
} |
|
|
|
|
|
|
|
if( vp.part().has_flag( vehicle_part::animal_flag ) ) { |
|
|
|