Playing around with testing (unsuccessfully)

This commit is contained in:
2026-04-29 10:17:48 +02:00
parent fc67fe3d7e
commit be06634232
4 changed files with 31 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ const std = @import("std");
const rl = @import("raylib");
const c = @import("../constants.zig");
const e = @import("../errors.zig");
const Road = @import("road.zig").Road;
pub const Node = struct {
@@ -34,7 +35,7 @@ pub const Node = struct {
pub fn referenceRoad(self: *Node, allocator: std.mem.Allocator, road_to_add: *Road) !void {
// Note the road_to_add pointer must be one from the roads list as otherwise the pointer is dangling one
for (self.roads.items) |road| {
if (road.*.id == road_to_add.*.id) return error.RoadAlreadyReferenced;
if (road == road_to_add) return e.Entity.AlreadyReferenced;
}
try self.roads.append(allocator, road_to_add);