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

Method insideRegion

src/Ruleset/RuleRegion.cpp:145–162  ·  view source on GitHub ↗

* Checks if a point is inside this region. * @param lon Longitude in radians. * @param lat Latitude in radians. * @return True if it's inside, false if it's outside. */

Source from the content-addressed store, hash-verified

143 * @return True if it's inside, false if it's outside.
144 */
145bool RuleRegion::insideRegion(double lon, double lat) const
146{
147 for (size_t i = 0; i < _lonMin.size(); ++i)
148 {
149 bool inLon, inLat;
150
151 if (_lonMin[i] <= _lonMax[i])
152 inLon = (lon >= _lonMin[i] && lon < _lonMax[i]);
153 else
154 inLon = ((lon >= _lonMin[i] && lon < 6.283) || (lon >= 0 && lon < _lonMax[i]));
155
156 inLat = (lat >= _latMin[i] && lat < _latMax[i]);
157
158 if (inLon && inLat)
159 return true;
160 }
161 return false;
162}
163
164/**
165 * Gets the list of cities contained in this region.

Callers 15

operator()Method · 0.80
operator()Method · 0.80
thinkMethod · 0.80
addScoreMethod · 0.80
getLandPointMethod · 0.80
prepareDebriefingMethod · 0.80
initMethod · 0.80
TransferBaseStateMethod · 0.80
ConfirmNewBaseStateMethod · 0.80
AlienBaseStateMethod · 0.80
time5SecondsMethod · 0.80
time30MinutesMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected