Exemple #1
0
// Verify  and provide API version encoded as integer value
int rs_get_api_version(rs_error ** error) try
{
    // Each component type is within [0-99] range
    VALIDATE_RANGE(RS_API_MAJOR_VERSION, 0, 99);
    VALIDATE_RANGE(RS_API_MINOR_VERSION, 0, 99);
    VALIDATE_RANGE(RS_API_PATCH_VERSION, 0, 99);
    return RS_API_VERSION;
}
Exemple #2
0
void rs_enable_stream(rs_device * device, rs_stream stream, int width, int height, rs_format format, int framerate, rs_error ** error) try
{
    VALIDATE_NOT_NULL(device);
    VALIDATE_NATIVE_STREAM(stream);
    VALIDATE_RANGE(width, 0, INT_MAX);
    VALIDATE_RANGE(height, 0, INT_MAX);
    VALIDATE_ENUM(format);
    VALIDATE_RANGE(framerate, 0, INT_MAX);
    device->enable_stream(stream, width, height, format, framerate);
}
Exemple #3
0
void rs_get_stream_mode(const rs_device * device, rs_stream stream, int index, int * width, int * height, rs_format * format, int * framerate, rs_error ** error) try
{
    VALIDATE_NOT_NULL(device);
    VALIDATE_ENUM(stream);
    VALIDATE_RANGE(index, 0, device->get_stream_interface(stream).get_mode_count()-1);
    device->get_stream_interface(stream).get_mode(index, width, height, format, framerate);
}
void CInfCreature::SetStrBonus(int nBonus)
{
	nBonus = VALIDATE_RANGE(nBonus,0,100);
	if (m_infCre.chStrengthBonus != nBonus)
		m_bHasChanged = TRUE;
	m_infCre.chStrengthBonus = nBonus;
}
void CInfCreature::SetThac0(int nValue)
{
	nValue = VALIDATE_RANGE(nValue,-100,100);
	if (GetThac0() != nValue)
		m_bHasChanged = TRUE;
	m_infCre.chTHAC0 = nValue;
}
void CInfCreature::SetThirdClassLevel(int nValue)
{
	nValue = VALIDATE_RANGE(nValue,0,255);
	if (m_infCre.chLevelThirdClass != nValue)
		m_bHasChanged = TRUE;
	m_infCre.chLevelThirdClass = nValue;
}
void CInfCreature::SetDualClass(int nValue)
{
	nValue = VALIDATE_RANGE(nValue,0,255);
	if (m_infCre.chDualClass != nValue)
		m_bHasChanged = TRUE;
	m_infCre.chDualClass = nValue;
}
void CInfCreature::SetLore(int nValue)
{
	nValue = VALIDATE_RANGE(nValue,0,255);
	if (m_infCre.chLore != nValue)
		m_bHasChanged = TRUE;
	m_infCre.chLore = nValue;
}
void CInfCreature::SetReputation(int nValue)
{
	nValue = VALIDATE_RANGE(nValue,0,20);
	nValue *= 10;
	if (m_infCre.chReputation != nValue)
		m_bHasChanged = TRUE;
	m_infCre.chReputation = nValue;
}
Exemple #10
0
void rs_set_device_options(rs_device * device, const rs_option options[], int count, const double values[], rs_error ** error) try
{
    VALIDATE_NOT_NULL(device);
    VALIDATE_RANGE(count, 0, INT_MAX);
    VALIDATE_NOT_NULL(options);
    for(int i=0; i<count; ++i) VALIDATE_ENUM(options[i]);
    VALIDATE_NOT_NULL(values);
    device->set_options(options, count, values);
}
Exemple #11
0
void CInfGame::SetPartyReputation(BYTE chRep)
{
	chRep = VALIDATE_RANGE(chRep,0,20);
	if (m_infGame.chPartyReputation != chRep*10)
		m_bHasChanged = TRUE;
	m_infGame.chPartyReputation = chRep*10;

	for (int i=0;i<(int)m_infGame.dwInPartyCharCount;i++)
		m_infParty[i].SetReputation(chRep);
}
Exemple #12
0
void rs_reset_device_options_to_default(rs_device * device, const rs_option* options, int count, rs_error ** error) try
{
    VALIDATE_NOT_NULL(device);
    VALIDATE_RANGE(count, 0, INT_MAX);
    VALIDATE_NOT_NULL(options);
    for (int i = 0; i<count; ++i) VALIDATE_ENUM(options[i]);

    std::vector<double> values;
    for (int i = 0; i < count; ++i)
    {
        double def;
        rs_get_device_option_range_ex(device, options[i], NULL, NULL, NULL, &def, 0);
        values.push_back(def);
    }
    device->set_options(options, count, values.data());
}
Exemple #13
0
rs_device * rs_get_device(rs_context * context, int index, rs_error ** error) try
{
    VALIDATE_NOT_NULL(context);
    VALIDATE_RANGE(index, 0, (int)context->devices.size()-1);
    return context->devices[index].get();
}
Exemple #14
0
rs_device * rs_get_device(rs_context * context, int index, rs_error ** error) try
{
    VALIDATE_NOT_NULL(context);
    VALIDATE_RANGE(index, 0, (int)context->get_device_count()-1);
    return context->get_device(index);
}