Remove some unused functions and other problems with std.testing.refAllDeclsRecursive

This commit is contained in:
IntegratedQuantum 2025-03-27 21:43:29 +01:00
parent c2ef9aba62
commit b5951f4bac
6 changed files with 3 additions and 54 deletions

View File

@ -97,6 +97,8 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
});
exe_tests.addIncludePath(headersDeps.path("include"));
exe_tests.linkLibC();
exe_tests.root_module.addImport("main", exe_tests.root_module);
const run_exe_tests = b.addRunArtifact(exe_tests);

View File

@ -62,16 +62,6 @@ pub const Sync = struct { // MARK: Sync
commands.enqueue(cmd);
}
pub fn undo() void {
mutex.lock();
defer mutex.unlock();
if(commands.dequeue_front()) |_cmd| {
var cmd = _cmd;
cmd.undo();
cmd.undoSteps.deinit(main.globalAllocator); // TODO: This should be put on some kind of redo queue once the testing phase is over.
}
}
fn nextId() u32 {
mutex.lock();
defer mutex.unlock();

View File

@ -26,7 +26,7 @@ pub fn reset() void {
pub fn createBlockModel(_: Block, _: *u16, zon: ZonElement) ModelIndex {
const modelId = zon.as([]const u8, "cubyz:cube");
if(!std.mem.eql(u8, modelId, "cubyz:cube")) {
std.log.err("Ores can only be use on cube models.", .{modelId});
std.log.err("Ores can only be use on cube models, found '{s}'", .{modelId});
}
if(modelCache) |modelIndex| return modelIndex;

View File

@ -56,10 +56,6 @@ pub const ClimateMapFragment = struct {
};
}
pub fn hashCodeSelf(self: *ClimateMapFragment) u32 {
return hashCode(self.wx, self.wy);
}
pub fn hashCode(wx: i32, wy: i32) u32 {
return @bitCast((wx >> mapShift)*%33 + (wy >> mapShift));
}

View File

@ -126,39 +126,6 @@ const Context = struct {
}
};
/// Returns a ridgid map of floats with values between 0 and 1.
pub fn generateRidgidNoise(allocator: NeverFailingAllocator, x: i32, y: i32, width: u31, height: u31, maxScale: u31, minScale: u31, worldSeed: u64, voxelSize: u31, reductionFactor: f32) Array2D(f32) {
const map = Array2D(f32).init(allocator, width/voxelSize, height/voxelSize);
@memset(map.mem, 0);
var seed = worldSeed;
random.scrambleSeed(&seed);
var context = Context{
.l1 = random.nextInt(u64, &seed),
.l2 = random.nextInt(u64, &seed),
.l3 = random.nextInt(u64, &seed),
};
var fac = 1/((1 - std.math.pow(f32, reductionFactor, @ctz(maxScale/minScale) + 1))/(1 - reductionFactor)); // geometric series.
var scale = maxScale;
while(scale >= minScale) : (scale >>= 1) {
context.resolution = scale;
context.resolutionMask = scale - 1;
const x0 = x & ~context.resolutionMask;
const y0 = y & ~context.resolutionMask;
context.calculateGridPoints(main.globalAllocator, x, y, width, height, scale);
defer context.freeGridPoints(main.globalAllocator);
var x1 = x;
while(x1 -% width -% x < 0) : (x1 +%= voxelSize) {
var y1 = y;
while(y1 -% y -% height < 0) : (y1 +%= voxelSize) {
map.ptr(@as(u32, @intCast(x1 -% x))/voxelSize, @as(u32, @intCast(y1 -% y))/voxelSize).* += (1 - @abs(context.perlin(x1 -% x0, y1 -% y0)))*fac;
}
}
fac *= reductionFactor;
}
return map;
}
/// Returns a smooth map of floats with values between 0 and 1.
pub fn generateSmoothNoise(allocator: NeverFailingAllocator, x: i32, y: i32, width: u31, height: u31, maxScale: u31, minScale: u31, worldSeed: u64, voxelSize: u31, reductionFactor: f32) Array2D(f32) {
const map = Array2D(f32).init(allocator, width/voxelSize, height/voxelSize);

View File

@ -982,12 +982,6 @@ pub const ServerWorld = struct { // MARK: ServerWorld
}
}
pub fn queueChunks(self: *ServerWorld, positions: []ChunkPosition, source: ?*User) void {
for(positions) |pos| {
self.queueChunk(pos, source);
}
}
pub fn queueChunkAndDecreaseRefCount(self: *ServerWorld, pos: ChunkPosition, source: *User) void {
self.chunkManager.queueChunkAndDecreaseRefCount(pos, source);
}