| | |
| | | // return i; |
| | | // } |
| | | // } |
| | | if (mapList[i].type == MAP_TYPE_CURVE) { |
| | | const int step = 10; |
| | | Polygon map; |
| | | bool enter = false; |
| | | |
| | | map.num = 1 + mapList[i].map.num / step + ((mapList[i].map.num % step == 0) ? 0 : 1); |
| | | map.num += 1 + mapList[i].map2.num / step + ((mapList[i].map2.num % step == 0) ? 0 : 1); |
| | | map.point = (PointF *) malloc(map.num * sizeof(PointF)); |
| | | |
| | | int n = 0, m = 0; |
| | | while (n < mapList[i].map.num - 1) { |
| | | map.point[m++] = mapList[i].map.point[n]; |
| | | n += step; |
| | | } |
| | | map.point[m++] = mapList[i].map.point[mapList[i].map.num - 1]; |
| | | |
| | | n = mapList[i].map2.num - 1; |
| | | while (n > 0) { |
| | | map.point[m++] = mapList[i].map2.point[n]; |
| | | n -= step; |
| | | } |
| | | map.point[m++] = mapList[i].map2.point[0]; |
| | | |
| | | if (IntersectionOf(car->carXY[ car->axial[AXIAL_FRONT] ], &map) == GM_Containment) { |
| | | Line enterLine1; |
| | | |
| | | MakeLine(&enterLine1, &(mapList[i].map.point[0]), &(mapList[i].map2.point[0])); |
| | | |
| | | if (DistanceOf(car->carXY[car->axial[AXIAL_FRONT]], enterLine1) > 0.1) |
| | | enter = true; |
| | | } |
| | | |
| | | free(map.point); |
| | | |
| | | if (enter) return i; |
| | | } |
| | | } |
| | | return -1; |
| | | } |