- int8_t len = -1, i;
- point_t *p;
- poly_t *pol_disc, *pol_opp;
- int8_t ret;
- int16_t opp_w, opp_l, opp_x, opp_y;
- point_t p_dst, robot_pt;
-
- DEBUG(E_USER_STRAT, "%s(%d,%d) flags_i=%x flags_f=%x forw=%d",
- __FUNCTION__, x, y, flags_intermediate, flags_final, forward);
-
- retry:
- get_opponent_xy(&opp_x, &opp_y);
- opp_w = O_WIDTH;
- opp_l = O_LENGTH;
-
- robot_pt.x = position_get_x_s16(&mainboard.pos);
- robot_pt.y = position_get_y_s16(&mainboard.pos);
-
- oa_init();
- pol_disc = oa_new_poly(5);
- set_central_disc_poly(pol_disc, &robot_pt);
- pol_opp = oa_new_poly(4);
- set_opponent_poly(pol_opp, &robot_pt, O_WIDTH, O_LENGTH);
-
- /* If we are not in the limited area, try to go in it. */
- ret = go_in_area(&robot_pt);
-
- /* check that destination is valid */
- p_dst.x = x;
- p_dst.y = y;
- if (!is_in_boundingbox(&p_dst)) {
- NOTICE(E_USER_STRAT, " dst is not in playground");
- return END_ERROR;
- }
- if (is_point_in_poly(pol_disc, x, y)) {
- NOTICE(E_USER_STRAT, " dst is in disc");
- return END_ERROR;
- }
- if (is_point_in_poly(pol_opp, x, y)) {
- NOTICE(E_USER_STRAT, " dst is in opp");
- return END_ERROR;
- }