From 052d3a7da8fda86860bd134d8d23812366ea7f37 Mon Sep 17 00:00:00 2001 From: Benjaaaa Date: Sun, 25 Dec 2022 17:19:48 -0300 Subject: [PATCH] mach: fix compiler error regarding zig changes (#645) --- libs/ecs/src/entities.zig | 10 +++++----- libs/ecs/src/systems.zig | 7 +++---- libs/sysaudio/src/main.zig | 4 ++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/libs/ecs/src/entities.zig b/libs/ecs/src/entities.zig index 00daafb9..1ebd56cd 100644 --- a/libs/ecs/src/entities.zig +++ b/libs/ecs/src/entities.zig @@ -81,10 +81,10 @@ pub const ArchetypeStorage = struct { fn debugValidateRow(storage: *ArchetypeStorage, gpa: Allocator, row: anytype) void { inline for (std.meta.fields(@TypeOf(row))) |field, index| { const column = storage.columns[index]; - if (typeId(field.field_type) != column.type_id) { + if (typeId(field.type) != column.type_id) { const msg = std.mem.concat(gpa, u8, &.{ "unexpected type: ", - @typeName(field.field_type), + @typeName(field.type), " expected: ", column.name, }) catch |err| @panic(@errorName(err)); @@ -179,7 +179,7 @@ pub const ArchetypeStorage = struct { const fields = std.meta.fields(@TypeOf(row)); inline for (fields) |field, index| { - const ColumnType = field.field_type; + const ColumnType = field.type; if (@sizeOf(ColumnType) == 0) continue; const column = storage.columns[index]; const column_values = @ptrCast([*]ColumnType, @alignCast(@alignOf(ColumnType), &storage.block[column.offset])); @@ -375,10 +375,10 @@ pub fn Entities(comptime all_components: anytype) type { const namespaces = std.meta.fields(@TypeOf(all_components)); var fields: [namespaces.len]std.builtin.Type.UnionField = undefined; inline for (namespaces) |namespace, i| { - const component_enum = std.meta.FieldEnum(namespace.field_type); + const component_enum = std.meta.FieldEnum(namespace.type); fields[i] = .{ .name = namespace.name, - .field_type = component_enum, + .type = component_enum, .alignment = @alignOf(component_enum), }; } diff --git a/libs/ecs/src/systems.zig b/libs/ecs/src/systems.zig index 260a626b..21de673d 100644 --- a/libs/ecs/src/systems.zig +++ b/libs/ecs/src/systems.zig @@ -42,7 +42,7 @@ pub fn Messages(comptime messages: anytype) type { const message_type = @field(messages, message_field.name); fields = fields ++ [_]std.builtin.Type.UnionField{.{ .name = message_field.name, - .field_type = message_type, + .type = message_type, .alignment = if (message_type == void) 0 else @alignOf(message_type), }}; } @@ -80,7 +80,6 @@ pub fn MessagesTag(comptime messages: anytype) type { return @Type(.{ .Enum = .{ - .layout = .Auto, .tag_type = std.meta.Int(.unsigned, @floatToInt(u16, math.ceil(math.log2(@intToFloat(f64, message_fields.len))))), .fields = fields, .decls = &[_]std.builtin.Type.Declaration{}, @@ -99,7 +98,7 @@ fn NamespacedComponents(comptime modules: anytype) type { if (@hasField(@TypeOf(module), "components")) { fields = fields ++ [_]std.builtin.Type.StructField{.{ .name = module_field.name, - .field_type = @TypeOf(module.components), + .type = @TypeOf(module.components), .default_value = null, .is_comptime = false, .alignment = @alignOf(@TypeOf(module.components)), @@ -204,7 +203,7 @@ fn NamespacedGlobals(comptime modules: anytype) type { if (@hasField(@TypeOf(module), "globals")) { fields = fields ++ [_]std.builtin.Type.StructField{.{ .name = module_field.name, - .field_type = module.globals, + .type = module.globals, .default_value = null, .is_comptime = false, .alignment = @alignOf(module.globals), diff --git a/libs/sysaudio/src/main.zig b/libs/sysaudio/src/main.zig index 1f0712d0..322d0901 100644 --- a/libs/sysaudio/src/main.zig +++ b/libs/sysaudio/src/main.zig @@ -28,12 +28,12 @@ pub const Context = struct { var data: backends.BackendContext = blk: { if (backend) |b| { break :blk try @typeInfo( - std.meta.fieldInfo(backends.BackendContext, b).field_type, + std.meta.fieldInfo(backends.BackendContext, b).type, ).Pointer.child.init(allocator, options); } else { inline for (std.meta.fields(Backend)) |b, i| { if (@typeInfo( - std.meta.fieldInfo(backends.BackendContext, @intToEnum(Backend, b.value)).field_type, + std.meta.fieldInfo(backends.BackendContext, @intToEnum(Backend, b.value)).type, ).Pointer.child.init(allocator, options)) |d| { break :blk d; } else |err| {