Update some uses of HashMap to match 0.8.0 changes

master
LeRoyce Pearson 4 years ago
parent 9b8e051017
commit 6df575ee04

@ -195,10 +195,10 @@ pub const Registry = struct {
} }
pub fn deinit(self: *Registry) void { pub fn deinit(self: *Registry) void {
var iter = self.components.iterator(); var iter = self.components.valueIterator();
while (iter.next()) |ptr| { 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 storage = @intToPtr(*Storage(u1), ptr.value); var storage = @intToPtr(*Storage(u1), ptr.*);
storage.deinit(); storage.deinit();
} }
@ -216,7 +216,7 @@ pub const Registry = struct {
pub fn assure(self: *Registry, comptime T: type) *Storage(T) { pub fn assure(self: *Registry, comptime T: type) *Storage(T) {
var type_id = utils.typeId(T); var type_id = utils.typeId(T);
if (self.components.getEntry(type_id)) |kv| { if (self.components.getEntry(type_id)) |kv| {
return @intToPtr(*Storage(T), kv.value); return @intToPtr(*Storage(T), kv.value_ptr.*);
} }
var comp_set = Storage(T).initPtr(self.allocator); var comp_set = Storage(T).initPtr(self.allocator);
@ -593,7 +593,7 @@ pub const Registry = struct {
/// given the 3 group Types arrays, generates a (mostly) unique u64 hash. Simultaneously ensures there are no duped types between /// given the 3 group Types arrays, generates a (mostly) unique u64 hash. Simultaneously ensures there are no duped types between
/// the 3 groups. /// the 3 groups.
fn hashGroupTypes(comptime owned: anytype, comptime includes: anytype, comptime excludes: anytype) callconv(.Inline) u64 { inline fn hashGroupTypes(comptime owned: anytype, comptime includes: anytype, comptime excludes: anytype) u64 {
comptime { comptime {
for (owned) |t1| { for (owned) |t1| {
for (includes) |t2| { for (includes) |t2| {
@ -615,7 +615,7 @@ pub const Registry = struct {
} }
/// expects a tuple of types. Convertes them to type names, sorts them then concatenates and returns the string. /// expects a tuple of types. Convertes them to type names, sorts them then concatenates and returns the string.
fn concatTypes(comptime types: anytype) callconv(.Inline) []const u8 { inline fn concatTypes(comptime types: anytype) []const u8 {
comptime { comptime {
if (types.len == 0) return "_"; if (types.len == 0) return "_";

@ -14,9 +14,9 @@ pub const TypeStore = struct {
} }
pub fn deinit(self: *TypeStore) void { pub fn deinit(self: *TypeStore) void {
var iter = self.map.iterator(); var iter = self.map.valueIterator();
while (iter.next()) |kv| { while (iter.next()) |val_ptr| {
self.allocator.free(kv.value); self.allocator.free(val_ptr.*);
} }
self.map.deinit(); self.map.deinit();
} }

Loading…
Cancel
Save