MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / coordinateValid

Method coordinateValid

source/game/StarCelestialDatabase.cpp:182–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182bool CelestialMasterDatabase::coordinateValid(CelestialCoordinate const& coordinate) {
183 RecursiveMutexLocker locker(m_mutex);
184
185 if (!coordinate)
186 return false;
187
188 auto const& chunk = getChunk(chunkIndexFor(coordinate));
189
190 auto systemObjects = chunk.systemObjects.ptr(coordinate.location());
191 if (!systemObjects)
192 return false;
193
194 if (coordinate.isSystem())
195 return true;
196
197 auto planet = systemObjects->ptr(coordinate.planet().orbitNumber());
198 if (!planet)
199 return false;
200
201 if (coordinate.isPlanetaryBody())
202 return true;
203
204 return planet->satelliteParameters.contains(coordinate.orbitNumber());
205}
206
207Maybe<CelestialCoordinate> CelestialMasterDatabase::findRandomWorld(unsigned tries, unsigned trySpatialRange,
208 function<bool(CelestialCoordinate)> filter, Maybe<uint64_t> seed) {

Callers 2

updatePlanetTypeMethod · 0.80

Calls 7

isSystemMethod · 0.80
orbitNumberMethod · 0.80
planetMethod · 0.80
isPlanetaryBodyMethod · 0.80
ptrMethod · 0.45
locationMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected