void stash_on_pet( const std::list<item> &items, monster &pet ) { units::volume remaining_volume = pet.inv.empty() ? 0_ml : pet.inv.front().get_storage(); units::mass remaining_weight = pet.weight_capacity(); for( const auto &it : pet.inv ) { remaining_volume -= it.volume(); remaining_weight -= it.weight(); } for( auto &it : items ) { pet.add_effect( effect_controlled, 5_turns ); if( it.volume() > remaining_volume ) { add_msg( m_bad, _( "%1$s did not fit and fell to the %2$s." ), it.display_name(), g->m.name( pet.pos() ) ); g->m.add_item_or_charges( pet.pos(), it ); } else if( it.weight() > remaining_weight ) { add_msg( m_bad, _( "%1$s is too heavy and fell to the %2$s." ), it.display_name(), g->m.name( pet.pos() ) ); g->m.add_item_or_charges( pet.pos(), it ); } else { pet.add_item( it ); remaining_volume -= it.volume(); remaining_weight -= it.weight(); } } }