Don't usingnamespace all of errors.zig

main
copygirl 9 months ago
parent 2bc8f54a83
commit ea93c6026a
  1. 5
      src/entity.zig
  2. 0
      src/errors.zig
  3. 8
      src/main.zig
  4. 5
      src/world.zig

@ -2,6 +2,7 @@ const std = @import("std");
const Allocator = std.mem.Allocator;
const meta = @import("./meta.zig");
const errors = @import("./errors.zig");
const flecszigble = @import("./main.zig");
const Path = flecszigble.Path;
const c = flecszigble.c;
@ -133,7 +134,7 @@ pub fn Entity(comptime ctx: anytype) type {
var desc = std.mem.zeroInit(c.ecs_entity_desc_t, .{ .sep = "".ptr, .name = n.ptr });
desc.add[0] = c.ecs_pair(c.EcsChildOf, parent_);
scope = c.ecs_entity_init(world.raw, &desc);
if (scope == 0) return flecszigble.getLastErrorOrUnknown();
if (scope == 0) return errors.getLastErrorOrUnknown();
} else scope = found;
},
}
@ -162,7 +163,7 @@ pub fn Entity(comptime ctx: anytype) type {
return error.FoundChildOf;
const result = c.ecs_entity_init(world.raw, &desc);
if (result == 0) return flecszigble.getLastErrorOrUnknown();
if (result == 0) return errors.getLastErrorOrUnknown();
return Self.fromRaw(world, result);
}

@ -2,9 +2,13 @@ const std = @import("std");
const Allocator = std.mem.Allocator;
const meta = @import("./meta.zig");
// Meant for internal use, but exposed since flecs-zig-ble
// doesn't wrap nearly enough of Flecs' available features.
pub const errors = @import("./errors.zig");
pub const c = @import("./c.zig");
pub usingnamespace @import("./error.zig");
pub const FlecsError = errors.FlecsError;
pub const Path = @import("./path.zig");
pub usingnamespace @import("./entity.zig");
pub usingnamespace @import("./id.zig");
@ -12,8 +16,6 @@ pub usingnamespace @import("./iter.zig");
pub usingnamespace @import("./pair.zig");
pub usingnamespace @import("./world.zig");
pub const Path = @import("./path.zig");
pub var is_initialized = false;
pub var allocator: Allocator = undefined;

@ -2,6 +2,7 @@ const std = @import("std");
const Allocator = std.mem.Allocator;
const meta = @import("./meta.zig");
const errors = @import("./errors.zig");
const flecszigble = @import("./main.zig");
const Path = flecszigble.Path;
const c = flecszigble.c;
@ -112,7 +113,7 @@ pub fn World(comptime ctx: anytype) type {
});
const result = c.ecs_component_init(self.raw, &desc);
if (result == 0) return flecszigble.getLastErrorOrUnknown();
if (result == 0) return errors.getLastErrorOrUnknown();
Context.lookupMut(T).* = result;
return Entity.fromRaw(self, result);
}
@ -175,7 +176,7 @@ pub fn World(comptime ctx: anytype) type {
desc.query.filter.expr = expr;
const result = c.ecs_system_init(self.raw, &desc);
if (result == 0) return flecszigble.getLastErrorOrUnknown();
if (result == 0) return errors.getLastErrorOrUnknown();
return Entity.fromRaw(self, result);
}

Loading…
Cancel
Save