Fixed the issue of newly built intersecting node not connecting to all existing (intersecting) roads

This commit is contained in:
2026-05-01 19:03:31 +02:00
parent dd64ec648a
commit f7a1340500
3 changed files with 14 additions and 9 deletions

View File

@@ -37,9 +37,8 @@ pub const RoadManager = struct {
/// Function which creates the road object, its pointer, adds it to the list
/// and then also references that same road to the bounding nodes
pub fn addRoad(self: *RoadManager, allocator: std.mem.Allocator, start: *Node, end: *Node) !void {
const road: Road = .init(self.getNextID(), start, end);
const road_ptr = try allocator.create(Road);
road_ptr.* = road;
road_ptr.* = Road.init(self.getNextID(), start, end);
try self.roads.append(allocator, road_ptr);
const ref = self.roads.items[self.roads.items.len - 1];