Update zig version to 0.12.0-dev.596+2adb932ad

I also had to add some workarounds for a new regression in the zig compiler: https://github.com/ziglang/zig/issues/17289
This commit is contained in:
IntegratedQuantum 2023-09-26 17:15:55 +02:00
parent 257c7d7a3b
commit 6e43ec3d40
3 changed files with 22 additions and 10 deletions

View File

@ -92,6 +92,7 @@ pub fn build(b: *std.build.Builder) !void {
//exe.strip = true; // Improves compile-time //exe.strip = true; // Improves compile-time
//exe.sanitize_thread = true; //exe.sanitize_thread = true;
exe.disable_stack_probing = true; // Improves tracing of stack overflow errors.
b.installArtifact(exe); b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe); const run_cmd = b.addRunArtifact(exe);

View File

@ -104,12 +104,20 @@ pub const World = struct {
// public final ArrayList<String> chatHistory = new ArrayList<>(); // public final ArrayList<String> chatHistory = new ArrayList<>();
pub fn init(self: *World, ip: []const u8, manager: *ConnectionManager) !void { pub fn init(self: *World, ip: []const u8, manager: *ConnectionManager) !void {
self.* = World { self.conn = try Connection.init(manager, ip);
.conn = try Connection.init(manager, ip), self.manager = manager;
.manager = manager, self.ambientLight = 0;
.name = "client", self.clearColor = .{0, 0, 0, 1};
.milliTime = std.time.milliTimestamp(), self.gravity = 9.81*1.5;
}; self.name = "client";
self.milliTime = std.time.milliTimestamp();
self.gameTime = std.atomic.Atomic(i64).init(0);
// self.* = World { TODO: Wait for #17289 fix.
// .conn = try Connection.init(manager, ip),
// .manager = manager,
// .name = "client",
// .milliTime = std.time.milliTimestamp(),
// };
try self.itemDrops.init(main.globalAllocator, self); try self.itemDrops.init(main.globalAllocator, self);
Player.inventory__SEND_CHANGES_TO_SERVER = try Inventory.init(main.globalAllocator, 32); Player.inventory__SEND_CHANGES_TO_SERVER = try Inventory.init(main.globalAllocator, 32);
// TODO: // TODO:

View File

@ -461,10 +461,13 @@ pub const ClientItemDropManager = struct {
pub fn init(self: *ClientItemDropManager, allocator: Allocator, world: *World) !void { pub fn init(self: *ClientItemDropManager, allocator: Allocator, world: *World) !void {
std.debug.assert(instance == null); // Only one instance allowed. std.debug.assert(instance == null); // Only one instance allowed.
instance = self; instance = self;
self.* = ClientItemDropManager { self.super = undefined;
.super = undefined, self.lastTime = @as(i16, @truncate(std.time.milliTimestamp())) -% settings.entityLookback;
.lastTime = @as(i16, @truncate(std.time.milliTimestamp())) -% settings.entityLookback, self.timeDifference = .{};
}; // self.* = ClientItemDropManager { TODO: Wait for #17289 fix.
// .super = undefined,
// .lastTime = @as(i16, @truncate(std.time.milliTimestamp())) -% settings.entityLookback,
// };
try self.super.init(allocator, null, world.gravity); try self.super.init(allocator, null, world.gravity);
self.super.addWithIndexAndRotation = &overrideAddWithIndexAndRotation; self.super.addWithIndexAndRotation = &overrideAddWithIndexAndRotation;
self.interpolation.init( self.interpolation.init(