@@ -251,10 +251,9 @@ class uistatedata

auto inhist = jo.get_object( "input_history" );
std::set<std::string> inhist_members = inhist.get_member_names();
for( std::set<std::string>::iterator it = inhist_members.begin();
it != inhist_members.end(); ++it ) {
auto ja = inhist.get_array( *it );
std::vector<std::string> &v = gethistory( *it );
for( const auto &inhist_member : inhist_members ) {
auto ja = inhist.get_array( inhist_member );
std::vector<std::string> &v = gethistory( inhist_member );
v.clear();
while( ja.has_more() ) {
v.push_back( ja.next_string() );
@@ -2021,8 +2021,8 @@ void veh_interact::display_stats() const
const int slots = 24; // 3 * stats_h
int x[slots], y[slots], w[slots];

units::volume total_cargo = 0;
units::volume free_cargo = 0;
units::volume total_cargo = 0_ml;
units::volume free_cargo = 0_ml;
for( const vpart_reference &vp : veh->get_any_parts( "CARGO" ) ) {
const size_t p = vp.part_index();
total_cargo += veh->max_volume(p);
@@ -2344,7 +2344,7 @@ void veh_interact::display_details( const vpart_info *part )
small_mode ? _("Wgt") : _("Weight"),
convert_weight( item::find_type( part->item )->weight ),
weight_units() );
if ( part->folded_volume != 0 ) {
if ( part->folded_volume != 0_ml ) {
fold_and_print(w_details, line+2, col_2, column_width, c_white,
"%s: <color_light_gray>%s %s</color>",
small_mode ? _("FoldVol") : _("Folded Volume"),
@@ -2353,7 +2353,7 @@ void veh_interact::display_details( const vpart_info *part )
}

// line 3: (column 1) size, bonus, wheel diameter (if applicable) (column 2) epower, wheel width (if applicable)
if( part->size > 0 && part->has_flag( VPFLAG_CARGO ) ) {
if( part->size > 0_ml && part->has_flag( VPFLAG_CARGO ) ) {
fold_and_print( w_details, line + 3, col_1, column_width, c_white,
"%s: <color_light_gray>%s %s</color>",
small_mode ? _( "Cap" ) : _( "Capacity" ),
@@ -328,7 +328,7 @@ void vpart_info::finalize()
e.second.name_ = _( e.second.name_.c_str() );
}

if( e.second.folded_volume > 0 ) {
if( e.second.folded_volume > 0_ml ) {
e.second.set_flag( "FOLDABLE" );
}

@@ -507,16 +507,16 @@ void vpart_info::check()
if( part.dmg_mod < 0 ) {
debugmsg( "vehicle part %s has negative damage modifier", part.id.c_str() );
}
if( part.folded_volume < 0 ) {
if( part.folded_volume < 0_ml ) {
debugmsg( "vehicle part %s has negative folded volume", part.id.c_str() );
}
if( part.has_flag( "FOLDABLE" ) && part.folded_volume == 0 ) {
if( part.has_flag( "FOLDABLE" ) && part.folded_volume == 0_ml ) {
debugmsg( "vehicle part %s has folding part with zero folded volume", part.name().c_str() );
}
if( !item::type_is_defined( part.default_ammo ) ) {
debugmsg( "vehicle part %s has undefined default ammo %s", part.id.c_str(), part.item.c_str() );
}
if( part.size < 0 ) {
if( part.size < 0_ml ) {
debugmsg( "vehicle part %s has negative size", part.id.c_str() );
}
if( !item::type_is_defined( part.item ) ) {
@@ -178,10 +178,10 @@ class vpart_info
itype_id default_ammo = "null";

/** Volume of a foldable part when folded */
units::volume folded_volume = 0;
units::volume folded_volume = 0_ml;

/** Cargo location volume */
units::volume size = 0;
units::volume size = 0_ml;

/** Mechanics skill required to install item */
int difficulty = 0;
@@ -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 ) ) {
@@ -838,12 +838,12 @@ class vehicle
* Get all enabled, available, unbroken vehicle parts at specified position
* @param pos position to check
* @param flag if set only flags with this part will be considered
* @param conditions enum to include unabled, unavailable, and broken parts
* @param condition enum to include unabled, unavailable, and broken parts
*/
std::vector<vehicle_part *> get_parts_at( const tripoint &pos, const std::string &flag,
const part_status_flag e );
const part_status_flag condition );
std::vector<const vehicle_part *> get_parts_at( const tripoint &pos,
const std::string &flag, const part_status_flag e ) const;
const std::string &flag, const part_status_flag condition ) const;

/** Test if part can be enabled (unbroken, sufficient fuel etc), optionally displaying failures to user */
bool can_enable( const vehicle_part &pt, bool alert = false ) const;
@@ -349,7 +349,6 @@ void vehicle::control_engines()
int vehicle::select_engine()
{
uilist tmenu;
std::string name;
tmenu.text = _( "Toggle which?" );
int i = 0;
for( size_t x = 0; x < engines.size(); x++ ) {
@@ -1079,13 +1078,13 @@ void vehicle::operate_planter()
sounds::sound( loc, rng( 10, 20 ), sounds::sound_t::combat, _( "Clink" ) );
}
if( !i->count_by_charges() || i->charges == 1 ) {
i->set_age( 0 );
i->set_age( 0_turns );
g->m.add_item( loc, *i );
v.erase( i );
} else {
item tmp = *i;
tmp.charges = 1;
tmp.set_age( 0 );
tmp.set_age( 0_turns );
g->m.add_item( loc, tmp );
i->charges--;
}
@@ -1283,7 +1282,7 @@ void vehicle::use_washing_machine( int p )
} else {
parts[p].enabled = true;
for( auto &n : items ) {
n.set_age( 0 );
n.set_age( 0_turns );
}

if( fuel_left( "water" ) >= 24 ) {
@@ -73,7 +73,7 @@ void weather_effect::glare()
time_duration get_rot_since( const time_point &start, const time_point &end,
const tripoint &pos )
{
time_duration ret = 0;
time_duration ret = 0_turns;
const auto &wgen = g->get_cur_weather_gen();
/* Hoisting loop invariants */
const auto location_temp = g->get_temperature( pos );
@@ -130,7 +130,7 @@ inline void proc_weather_sum( const weather_type wtype, weather_sum &data,
weather_sum sum_conditions( const time_point &start, const time_point &end,
const tripoint &location )
{
time_duration tick_size = 0;
time_duration tick_size = 0_turns;
weather_sum data;

const auto wgen = g->get_cur_weather_gen();
@@ -299,7 +299,7 @@ void fill_funnels( int rain_depth_mm_per_hour, bool acid, const trap &tr )
// Give each funnel on the map a chance to collect the rain.
const auto &funnel_locs = g->m.trap_locations( tr.loadid );
for( auto loc : funnel_locs ) {
units::volume maxcontains = 0;
units::volume maxcontains = 0_ml;
if( one_in( turns_per_charge ) ) { // @todo: fixme
//add_msg("%d mm/h %d tps %.4f: fill",int(calendar::turn),rain_depth_mm_per_hour,turns_per_charge);
// This funnel has collected some rain! Put the rain in the largest
@@ -316,7 +316,7 @@ void fill_funnels( int rain_depth_mm_per_hour, bool acid, const trap &tr )

if( container != items.end() ) {
container->add_rain_to_container( acid, 1 );
container->set_age( 0 );
container->set_age( 0_turns );
}
}
}