fn check_similar_block(
	x: usize, y: usize,
	x_offset: usize, y_offset: usize,
	stack: &Stack, 
	blocks: &WriteStorage<'_, Block>
) -> Option<Vec<u32>> {
	let b1 = blocks.get(stack.from_xy(x, y)).unwrap();

	let check_boundary = |x: usize, y: usize| -> Option<&Block> {
		if x < COLS && y < ROWS {
			blocks.get(stack.from_xy(x, y))
		}
		else {
			None
		}
	};

	let b2 = check_boundary(x + x_offset, y + y_offset);
	let b3 = check_boundary(x + x_offset * 2, y + y_offset * 2);

	if b1.is_comboable() {
		if let Some(block2) = b2 {
			if let Some(block3) = b3 {
				if block2.is_comboable_with(b1.kind) && block3.is_comboable_with(b1.kind) {
					return Some(vec! [
						b1.id,
						block2.id,
						block3.id,
					])
				}
			}
		}
	}	

	// just return nothing to save up on cpu
	// we could just return an empty vec but since this happens around 72 * 2 times its expensive to do so
	None
}
// checks for similar blocks from the current block to 2 others
// checks if they all exist, are comboable, and also if their kinds match with the first
// returns an array of u32 ids of the blocks that are comboable or nothing
// to save on cpu -> not creating empty vecs
checks for similar blocks from the current block to 2 others
checks if they all exist, are comboable, and also if their kinds match with the first
returns an array of u32 ids of the blocks that are comboable or nothing
to save on cpu -> not creating empty vecs
checks for similar blocks from the current block to 2 others checks if they all exist are comboable and also if their kinds match with the first returns an array of u32 ids of the blocks that are comboable or nothing to save on cpu - > not creating empty vecs
fn check_similar_block(
	x: usize, y: usize,
	x_offset: usize, y_offset: usize,
	stack: &Stack, 
	blocks: &WriteStorage<'_, Block>
) -> Option<Vec<u32>> {
	let b1 = blocks.get(stack.from_xy(x, y)).unwrap();
	let check_boundary = |x: usize, y: usize| -> Option<&Block> {
		if x < COLS && y < ROWS {
			blocks.get(stack.from_xy(x, y))
		}
		else {
			None
		}
	};
	let b2 = check_boundary(x + x_offset, y + y_offset);
	let b3 = check_boundary(x + x_offset * 2, y + y_offset * 2);
	if b1.is_comboable() {
		if let Some(block2) = b2 {
			if let Some(block3) = b3 {
				if block2.is_comboable_with(b1.kind) && block3.is_comboable_with(b1.kind) {
					return Some(vec! [
						b1.id,
						block2.id,
						block3.id,
					])
				}
			}
		}
	}	
	// just return nothing to save up on cpu
	// we could just return an empty vec but since this happens around 72 * 2 times its expensive to do so
	None
}
fn check_similar_block ( x : usize , y : usize , x_offset : usize , y_offset : usize , stack : & Stack , blocks : & WriteStorage < ' _ , Block > ) -> Option < Vec < u32 > > { let b1 = blocks . get ( stack . from_xy ( x , y ) ) . unwrap ( ) ; let check_boundary = | x : usize , y : usize | -> Option < & Block > { if x < COLS && y < ROWS { blocks . get ( stack . from_xy ( x , y ) ) } else { None } } ; let b2 = check_boundary ( x + x_offset , y + y_offset ) ; let b3 = check_boundary ( x + x_offset * 2 , y + y_offset * 2 ) ; if b1 . is_comboable ( ) { if let Some ( block2 ) = b2 { if let Some ( block3 ) = b3 { if block2 . is_comboable_with ( b1 . kind ) && block3 . is_comboable_with ( b1 . kind ) { return Some ( vec ! [ b1 id block2 id block3 id ] ) } } } } // just return nothing to save up on cpu // we could just return an empty vec but since this happens around 72 * 2 times its expensive to do so None }
checks for similar blocks from the current block to 2 others
checks if they all exist, are comboable, and also if their kinds match with the first
returns an array of u32 ids of the blocks that are comboable or nothing
to save on cpu -> not creating empty vecs
checks for similar blocks from the current block to 2 others checks if they all exist are comboable and also if their kinds match with the first returns an array of u32 ids of the blocks that are comboable or nothing to save on cpu - > not creating empty vecs
x
usize
y
usize
x_offset
usize
y_offset
usize
stack
&Stack
blocks
&WriteStorage<'_, Block>
x
usize
y
usize
x_offset
usize
y_offset
usize
stack
&Stack
blocks
&WriteStorage<'_, Block>