From 846b738bf5da5dd421b07a5a89751aac5fe9fa30 Mon Sep 17 00:00:00 2001 From: copygirl Date: Tue, 5 Mar 2024 16:01:54 +0100 Subject: [PATCH] Use default field values for Probe struct --- src/test/flecs/world.zig | 4 ++-- src/test/util.zig | 28 ++++++++++++---------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/test/flecs/world.zig b/src/test/flecs/world.zig index db052ab..62ddba0 100644 --- a/src/test/flecs/world.zig +++ b/src/test/flecs/world.zig @@ -41,7 +41,7 @@ test "World_progress_w_0" { const move_system = try world.system("move", move, c.EcsOnUpdate, "Position, Velocity"); - var ctx = util.Probe.init(); + var ctx = util.Probe{}; c.ecs_set_ctx(world.raw, &ctx, null); e1.set(Position, .{ .x = 0, .y = 0 }); @@ -78,7 +78,7 @@ test "World_progress_w_t" { const move_system = try world.system("move", move, c.EcsOnUpdate, "Position, Velocity"); - var ctx = util.Probe.init(); + var ctx = util.Probe{}; c.ecs_set_ctx(world.raw, &ctx, null); e1.set(Position, .{ .x = 0, .y = 0 }); diff --git a/src/test/util.zig b/src/test/util.zig index 502f934..f024e38 100644 --- a/src/test/util.zig +++ b/src/test/util.zig @@ -14,22 +14,18 @@ pub const MAX_ENTITIES = 256; pub const MAX_INVOCATIONS = 1024; pub const Probe = struct { - system: c.ecs_entity_t, - event: c.ecs_entity_t, - eventId: c.ecs_id_t, - offset: usize, - count: usize, - invoked: usize, - termCount: usize, - termIndex: usize, - e: [MAX_ENTITIES]c.ecs_entity_t, - c: [MAX_SYS_COLUMNS][MAX_INVOCATIONS]c.ecs_entity_t, - s: [MAX_SYS_COLUMNS][MAX_INVOCATIONS]c.ecs_entity_t, - param: ?*anyopaque, - - pub fn init() Probe { - return std.mem.zeroes(Probe); - } + system: c.ecs_entity_t = 0, + event: c.ecs_entity_t = 0, + eventId: c.ecs_id_t = 0, + offset: usize = 0, + count: usize = 0, + invoked: usize = 0, + termCount: usize = 0, + termIndex: usize = 0, + e: [MAX_ENTITIES]c.ecs_entity_t = .{0} ** MAX_ENTITIES, + c: [MAX_SYS_COLUMNS][MAX_INVOCATIONS]c.ecs_entity_t = .{.{0} ** MAX_INVOCATIONS} ** MAX_SYS_COLUMNS, + s: [MAX_SYS_COLUMNS][MAX_INVOCATIONS]c.ecs_entity_t = .{.{0} ** MAX_INVOCATIONS} ** MAX_SYS_COLUMNS, + param: ?*anyopaque = null, pub fn probeSystemWithContext(ctx: *Probe, it: Iter) !void { ctx.param = it.raw.param;