diff --git a/src/item_location.cpp b/src/item_location.cpp index 903cd46cdf293..0ca61c202131a 100644 --- a/src/item_location.cpp +++ b/src/item_location.cpp @@ -338,30 +338,35 @@ class item_location::impl::item_on_person : public item_location::impl obj = *target(); } - auto parents = who->parents( *target() ); - if( !parents.empty() && who->is_worn( *parents.back() ) ) { - // if outermost parent item is worn status effects (e.g. GRABBED) are not applied - // holsters may also adjust the volume cost factor + if( who->is_armed() && &who->weapon == target() ) { + // no penalties because we already have this item in our hands + mv += dynamic_cast( who )->item_handling_cost( obj, false, 0 ); + } else { + auto parents = who->parents( *target() ); + if( !parents.empty() && who->is_worn( *parents.back() ) ) { + // if outermost parent item is worn status effects (e.g. GRABBED) are not applied + // holsters may also adjust the volume cost factor - if( parents.back()->can_holster( obj, true ) ) { - auto ptr = dynamic_cast - ( parents.back()->type->get_use( "holster" )->get_actor_ptr() ); - mv += dynamic_cast( who )->item_handling_cost( obj, false, ptr->draw_cost ); + if( parents.back()->can_holster( obj, true ) ) { + auto ptr = dynamic_cast + ( parents.back()->type->get_use( "holster" )->get_actor_ptr() ); + mv += dynamic_cast( who )->item_handling_cost( obj, false, ptr->draw_cost ); - } else if( parents.back()->is_bandolier() ) { - auto ptr = dynamic_cast - ( parents.back()->type->get_use( "bandolier" )->get_actor_ptr() ); - mv += dynamic_cast( who )->item_handling_cost( obj, false, ptr->draw_cost ); + } else if( parents.back()->is_bandolier() ) { + auto ptr = dynamic_cast + ( parents.back()->type->get_use( "bandolier" )->get_actor_ptr() ); + mv += dynamic_cast( who )->item_handling_cost( obj, false, ptr->draw_cost ); + + } else { + mv += dynamic_cast( who )->item_handling_cost( obj, false, + INVENTORY_HANDLING_PENALTY / 2 ); + } } else { - mv += dynamic_cast( who )->item_handling_cost( obj, false, - INVENTORY_HANDLING_PENALTY / 2 ); + // it is more expensive to obtain items from the inventory + // TODO: calculate cost for searching in inventory proportional to item volume + mv += dynamic_cast( who )->item_handling_cost( obj, true, INVENTORY_HANDLING_PENALTY ); } - - } else { - // it is more expensive to obtain items from the inventory - // TODO: calculate cost for searching in inventory proportional to item volume - mv += dynamic_cast( who )->item_handling_cost( obj, true, INVENTORY_HANDLING_PENALTY ); } if( &ch != who ) {