Optimize Map::check_collision_with_detectors().