Repository: godotengine/godot
File: modules/gridmap/grid_map.cpp (C++)

Code before:
	ERR_FAIL_COND_V_MSG(p_layer_number > 32, false, "Collision layer number must be between 1 and 32 inclusive.");
	return get_collision_layer() & (1 << (p_layer_number - 1));
}

void GridMap::set_collision_mask_value(int p_layer_number, bool p_value) {
	ERR_FAIL_COND_MSG(p_layer_number < 1, "Collision layer number must be between 1 and 32 inclusive.");
	ERR_FAIL_COND_MSG(p_layer_number > 32, "Collision layer number must be between 1 and 32 inclusive.");
	uint32_t mask = get_collision_mask();
	if (p_value) {
		mask |= 1 << (p_layer_number - 1);
	} else {
		mask &= ~(1 << (p_layer_number - 1));
	}
	set_collision_mask(mask);
}

void GridMap::set_collision_priority(real_t p_priority) {
	collision_priority = p_priority;
	_update_physics_bodies_collision_properties();
}

real_t GridMap::get_collision_priority() const {
	return collision_priority;
}

void GridMap::set_collision_visibility_mode(DebugVisibilityMode p_show_collision) {
	if (collision_visibility_mode == p_show_collision) {
		return;
	}
	collision_visibility_mode = p_show_collision;
	_recreate_octant_data();
}

GridMap::DebugVisibilityMode GridMap::get_collision_visibility_mode() const {
	return collision_visibility_mode;
}

void GridMap::set_physics_material(Ref<PhysicsMaterial> p_material) {
	physics_material = p_material;
	_update_physics_bodies_characteristics();
}

Ref<PhysicsMaterial> GridMap::get_physics_material() const {
	return physics_material;
}

bool GridMap::get_collision_mask_value(int p_layer_number) const {
	ERR_FAIL_COND_V_MSG(p_layer_number < 1, false, "Collision layer number must be between 1 and 32 inclusive.");
	ERR_FAIL_COND_V_MSG(p_layer_number > 32, false, "Collision layer number must be between 1 and 32 inclusive.");
	return get_collision_mask() & (1 << (p_layer_number - 1));
}

Review comment (bug):
```suggestion
void GridMap::set_collision_visibility_mode(DebugVisibilityMode p_visibility_mode) {
```

Code after:
	ERR_FAIL_COND_V_MSG(p_layer_number > 32, false, "Collision layer number must be between 1 and 32 inclusive.");
	return get_collision_layer() & (1 << (p_layer_number - 1));
}

void GridMap::set_collision_mask_value(int p_layer_number, bool p_value) {
	ERR_FAIL_COND_MSG(p_layer_number < 1, "Collision layer number must be between 1 and 32 inclusive.");
	ERR_FAIL_COND_MSG(p_layer_number > 32, "Collision layer number must be between 1 and 32 inclusive.");
	uint32_t mask = get_collision_mask();
	if (p_value) {
		mask |= 1 << (p_layer_number - 1);
	} else {
		mask &= ~(1 << (p_layer_number - 1));
	}
	set_collision_mask(mask);
}

void GridMap::set_collision_priority(real_t p_priority) {
	collision_priority = p_priority;
	_update_physics_bodies_collision_properties();
}

real_t GridMap::get_collision_priority() const {
	return collision_priority;
}

void GridMap::set_collision_visibility_mode(DebugVisibilityMode p_visibility_mode) {
	if (collision_visibility_mode == p_visibility_mode) {
		return;
	}
	collision_visibility_mode = p_visibility_mode;
	_recreate_octant_data();
}

GridMap::DebugVisibilityMode GridMap::get_collision_visibility_mode() const {
	return collision_visibility_mode;
}

void GridMap::set_physics_material(Ref<PhysicsMaterial> p_material) {
	physics_material = p_material;
	_update_physics_bodies_characteristics();
}

Ref<PhysicsMaterial> GridMap::get_physics_material() const {
	return physics_material;
}

bool GridMap::get_collision_mask_value(int p_layer_number) const {
	ERR_FAIL_COND_V_MSG(p_layer_number < 1, false, "Collision layer number must be between 1 and 32 inclusive.");
	ERR_FAIL_COND_V_MSG(p_layer_number > 32, false, "Collision layer number must be between 1 and 32 inclusive.");
	return get_collision_mask() & (1 << (p_layer_number - 1));
}