MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / insideLand

Method insideLand

src/Geoscape/Globe.cpp:812–827  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

810 * @return True if it's inside, False if it's outside.
811 */
812bool 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.

Callers 3

getLandPointMethod · 0.80
globeClickMethod · 0.80
moveMethod · 0.80

Calls 2

getPolygonsMethod · 0.80
getResourcePackMethod · 0.45

Tested by

no test coverage detected