engine/actions/source/RangedCombatApplicabilityChecker.cpp
// Check to see if there is a ranged weapon/ammunition equipped at all.
Check to see if there is a ranged weapon/ammunition equipped at all.
Check to see if there is a ranged weapon / ammunition equipped at all .
bool RangedCombatApplicabilityChecker::is_ranged_weapon_equipped(CreaturePtr creature)
{
  if (creature)
  {
    Equipment& equipment = creature->get_equipment();
    ItemPtr ranged_weapon = equipment.get_item(EquipmentWornLocation::EQUIPMENT_WORN_RANGED_WEAPON);
    ItemPtr ammunition = equipment.get_item(EquipmentWornLocation::EQUIPMENT_WORN_AMMUNITION);
    if (!(ranged_weapon || ammunition))
    {
      return false;
    }    
  }
  return true;
}
bool RangedCombatApplicabilityChecker :: is_ranged_weapon_equipped ( CreaturePtr creature ) { if ( creature ) { Equipment & equipment = creature -> get_equipment ( ) ; ItemPtr ranged_weapon = equipment . get_item ( EquipmentWornLocation :: EQUIPMENT_WORN_RANGED_WEAPON ) ; ItemPtr ammunition = equipment . get_item ( EquipmentWornLocation :: EQUIPMENT_WORN_AMMUNITION ) ; if ( ! ( ranged_weapon || ammunition ) ) { return false ; } } return true ; }
Check to see if there is a ranged weapon/ammunition equipped at all.
Check to see if there is a ranged weapon / ammunition equipped at all .