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

Method scanSystems

source/game/StarCelestialDatabase.cpp:294–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294List<CelestialCoordinate> CelestialMasterDatabase::scanSystems(RectI const& region, Maybe<StringSet> const& includedTypes) {
295 RecursiveMutexLocker locker(m_mutex);
296
297 List<CelestialCoordinate> systems;
298 for (auto const& chunkLocation : chunkIndexesFor(region)) {
299 auto const& chunkData = getChunk(chunkLocation, [&](std::function<void()>&& func) {
300 locker.unlock();
301 func();
302 locker.lock();
303 });
304 locker.unlock();
305 for (auto const& pair : chunkData.systemParameters) {
306 Vec3I systemLocation = pair.first;
307 if (region.contains(systemLocation.vec2())) {
308 if (includedTypes) {
309 String thisType = pair.second.getParameter("typeName", "").toString();
310 if (!includedTypes->contains(thisType))
311 continue;
312 }
313 systems.append(CelestialCoordinate(systemLocation));
314 }
315 }
316 locker.lock();
317 }
318 return systems;
319}
320
321List<pair<Vec2I, Vec2I>> CelestialMasterDatabase::scanConstellationLines(RectI const& region) {
322 RecursiveMutexLocker locker(m_mutex);

Callers 2

warpRandomMethod · 0.80

Calls 10

funcFunction · 0.85
CelestialCoordinateClass · 0.85
vec2Method · 0.80
getParameterMethod · 0.80
unlockMethod · 0.45
lockMethod · 0.45
containsMethod · 0.45
toStringMethod · 0.45
appendMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected