Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarCelestialDatabase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/game/StarCelestialDatabase.cpp')
-rw-r--r--source/game/StarCelestialDatabase.cpp6
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;