* Get a random point inside the given region zone. * The point will be used to land a UFO, so it HAS to be on land. */
| 697 | * The point will be used to land a UFO, so it HAS to be on land. |
| 698 | */ |
| 699 | std::pair<double, double> AlienMission::getLandPoint(const Globe &globe, const RuleRegion ®ion, size_t zone) |
| 700 | { |
| 701 | int tries = 0; |
| 702 | std::pair<double, double> pos; |
| 703 | do |
| 704 | { |
| 705 | pos = region.getRandomPoint(zone); |
| 706 | ++tries; |
| 707 | } |
| 708 | while (!(globe.insideLand(pos.first, pos.second) |
| 709 | && region.insideRegion(pos.first, pos.second)) |
| 710 | && tries < 100); |
| 711 | if (tries == 100) |
| 712 | { |
| 713 | Log(LOG_DEBUG) << "Region: " << region.getType() << " Longitude: " << pos.first << " Lattitude: " << pos.second << " invalid zone: " << zone << " ufo forced to land on water!"; |
| 714 | } |
| 715 | return pos; |
| 716 | |
| 717 | } |
| 718 | |
| 719 | } |
nothing calls this directly
no test coverage detected