zig 0.7 fixes
This commit is contained in:
parent
dec796d256
commit
b8117306fa
@ -173,7 +173,7 @@ pub const OwningGroup = struct {
|
|||||||
|
|
||||||
var component_ptrs: [component_info.fields.len][*]u8 = undefined;
|
var component_ptrs: [component_info.fields.len][*]u8 = undefined;
|
||||||
inline for (component_info.fields) |field, i| {
|
inline for (component_info.fields) |field, i| {
|
||||||
const storage = self.registry.assure(field.field_type.Child);
|
const storage = self.registry.assure(std.meta.Child(field.field_type));
|
||||||
component_ptrs[i] = @ptrCast([*]u8, storage.instances.items.ptr);
|
component_ptrs[i] = @ptrCast([*]u8, storage.instances.items.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ pub const OwningGroup = struct {
|
|||||||
const index = self.firstOwnedStorage().set.index(entity);
|
const index = self.firstOwnedStorage().set.index(entity);
|
||||||
var comps: Components = undefined;
|
var comps: Components = undefined;
|
||||||
inline for (component_info.fields) |field, i| {
|
inline for (component_info.fields) |field, i| {
|
||||||
const typed_ptr = @ptrCast([*]field.field_type.Child, @alignCast(@alignOf(field.field_type.Child), component_ptrs[i]));
|
const typed_ptr = @ptrCast([*]std.meta.Child(field.field_type), @alignCast(@alignOf(std.meta.Child(field.field_type)), component_ptrs[i]));
|
||||||
@field(comps, field.name) = &typed_ptr[index];
|
@field(comps, field.name) = &typed_ptr[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ pub const Registry = struct {
|
|||||||
assert(self.valid(entity));
|
assert(self.valid(entity));
|
||||||
|
|
||||||
var iter = self.components.iterator();
|
var iter = self.components.iterator();
|
||||||
for (iter.next()) |ptr| {
|
while (iter.next()) |ptr| {
|
||||||
// HACK: we dont know the Type here but we need to be able to call methods on the Storage(T)
|
// HACK: we dont know the Type here but we need to be able to call methods on the Storage(T)
|
||||||
var store = @intToPtr(*Storage(u1), ptr.value);
|
var store = @intToPtr(*Storage(u1), ptr.value);
|
||||||
store.removeIfContains(entity);
|
store.removeIfContains(entity);
|
||||||
|
@ -14,7 +14,8 @@ pub const Assets = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(self: *Assets) void {
|
pub fn deinit(self: *Assets) void {
|
||||||
for (self.caches.items()) |ptr| {
|
var iter = self.caches.iterator();
|
||||||
|
while (iter.next()) |ptr| {
|
||||||
// HACK: we dont know the Type here but we need to call deinit
|
// HACK: we dont know the Type here but we need to call deinit
|
||||||
@intToPtr(*Cache(u1), ptr.value).deinit();
|
@intToPtr(*Cache(u1), ptr.value).deinit();
|
||||||
}
|
}
|
||||||
@ -39,7 +40,7 @@ pub const Assets = struct {
|
|||||||
fn ReturnType(comptime loader: anytype, strip_ptr: bool) type {
|
fn ReturnType(comptime loader: anytype, strip_ptr: bool) type {
|
||||||
var ret = @typeInfo(@TypeOf(@field(loader, "load"))).BoundFn.return_type.?;
|
var ret = @typeInfo(@TypeOf(@field(loader, "load"))).BoundFn.return_type.?;
|
||||||
if (strip_ptr) {
|
if (strip_ptr) {
|
||||||
return ret.Child;
|
return std.meta.Child(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,8 @@ pub fn Cache(comptime T: type) type {
|
|||||||
pub fn clear(self: *@This()) void {
|
pub fn clear(self: *@This()) void {
|
||||||
// optionally deinit any resources that have a deinit method
|
// optionally deinit any resources that have a deinit method
|
||||||
if (@hasDecl(T, "deinit")) {
|
if (@hasDecl(T, "deinit")) {
|
||||||
for (self.resources.items()) |kv| {
|
var iter = self.resources.iterator();
|
||||||
|
while (iter.next()) |kv| {
|
||||||
@call(.{ .modifier = .always_inline }, @field(kv.value, "deinit"), .{});
|
@call(.{ .modifier = .always_inline }, @field(kv.value, "deinit"), .{});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +76,7 @@ pub fn Cache(comptime T: type) type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn size(self: @This()) usize {
|
pub fn size(self: @This()) usize {
|
||||||
return self.resources.items().len;
|
return self.resources.count();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@ pub const Dispatcher = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn deinit(self: *Dispatcher) void {
|
pub fn deinit(self: *Dispatcher) void {
|
||||||
for (self.signals.items()) |ptr| {
|
var iter = self.signals.iterator();
|
||||||
|
while (iter.next()) |ptr| {
|
||||||
// HACK: we dont know the Type here but we need to call deinit
|
// HACK: we dont know the Type here but we need to call deinit
|
||||||
var signal = @intToPtr(*Signal(void), ptr.value);
|
var signal = @intToPtr(*Signal(void), ptr.value);
|
||||||
signal.deinit();
|
signal.deinit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user