コード例 #1
0
ファイル: colision_detection.cpp プロジェクト: Fordi/rockbot
bool colision_detection::rect_overlap(st_rectangle A, st_rectangle B) const
{
	bool xOverlap = value_in_range(A.x, B.x, B.x + B.w) || value_in_range(B.x, A.x, A.x + A.w);
	bool yOverlap = value_in_range(A.y, B.y, B.y + B.h) || value_in_range(B.y, A.y, A.y + A.h);
    //std::cout << "A.y: " << A.y << ", B.y: " << B.y << ", B.h: " << B.h << std::endl;
    //std::cout << "colision_detection::rect_overlap - xOverlap: "  << xOverlap << ", yOverlap: " << yOverlap << std::endl;
	return xOverlap && yOverlap;
}
コード例 #2
0
ファイル: app_statsd.c プロジェクト: KaloNK/asterisk
/*!
 * \brief Calls the appropriate functions to validate a counter metric.
 *
 * \param statistic_name The statistic name to be sent to StatsD.
 * \param value The value to be sent to StatsD.
 *
 * This function calls other validating functions to correctly validate each
 * input based on allowable input for a counter metric.
 *
 * \retval zero on success.
 * \retval 1 on error.
 */
static int validate_metric_type_counter(const char *statistic_name, const char *value) {

	if (ast_strlen_zero(value)) {
		ast_log(AST_LOG_ERROR, "Missing value argument.\n");
		return 1;
	}

	if (validate_name(statistic_name) || determine_actual_value(value)
		|| value_in_range(value)) {
		return 1;
	}

	return 0;
}