Limit the randomness of the FractalCaveGenerator to prevent infinite recursion.

Should fix #328
This commit is contained in:
IntegratedQuantum 2024-04-21 10:54:10 +02:00
parent e2459d1fbd
commit 9738d6252f

View File

@ -171,7 +171,7 @@ fn generateBranchingCaveBetween(_seed: u64, map: *CaveMapFragment, startRelPos:
branchLength*random.nextFloatSigned(&seed),
branchLength*random.nextFloatSigned(&seed)/2,
};
generateBranchingCaveBetween(random.nextInt(u64, &seed), map, startRelPos, newEndPos, newBias, newStartRadius, minRadius, seedPos, branchLength/2, @min(0.5, randomness + randomness*random.nextFloat(&seed)*random.nextFloat(&seed)), true, true);
generateBranchingCaveBetween(random.nextInt(u64, &seed), map, startRelPos, newEndPos, newBias, newStartRadius, minRadius, seedPos, branchLength/2, @min(0.5/@sqrt(3.0) - 0.01, randomness + randomness*random.nextFloat(&seed)*random.nextFloat(&seed)), true, true);
}
return;
}