* Checks if a polar point is inside the globe's landmass. * @param lon Longitude of the point. * @param lat Latitude of the point. * @return True if it's inside, False if it's outside. */
| 810 | * @return True if it's inside, False if it's outside. |
| 811 | */ |
| 812 | bool Globe::insideLand(double lon, double lat) const |
| 813 | { |
| 814 | bool inside = false; |
| 815 | // We're only temporarily changing cenLon/cenLat so the "const" is actually preserved |
| 816 | Globe* const globe = const_cast<Globe* const>(this); // WARNING: BAD CODING PRACTICE |
| 817 | double oldLon = _cenLon, oldLat = _cenLat; |
| 818 | globe->_cenLon = lon; |
| 819 | globe->_cenLat = lat; |
| 820 | for (std::list<Polygon*>::iterator i = _game->getResourcePack()->getPolygons()->begin(); i != _game->getResourcePack()->getPolygons()->end() && !inside; ++i) |
| 821 | { |
| 822 | inside = insidePolygon(lon, lat, *i); |
| 823 | } |
| 824 | globe->_cenLon = oldLon; |
| 825 | globe->_cenLat = oldLat; |
| 826 | return inside; |
| 827 | } |
| 828 | |
| 829 | /** |
| 830 | * Switches the amount of detail shown on the globe. |
no test coverage detected