diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-20 17:53:17 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-07-20 17:53:17 +1000 |
commit | 5f86e0f027fe55004f835774db6b1d9b8d91ddd1 (patch) | |
tree | 17fbbf770960ed3af52b25e765c8391acf576d66 /source/game/StarCelestialDatabase.cpp | |
parent | b964668a38a69a3dcec58fece9bdf97b693d6e22 (diff) |
Hopefully fix server hang while finding a random starter world
Diffstat (limited to 'source/game/StarCelestialDatabase.cpp')
-rw-r--r-- | source/game/StarCelestialDatabase.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/game/StarCelestialDatabase.cpp b/source/game/StarCelestialDatabase.cpp index f2a70d0..ac9f14f 100644 --- a/source/game/StarCelestialDatabase.cpp +++ b/source/game/StarCelestialDatabase.cpp @@ -206,14 +206,16 @@ bool CelestialMasterDatabase::coordinateValid(CelestialCoordinate const& coordin Maybe<CelestialCoordinate> CelestialMasterDatabase::findRandomWorld(unsigned tries, unsigned trySpatialRange, function<bool(CelestialCoordinate)> filter, Maybe<uint64_t> seed) { - RecursiveMutexLocker locker(m_mutex); + //RecursiveMutexLocker locker(m_mutex); + // We don't need this mutex, the other calls are locking anyway. + // Having this here is just stopping other threads from having a go in here until we've found a world. RandomSource randSource; if (seed) randSource.init(*seed); for (unsigned i = 0; i < tries; ++i) { RectI range = xyRange(); Vec2I randomLocation = Vec2I(randSource.randInt(range.xMin(), range.xMax()), randSource.randInt(range.yMin(), range.yMax())); - for (auto system : scanSystems(RectI::withCenter(randomLocation, Vec2I::filled(trySpatialRange)))) { + for (auto& system : scanSystems(RectI::withCenter(randomLocation, Vec2I::filled(trySpatialRange)))) { if (!hasChildren(system).value(false)) continue; |